Skip to content

Commit

Permalink
Auto update golang checksums and expected make tests (#1475)
Browse files Browse the repository at this point in the history
* update shasums when new golang version downloaded

* have golang-release-pr update expected make test files
  • Loading branch information
rcrozean authored Jul 30, 2024
1 parent 88e3931 commit 3956bec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions builder-base/scripts/download_golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ function build::go::download {
local filename="$outputDir/${arch}/go$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)
${SCRIPT_ROOT}/update_shasums.sh

#TODO: Add better way for checking checksums for older version.
go_major_version=$(if [[ $(echo "$version" | awk -F'.' '{print NF}') -ge 3 ]]; then echo ${version%.*}; else echo ${version%-*}; fi)
sha256sum -c $SCRIPT_ROOT/../checksums/go-go$go_major_version-${arch##*/}-checksum
fi
Expand Down
12 changes: 6 additions & 6 deletions builder-base/scripts/update_shasums.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ for TARGETARCH in arm64 amd64; do
echo "$sha256 helm-v${HELM_VERSION}-linux-$TARGETARCH.tar.gz" >$CHECKSUMS_ROOT/checksums/helm-$TARGETARCH-checksum

# GOLANG
#go_active_version=$(curl https://go.dev/dl/?mode=json | jq -r '.[].version' | sed -e "s/^$GO_PREFIX//" | sort)
#for v in $go_active_version; do
# go_major_version=$(if [[ $(echo "$v" | awk -F'.' '{print NF}') -ge 3 ]]; then echo ${v%.*}; else echo ${v%-*}; fi)
# sha256=$(curl -sSLf --retry 5 "https://go.dev/dl/?mode=json" | jq -r --arg tar "go$version.linux-${TARGETARCH/\//-}.tar.gz" '.[].files[] | if .filename == $tar then .sha256 else "" end' | xargs)
# echo "$sha256" >"$CHECKSUMS_ROOT/checksums/go-$go_major_version-$TARGETARCH-checksum"
#done
go_active_version=$(curl https://go.dev/dl/?mode=json | jq -r '.[].version' | sed -e "s/^$GO_PREFIX//" | sort)
for v in $go_active_version; do
go_major_version=$(if [[ $(echo "$v" | awk -F'.' '{print NF}') -ge 3 ]]; then echo ${v%.*}; else echo ${v%-*}; fi)
sha256=$(curl -sSLf --retry 5 "https://go.dev/dl/?mode=json" | jq -r --arg tar "$v.linux-${TARGETARCH/\//-}.tar.gz" '.[].files[] | if .filename == $tar then .sha256 else "" end' | xargs)
echo "$sha256 /home/prow/go/src/github.com/aws/eks-distro-build-tooling/builder-base/tmp/golang-downloads/linux/$TARGETARCH/${v}.linux-$TARGETARCH.tar.gz" >"$CHECKSUMS_ROOT/checksums/go-$go_major_version-$TARGETARCH-checksum"
done

# GOVC
echo "$(curl -sSL --retry 5 -v $GOVC_CHECKSUM_URL 2>&1 | grep $GOVC_FILENAME | cut -d ":" -f 2)" >$CHECKSUMS_ROOT/checksums/govc-$TARGETARCH-checksum
Expand Down
2 changes: 1 addition & 1 deletion eks-distro-base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ check-golang-release:

.PHONY: create-golang-release-pr
create-golang-release-pr: IMAGE_UPDATE_BRANCH="golang-image-release"
create-golang-release-pr: open-pr-check
create-golang-release-pr: update-make-tests-expected open-pr-check
create-golang-release-pr:
$(MAKE_ROOT)/../pr-scripts/create_pr.sh eks-distro-build-tooling 'EKS_DISTRO*_TAG_FILE*' $(IMAGE_UPDATE_BRANCH)

Expand Down
1 change: 1 addition & 0 deletions pr-scripts/create_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ if [[ $JOB_NAME =~ $GOLANG_RELEASE_PERIODIC ]]; then
git add ./eks-distro-base/golang_versions.yaml
git add ./builder-base/versions.yaml
git add ./builder-base/checksums/go*
git add ./make-tests/expected/*
fi

FILES_ADDED=$(git diff --staged --name-only)
Expand Down

0 comments on commit 3956bec

Please sign in to comment.