Skip to content

Commit

Permalink
Port recent improvements done in the 'github-pr-resource' pipeline
Browse files Browse the repository at this point in the history
Among which, a Go required version is inferred as 1.x.0, and a Go toolchain
version hint of 1.x.y is updated with the actual Go version used for building
the code.
  • Loading branch information
bgandon committed May 11, 2024
1 parent e6c44f4 commit 0475871
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 13 additions & 8 deletions ci/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
type: registry-image
source:
repository: ${DOCKERHUB_REPOSITORY}
tag: "$(< version/number)"
tag: "$(< version/number)"
\`\`\`
EOF
params:
Expand Down Expand Up @@ -159,18 +159,22 @@ jobs:
| xargs -0 -I{} cp -a {} "repo-bumped"
cd "repo-bumped" || exit 115
awk '/^go /{print $2}' go.mod > ../golang-info/previous-version
awk '/^toolchain /{sub(/go/,"",$2); print $2}' go.mod \
> ../golang-info/previous-version
(
set -x
go_version=$(
go version \
| awk '{sub(/go/,"",$3); sub(/\.[[:digit:]]+$/,"",$3); print $3}'
)
sed -i -Ee "s/^go [[:digit:].]+\$/go ${go_version}/" go.mod
toolchain_version=$(go version | awk '{print $3}')
go_version=${toolchain_version#"go"}
inferred_go_min_version="${go_version%.*}.0"
sed -i -Ee "s/^go [[:digit:].]+\$/go ${inferred_go_min_version}/" go.mod
sed -i -Ee "s/^toolchain go[[:digit:].]+\$/toolchain ${toolchain_version}/" go.mod
go get -t -u ./...
go mod tidy
echo "${go_version}" > ../golang-info/version
echo "${toolchain_version}" > ../golang-info/toolchain-version
echo "${go_version}" > ../golang-info/version
echo "${inferred_go_min_version}" > ../golang-info/min-version
)
- task: build-docker-image
Expand All @@ -186,6 +190,7 @@ jobs:
caches: [ path: cache ]
run: { path: build }
params:
DEBUG: true
IMAGE_ARG_golang: golang-alpine/image.tar
IMAGE_ARG_alpine: alpine-latest/image.tar
output_mapping:
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module gstack.io/concourse/keyval-resource

go 1.22
go 1.22.0

toolchain go1.22.3

require (
github.com/google/uuid v1.6.0
Expand Down

0 comments on commit 0475871

Please sign in to comment.