Skip to content

Commit 122274b

Browse files
committed
switch to golang 1.22
Signed-off-by: Markus Blaschke <[email protected]>
1 parent 000e626 commit 122274b

File tree

9 files changed

+93
-146
lines changed

9 files changed

+93
-146
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
/vendor/
21
/azure-devops-exporter
32
/release-assets

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
8+
- package-ecosystem: "docker"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"
12+
13+
- package-ecosystem: "gomod"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"
Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,65 @@
1-
name: "Scheduled: docker"
1+
name: build/docker
22

33
on:
4-
schedule:
5-
- cron: '0 6 * * 1'
4+
workflow_call:
5+
inputs:
6+
publish:
7+
required: true
8+
type: boolean
69

710
jobs:
811
lint:
912
runs-on: ubuntu-latest
1013
steps:
11-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
1215

1316
- name: Set Swap Space
14-
uses: pierotofy/set-swap-space@master
17+
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
1518
with:
1619
swap-size-gb: 12
1720

21+
- uses: actions/setup-go@v5
22+
with:
23+
go-version-file: 'go.mod'
24+
cache-dependency-path: "go.sum"
25+
check-latest: true
26+
1827
- name: Run Golangci lint
19-
uses: golangci/golangci-lint-action@v2
28+
uses: golangci/golangci-lint-action@v4
2029
with:
2130
version: latest
2231
args: --print-resources-usage
2332

2433
build:
34+
name: "build ${{ matrix.Dockerfile }}:${{ matrix.target }}"
2535
needs: lint
2636
strategy:
2737
fail-fast: false
2838
matrix:
29-
Dockerfile: [Dockerfile]
30-
suffix: [""]
31-
latest: ["auto"]
32-
include: []
39+
include:
40+
- Dockerfile: Dockerfile
41+
target: "final-static"
42+
suffix: ""
43+
latest: "auto"
44+
3345
runs-on: ubuntu-latest
3446
steps:
35-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v4
3648

3749
- name: Set Swap Space
38-
uses: pierotofy/set-swap-space@master
50+
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
3951
with:
4052
swap-size-gb: 12
4153

54+
- uses: actions/setup-go@v5
55+
with:
56+
go-version-file: 'go.mod'
57+
cache-dependency-path: "go.sum"
58+
check-latest: true
59+
4260
- name: Docker meta
4361
id: docker_meta
44-
uses: docker/metadata-action@v4
62+
uses: docker/metadata-action@v5
4563
with:
4664
images: ${{ github.repository }},quay.io/${{ github.repository }}
4765
labels: |
@@ -51,30 +69,33 @@ jobs:
5169
suffix=${{ matrix.suffix }}
5270
5371
- name: Set up QEMU
54-
uses: docker/setup-qemu-action@v1
72+
uses: docker/setup-qemu-action@v3
5573

5674
- name: Set up Docker Buildx
57-
uses: docker/setup-buildx-action@v1
75+
uses: docker/setup-buildx-action@v3
5876

5977
- name: Login to DockerHub
60-
uses: docker/login-action@v1
78+
uses: docker/login-action@v3
79+
if: ${{ inputs.publish }}
6180
with:
6281
username: ${{ secrets.DOCKERHUB_USERNAME }}
6382
password: ${{ secrets.DOCKERHUB_TOKEN }}
6483

6584
- name: Login to Quay
66-
uses: docker/login-action@v1
85+
uses: docker/login-action@v3
86+
if: ${{ inputs.publish }}
6787
with:
6888
registry: quay.io
6989
username: ${{ secrets.QUAY_USERNAME }}
7090
password: ${{ secrets.QUAY_TOKEN }}
7191

72-
- name: Build and push
73-
uses: docker/build-push-action@v2
92+
- name: ${{ inputs.publish && 'Build and push' || 'Build' }}
93+
uses: docker/build-push-action@v5
7494
with:
7595
context: .
7696
file: ./${{ matrix.Dockerfile }}
97+
target: ${{ matrix.target }}
7798
platforms: linux/amd64,linux/arm64
78-
push: ${{ github.event_name != 'pull_request' }}
99+
push: ${{ inputs.publish }}
79100
tags: ${{ steps.docker_meta.outputs.tags }}
80101
labels: ${{ steps.docker_meta.outputs.labels }}

.github/workflows/ci-docker.yaml

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,10 @@
1-
name: "CI docker"
1+
name: "ci/docker"
22

33
on: [pull_request, workflow_dispatch]
44

55
jobs:
66
build:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v2
10-
11-
- name: Set Swap Space
12-
uses: pierotofy/set-swap-space@master
13-
with:
14-
swap-size-gb: 12
15-
16-
- name: Run Golangci lint
17-
uses: golangci/golangci-lint-action@v2
18-
with:
19-
version: latest
20-
args: --print-resources-usage
21-
22-
- name: Docker meta
23-
id: docker_meta
24-
uses: docker/metadata-action@v3
25-
with:
26-
images: ${{ github.repository }},quay.io/${{ github.repository }}
27-
labels: |
28-
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.repository.default_branch }}/README.md
29-
30-
- name: Set up QEMU
31-
uses: docker/setup-qemu-action@v1
32-
33-
- name: Set up Docker Buildx
34-
uses: docker/setup-buildx-action@v1
35-
36-
- name: Build
37-
uses: docker/build-push-action@v2
38-
with:
39-
context: .
40-
file: ./Dockerfile
41-
push: false
42-
platforms: linux/amd64,linux/arm64
43-
tags: ${{ steps.docker_meta.outputs.tags }}
44-
labels: ${{ steps.docker_meta.outputs.labels }}
7+
uses: ./.github/workflows/build-docker.yaml
8+
secrets: inherit
9+
with:
10+
publish: false

.github/workflows/release-assets.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Release: assets"
1+
name: "release/assets"
22

33
on:
44
release:
@@ -8,16 +8,17 @@ jobs:
88
release:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212

1313
- name: Set Swap Space
14-
uses: pierotofy/set-swap-space@master
14+
uses: pierotofy/set-swap-space@49819abfb41bd9b44fb781159c033dba90353a7c
1515
with:
1616
swap-size-gb: 12
1717

18-
- uses: actions/setup-go@v2
18+
- uses: actions/setup-go@v5
1919
with:
20-
go-version: '1.19'
20+
go-version-file: 'go.mod'
21+
cache-dependency-path: "go.sum"
2122
check-latest: true
2223

2324
- name: Build
Lines changed: 9 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,17 @@
1-
name: "Release: docker"
1+
name: "release/docker"
22

33
on:
44
push:
55
branches:
6-
- '**'
6+
- 'main'
7+
- 'feature-**'
8+
- 'bugfix-**'
79
tags:
810
- '*.*.*'
911

1012
jobs:
11-
lint:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v2
15-
16-
- name: Set Swap Space
17-
uses: pierotofy/set-swap-space@master
18-
with:
19-
swap-size-gb: 12
20-
21-
- name: Run Golangci lint
22-
uses: golangci/golangci-lint-action@v2
23-
with:
24-
version: latest
25-
args: --print-resources-usage
26-
27-
build:
28-
needs: lint
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
Dockerfile: [Dockerfile]
33-
suffix: [""]
34-
latest: ["auto"]
35-
include: []
36-
runs-on: ubuntu-latest
37-
steps:
38-
- uses: actions/checkout@v2
39-
40-
- name: Set Swap Space
41-
uses: pierotofy/set-swap-space@master
42-
with:
43-
swap-size-gb: 12
44-
45-
- name: Docker meta
46-
id: docker_meta
47-
uses: docker/metadata-action@v4
48-
with:
49-
images: ${{ github.repository }},quay.io/${{ github.repository }}
50-
labels: |
51-
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/${{ github.event.repository.default_branch }}/README.md
52-
flavor: |
53-
latest=${{ matrix.latest }}
54-
suffix=${{ matrix.suffix }}
55-
56-
- name: Set up QEMU
57-
uses: docker/setup-qemu-action@v1
58-
59-
- name: Set up Docker Buildx
60-
uses: docker/setup-buildx-action@v1
61-
62-
- name: Login to DockerHub
63-
uses: docker/login-action@v1
64-
with:
65-
username: ${{ secrets.DOCKERHUB_USERNAME }}
66-
password: ${{ secrets.DOCKERHUB_TOKEN }}
67-
68-
- name: Login to Quay
69-
uses: docker/login-action@v1
70-
with:
71-
registry: quay.io
72-
username: ${{ secrets.QUAY_USERNAME }}
73-
password: ${{ secrets.QUAY_TOKEN }}
74-
75-
- name: Build and push
76-
uses: docker/build-push-action@v2
77-
with:
78-
context: .
79-
file: ./${{ matrix.Dockerfile }}
80-
platforms: linux/amd64,linux/arm64
81-
push: ${{ github.event_name != 'pull_request' }}
82-
tags: ${{ steps.docker_meta.outputs.tags }}
83-
labels: ${{ steps.docker_meta.outputs.labels }}
13+
release:
14+
uses: ./.github/workflows/build-docker.yaml
15+
secrets: inherit
16+
with:
17+
publish: ${{ github.event_name != 'pull_request' }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "schedule/docker"
2+
3+
on:
4+
schedule:
5+
- cron: '45 6 * * 1'
6+
7+
jobs:
8+
schedule:
9+
uses: ./.github/workflows/build-docker.yaml
10+
secrets: inherit
11+
with:
12+
publish: true

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#############################################
22
# Build
33
#############################################
4-
FROM --platform=$BUILDPLATFORM golang:1.19-alpine as build
4+
FROM --platform=$BUILDPLATFORM golang:1.22-alpine as build
55

66
RUN apk upgrade --no-cache --force
77
RUN apk add --update build-base make git
@@ -28,9 +28,9 @@ COPY --from=build /go/src/github.com/webdevops/azure-devops-exporter/azure-devop
2828
RUN ["./azure-devops-exporter", "--help"]
2929

3030
#############################################
31-
# Final
31+
# Final-static
3232
#############################################
33-
FROM gcr.io/distroless/static
33+
FROM gcr.io/distroless/static as final-static
3434
ENV LOG_JSON=1
3535
WORKDIR /
3636
COPY --from=test /app .

go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
module github.com/webdevops/azure-devops-exporter
22

3-
go 1.21
4-
5-
toolchain go1.22.0
3+
go 1.22
64

75
require (
86
github.com/go-resty/resty/v2 v2.11.0

0 commit comments

Comments
 (0)