Skip to content

Commit 2218fd6

Browse files
authored
Update PromCI (#398)
Update PromCI GitHub actions to latest pattern. * Remove invalid verify configs job. Signed-off-by: SuperQ <superq@gmail.com>
1 parent ab24c11 commit 2218fd6

2 files changed

Lines changed: 35 additions & 65 deletions

File tree

.github/dependabot.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
version: 2
22
updates:
3-
- package-ecosystem: gomod
4-
directory: /
3+
- package-ecosystem: "gomod"
4+
directory: "/"
55
schedule:
6-
interval: monthly
7-
open-pull-requests-limit: 10
8-
- package-ecosystem: github-actions
9-
directory: /
6+
interval: "monthly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
109
schedule:
11-
interval: monthly
12-
open-pull-requests-limit: 10
10+
interval: "monthly"
11+
# Exclude configs synced from upstream prometheus/prometheus.
12+
exclude-paths:
13+
- .github/workflows/container_description.yml
14+
- .github/workflows/golangci-lint.yml

.github/workflows/ci.yml

Lines changed: 25 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,69 @@
1+
---
12
name: CI
2-
33
on:
44
pull_request:
55
push:
6-
branches: [main, 'release-*']
6+
branches: [main, master, 'release-*']
77
tags: ['v*']
88

9+
permissions:
10+
contents: read
11+
912
jobs:
10-
build:
11-
name: Build for common architectures
13+
test_go:
14+
name: Go tests
1215
runs-on: ubuntu-latest
13-
if: |
14-
!(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
15-
&&
16-
!(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
17-
&&
18-
!(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
19-
strategy:
20-
matrix:
21-
thread: [ 0, 1, 2 ]
16+
container:
17+
# Whenever the Go version is updated here, .promu.yml
18+
# should also be updated.
19+
image: quay.io/prometheus/golang-builder:1.26-base
2220
steps:
2321
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24-
- uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1
25-
- uses: ./.github/promci/actions/build
26-
with:
27-
promu_opts: "-p linux/amd64 -p windows/amd64 -p darwin/amd64 -p linux/arm64 -p windows/arm64 -p darwin/arm64"
28-
parallelism: 3
29-
thread: ${{ matrix.thread }}
22+
- uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0
23+
- run: make GO_ONLY=1 SKIP_GOLANGCI_LINT=1
3024

31-
build_all:
32-
name: Build for all architectures
25+
build:
26+
name: Build
3327
runs-on: ubuntu-latest
34-
if: |
35-
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
36-
||
37-
(github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-'))
38-
||
39-
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
4028
strategy:
4129
matrix:
42-
thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
30+
thread: [ 0, 1, 2, 3]
4331
steps:
4432
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
45-
- uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1
46-
- uses: ./.github/promci/actions/build
33+
- uses: prometheus/promci/build@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0
4734
with:
48-
parallelism: 12
35+
parallelism: 4
4936
thread: ${{ matrix.thread }}
5037

51-
verify-example-configs:
52-
name: Verify
53-
runs-on: ubuntu-latest
54-
container:
55-
image: quay.io/prometheus/golang-builder:1.26-base
56-
steps:
57-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
58-
- run: make build
59-
- name: Verify example configs
60-
run: find ./examples -name "*.yml" -print0 | xargs -0 -I % ./yace verify-config -config.file %
61-
6238
publish_main:
6339
name: Publish main branch artifacts
6440
runs-on: ubuntu-latest
65-
needs: [build_all, verify-example-configs]
41+
needs: [test_go, build]
6642
if: |
67-
(github.repository == 'prometheus-community/fortigate_exporter')
68-
&&
6943
(github.event_name == 'push' && github.event.ref == 'refs/heads/main')
44+
||
45+
(github.event_name == 'push' && github.event.ref == 'refs/heads/master')
7046
steps:
7147
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
72-
- uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1
73-
- uses: ./.github/promci/actions/publish_main
48+
- uses: prometheus/promci/publish_main@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0
7449
with:
7550
docker_hub_organization: prometheuscommunity
76-
docker_hub_login: ${{ secrets.docker_hub_login }}
7751
docker_hub_password: ${{ secrets.docker_hub_password }}
7852
quay_io_organization: prometheuscommunity
79-
quay_io_login: ${{ secrets.quay_io_login }}
8053
quay_io_password: ${{ secrets.quay_io_password }}
8154

8255
publish_release:
83-
name: Publish release artifacts
56+
name: Publish release artefacts
8457
runs-on: ubuntu-latest
85-
needs: [build_all, verify-example-configs]
58+
needs: [test_go, build]
8659
if: |
87-
(github.repository == 'prometheus-community/fortigate_exporter')
88-
&&
8960
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
9061
steps:
9162
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
92-
- uses: prometheus/promci@42c3c84c865e5c1ab78543b929f7341eb2ef6123 # v0.6.1
93-
- uses: ./.github/promci/actions/publish_release
63+
- uses: prometheus/promci/publish_release@9c86752f3395e08c57719af549cc455d8e2c2514 # v0.7.0
9464
with:
9565
docker_hub_organization: prometheuscommunity
96-
docker_hub_login: ${{ secrets.docker_hub_login }}
9766
docker_hub_password: ${{ secrets.docker_hub_password }}
9867
quay_io_organization: prometheuscommunity
99-
quay_io_login: ${{ secrets.quay_io_login }}
10068
quay_io_password: ${{ secrets.quay_io_password }}
10169
github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }}

0 commit comments

Comments
 (0)