Skip to content

Commit e6378d0

Browse files
hdonnaycrozzy
authored andcommitted
cicd: add container version skew check
Signed-off-by: Hank Donnay <[email protected]>
1 parent 2ba3ecc commit e6378d0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ jobs:
4343
run: |
4444
npx widdershins --search false --language_tabs 'python:Python' 'go:Golang' 'javascript:Javascript' --summary ./openapi.yaml -o ./Documentation/reference/api.md
4545
git diff --exit-code
46+
- name: Check Container Versions
47+
if: ${{ !cancelled() && steps.checkout.conclusion == 'success' }}
48+
run: |
49+
# awk ...
50+
version=$(sed -n '/^go /{s/go \(1\.[0-9]\+\)\.[0-9]\+/\1/;p;q}' go.mod)
51+
{
52+
find . -name Dockerfile |
53+
xargs awk -v "want=$version" '/^ARG GO_VERSION/{split($2,ver,/=/);if(ver[2]!=want) printf "%s\t%d\n", FILENAME, FNR}'
54+
awk -v "want=$version" '/&go-image/{split($3,ref,/:/);if(ref[2]!=want) printf "%s\t%d\n", FILENAME, FNR}' docker-compose.yaml
55+
} |
56+
awk -v "want=$version" '{printf "::error file=%s,line=%d,title=Go Version Skew::Go version does not match `go.mod`: want %s\n", $1, $2, want}'
4657
- name: Setup Go
4758
id: 'setupgo'
4859
if: ${{ !cancelled() && steps.checkout.conclusion == 'success' }}

0 commit comments

Comments
 (0)