Skip to content

Commit 53b21f5

Browse files
Merge branch 'main' into kubernetes-release
2 parents d006aae + 48fdcf8 commit 53b21f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3044
-1059
lines changed

.github/workflows/build-test.yaml

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,50 @@ jobs:
1919
steps:
2020
- name: Checkout code
2121
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
22+
2223
- name: Setup Golang
2324
uses: actions/setup-go@v5
2425
with:
2526
go-version-file: go.mod
27+
2628
- name: Run golangci-lint
27-
uses: golangci/golangci-lint-action@2226d7cb06a077cd73e56eedd38eecad18e5d837 # v6.5.0
29+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
2830
with:
29-
version: v1.54
30-
args: --timeout 10m --exclude SA5011 --verbose --issues-exit-code=0
31+
version: v2.1.0
32+
args: --timeout 10m --verbose --issues-exit-code=0
3133
only-new-issues: true
3234

35+
code-scan:
36+
name: Code Scan
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Run Trivy vulnerability scanner in repo mode
43+
uses: aquasecurity/[email protected]
44+
continue-on-error: true
45+
with:
46+
scan-type: "fs"
47+
ignore-unfixed: true
48+
exit-code: "1"
49+
format: "sarif"
50+
output: "trivy-results.sarif"
51+
severity: "CRITICAL,HIGH,MEDIUM"
52+
53+
- name: Upload Trivy scan results to GitHub Security tab
54+
uses: github/codeql-action/upload-sarif@v3
55+
with:
56+
sarif_file: "trivy-results.sarif"
57+
3358
govulncheck:
3459
runs-on: ubuntu-latest
3560
name: Run govulncheck
3661
steps:
62+
# We only need to checkout as govuln does the go setup...
63+
- name: Checkout code
64+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
65+
3766
- id: govulncheck
3867
uses: golang/govulncheck-action@v1
3968
with:
@@ -45,8 +74,9 @@ jobs:
4574
runs-on: ubuntu-latest
4675
steps:
4776
- name: Checkout code
48-
uses: actions/checkout@v4 # v3.5.3
49-
- name: Setup Go
77+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
78+
79+
- name: Setup Golang
5080
uses: actions/setup-go@v5
5181
with:
5282
go-version-file: go.mod
@@ -88,31 +118,43 @@ jobs:
88118
steps:
89119
- name: Checkout code
90120
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
121+
91122
- name: Set up QEMU
92123
uses: docker/setup-qemu-action@v3
93124

94125
- name: Set up Docker Buildx
95126
uses: docker/setup-buildx-action@v3
96127
with:
97128
platforms: ${{ matrix.platform }}
129+
driver: docker-container
130+
use: true
98131

99132
- name: Build Images
100133
uses: docker/build-push-action@v6
101134
with:
102135
context: .
103136
platforms: ${{ matrix.platform }}
104-
load: true
105137
push: false
106138
tags: quay.io/jetstack/version-checker:${{github.sha}}
107139
cache-from: type=gha
108140
cache-to: type=gha,mode=max
141+
# https://github.com/docker/buildx/issues/1714
142+
# Whilst trivy says it supports .tar etc, it wouldn't work in gha or locally on my machine.
143+
outputs: |-
144+
type=oci,tar=false,compression=uncompressed,dest=./.oci-image
145+
attests: |-
146+
type=sbom
147+
type=provenance,mode=max
109148
110149
- name: Run Trivy vulnerability scanner
111-
uses: aquasecurity/trivy-action@0.29.0
150+
uses: aquasecurity/trivy-action@0.31.0
112151
with:
113-
image-ref: "quay.io/jetstack/version-checker:${{github.sha}}"
152+
input: ./.oci-image
114153
format: "table"
115154
exit-code: "1"
116155
ignore-unfixed: true
117156
vuln-type: "os,library"
118157
severity: "CRITICAL,HIGH"
158+
159+
- name: "Cleanup OCI Image from FS"
160+
run: rm -rf ./.oci-image

.github/workflows/coverage-badge.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
go tool cover -func=coverage.out -o=coverage.out
3030
3131
- name: Go Coverage Badge # Pass the `coverage.out` output to this action
32-
uses: tj-actions/coverage-badge-go@v2
32+
uses: tj-actions/coverage-badge-go@v3
3333
with:
3434
filename: coverage.out
3535

.github/workflows/helm-docs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
workflow_call:
55
push:
66
paths:
7-
- '!*.md'
8-
- 'deploy/charts/version-checker/**'
7+
- "!*.md"
8+
- "deploy/charts/version-checker/**"
99
branches:
1010
- main
1111

.github/workflows/helm-test.yaml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Test Helm Chart
22
on:
33
pull_request:
44
paths:
5-
- '!*.md'
6-
- 'deploy/charts/version-checker/**'
5+
- "!*.md"
6+
- "deploy/charts/version-checker/**"
77
branches:
8-
- 'main'
8+
- "main"
99

1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
@@ -14,14 +14,19 @@ concurrency:
1414
jobs:
1515
lint:
1616
permissions:
17-
contents: read # for actions/checkout to fetch code
18-
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
17+
contents: read # for actions/checkout to fetch code
18+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
1919
name: Lint Helm Chart
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout code
2323
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2424

25+
- name: Setup Golang
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version-file: go.mod
29+
2530
- uses: azure/setup-helm@v4
2631

2732
- run: helm lint deploy/charts/version-checker
@@ -33,9 +38,12 @@ jobs:
3338
- name: Checkout code
3439
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3540

36-
- uses: azure/setup-helm@v4
41+
- name: Setup Golang
42+
uses: actions/setup-go@v5
3743
with:
38-
token: ${{ github.token }}
44+
go-version-file: go.mod
45+
46+
- uses: azure/setup-helm@v4
3947

4048
- name: Install helm Plugins
4149
run: |
@@ -57,7 +65,9 @@ jobs:
5765
steps:
5866
- name: Checkout code
5967
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
68+
6069
- name: Install Kyverno CLI
6170
uses: kyverno/[email protected]
62-
- uses: azure/setup-helm@v4
63-
- run: kyverno apply -p https://github.com/kyverno/policies/pod-security/restricted --git-branch main --resource <(helm template deploy/charts/version-checker/)
71+
72+
- run: |-
73+
kyverno apply -p https://github.com/kyverno/policies/pod-security/restricted --git-branch main --resource <(helm template deploy/charts/version-checker/)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Tag Release
2+
on:
3+
pull_request:
4+
types: [closed]
5+
6+
jobs:
7+
TagRelease:
8+
permissions:
9+
contents: write
10+
name: Create Release Tag
11+
runs-on: ubuntu-22.04
12+
if: github.event.pull_request.merged == true && startsWith( github.event.pull_request.head.ref, 'release-' )
13+
steps:
14+
- uses: bhowell2/[email protected]
15+
id: release_number
16+
with:
17+
value: ${{ github.event.pull_request.head.ref }}
18+
index_of_str: "release-"
19+
- name: Create Tag
20+
uses: tvdias/[email protected]
21+
with:
22+
repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
tag: ${{ steps.release_number.outputs.substring }}

0 commit comments

Comments
 (0)