Skip to content

Commit d53d3ea

Browse files
authored
Merge pull request #28 from vexxhost/cleanup-builds
ci: switch to gha
2 parents f34e11a + a55fa89 commit d53d3ea

File tree

11 files changed

+156
-58
lines changed

11 files changed

+156
-58
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/ci.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
golangci-lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
14+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
15+
with:
16+
go-version-file: go.mod
17+
- run: sudo apt install -y --no-install-recommends gcc libvirt-dev pkg-config
18+
- uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8

.github/workflows/image.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: image
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
id-token: write
17+
packages: write
18+
steps:
19+
- uses: depot/setup-action@b0b1ea4f69e92ebf5dea3f8713a1b0c37b2126a5 # v1.6.0
20+
- uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
21+
id: meta
22+
with:
23+
images: ghcr.io/vexxhost/libvirtd-exporter
24+
- uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
25+
if: github.event_name != 'pull_request'
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
- uses: depot/build-push-action@9785b135c3c76c33db102e45be96a25ab55cd507 # v1.16.2
31+
with:
32+
project: 02f1r753pl
33+
push: ${{ github.event_name != 'pull_request' }}
34+
tags: ${{ steps.meta.outputs.tags }}
35+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1+
.direnv
12
.tox
23
doc/build
3-
44
libvirtd_exporter

.gitreview

Lines changed: 0 additions & 4 deletions
This file was deleted.

.zuul.yaml

Lines changed: 0 additions & 50 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG RELEASE=bookworm
22

3-
FROM golang:1.22-${RELEASE} AS builder
3+
FROM golang:1.25-${RELEASE} AS builder
44
WORKDIR /go/src/app
55
RUN apt-get update && \
66
apt-get -y install libvirt-dev && \

collectors/domain_stats.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,10 @@ func (c *DomainStatsCollector) Collect(ch chan<- prometheus.Metric) {
402402
return
403403
}
404404

405-
c.connection.Close()
405+
_, err = c.connection.Close()
406+
if err != nil {
407+
c.logger.Error("Failed to close connection", "err", err)
408+
}
406409

407410
conn, err := libvirt.NewConnect(uri)
408411
if err != nil {

collectors/version.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ func (c *VersionCollector) Collect(ch chan<- prometheus.Metric) {
6464
return
6565
}
6666

67-
c.connection.Close()
67+
_, err = c.connection.Close()
68+
if err != nil {
69+
c.logger.Error("Failed to close connection", "err", err)
70+
}
6871

6972
conn, err := libvirt.NewConnect(uri)
7073
if err != nil {

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)