Skip to content

Commit

Permalink
Add expected go to front of golang-debian image tag (#1496)
Browse files Browse the repository at this point in the history
* add expected go to front of image tag

* add go prefix when setting var

* move go prefix to variable initialization

* include go prefix in variable passed to script
  • Loading branch information
rcrozean authored Aug 7, 2024
1 parent b2635c9 commit 17866eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions projects/golang/go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ IMAGE?=$(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG),$(LATEST_IMAGE)
BUILDER_BASE_VERSIONS_YAML=$(BASE_DIRECTORY)/builder-base/versions.yaml
BUILDER_BASE_GO_VERSION=$(shell grep -E "^GOLANG_VERSION_$(subst .,,$(GO_SOURCE_VERSION))" $(BUILDER_BASE_VERSIONS_YAML))
GO_BIN_VERSION_WITH_RELEASE=$(subst GOLANG_VERSION_$(subst .,,$(GO_SOURCE_VERSION)): ,,$(BUILDER_BASE_GO_VERSION))
GO_BIN_VERSION_WITHOUT_RELEASE=$(shell [[ $(GO_BIN_VERSION_WITH_RELEASE) =~ [0-9]+.[0-9]+.[0-9]+ ]] && echo $${BASH_REMATCH[0]})
GO_BIN_VERSION_WITHOUT_RELEASE=go$(shell [[ $(GO_BIN_VERSION_WITH_RELEASE) =~ [0-9]+.[0-9]+.[0-9]+ ]] && echo $${BASH_REMATCH[0]})

PUSH_IMAGES?=true
BUILDKIT_OUTPUT=type=image,oci-mediatypes=true,\"name=$(IMAGE)\",push=$(PUSH_IMAGES)
Expand Down Expand Up @@ -172,7 +172,7 @@ images-upstream-bins:
build \
--frontend dockerfile.v0 \
--opt platform=$(GOOS)/$(ARCH_LOWER) \
--opt build-arg:GOLANG_ARCHIVE_PATH=$(GOOS)/$(ARCH_LOWER)/go$(GO_BIN_VERSION_WITHOUT_RELEASE).$(GOOS)-$(ARCH_LOWER).tar.gz \
--opt build-arg:GOLANG_ARCHIVE_PATH=$(GOOS)/$(ARCH_LOWER)/$(GO_BIN_VERSION_WITHOUT_RELEASE).$(GOOS)-$(ARCH_LOWER).tar.gz \
--local dockerfile=$(PROJECT_DIRECTORY)/docker/debianBase \
--local context=$(VERSION_DIRECTORY)/archives \
--progress plain \
Expand Down
6 changes: 3 additions & 3 deletions projects/golang/go/scripts/get_upstream_golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ function build::go::download {
local archs=${3}

for arch in ${archs/,/ }; do
local filename="$outputDir/${arch}/go$version.${arch/\//-}.tar.gz"
local filename="$outputDir/${arch}/$version.${arch/\//-}.tar.gz"
if [ ! -f $filename ]; then
curl -sSLf --retry 5 "https://go.dev/dl/go$version.${arch/\//-}.tar.gz" -o $filename --create-dirs
sha256sum=$(curl -sSLf --retry 5 "https://go.dev/dl/?mode=json" | jq -r --arg tar "go$version.${arch/\//-}.tar.gz" '.[].files[] | if .filename == $tar then .sha256 else "" end' | xargs)
curl -sSLf --retry 5 "https://go.dev/dl/$version.${arch/\//-}.tar.gz" -o $filename --create-dirs
sha256sum=$(curl -sSLf --retry 5 "https://go.dev/dl/?mode=json" | jq -r --arg tar "$version.${arch/\//-}.tar.gz" '.[].files[] | if .filename == $tar then .sha256 else "" end' | xargs)

if [[ $(sha256sum ${filename} | cut -d ' ' -f1) != "${sha256sum}" ]]; then
echo "CHECKSUMs don't match"
Expand Down

0 comments on commit 17866eb

Please sign in to comment.