-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add infrastructure for generating the golang-debian image using upstr…
…eam binaries (#1474) * update dockerfile and Makefile to use upstream binaries for golang-debian image builds * create a script for using builder base golang versions for tracking when pulling upstream binaries * add script flag for releasing new upstream binary golang-debian images * update prow_release_images to call new make targeting upstream binaries
- Loading branch information
Showing
4 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -x | ||
set -e | ||
set -o pipefail | ||
|
||
SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)" | ||
BASE_DIRECTORY="$(git rev-parse --show-toplevel)" | ||
GO_PREFIX="go" | ||
ARCHITECTURE="linux/amd64" # Currently only build golang-debian image for amd64, if other arches are needed add | ||
|
||
OUTPUT_DIR="$1" | ||
GO_BIN_VERSION="$2" | ||
|
||
source ${BASE_DIRECTORY}/builder-base/scripts/common_vars.sh | ||
|
||
# Download from upstream and validate CHECKSUMs | ||
function build::go::download { | ||
# Set up specific go version by using go get, additional versions apart from default can be installed by calling | ||
# the function again with the specific parameter. | ||
local version=${1} | ||
local outputDir=${2} | ||
local archs=${3} | ||
|
||
for arch in ${archs/,/ }; do | ||
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) | ||
|
||
if [[ $(sha256sum ${filename} | cut -d ' ' -f1) != "${sha256sum}" ]]; then | ||
echo "CHECKSUMs don't match" | ||
exit 1 | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
# strip the release version off the end of | ||
build::go::download "${GO_BIN_VERSION}" "$OUTPUT_DIR" "$ARCHITECTURE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters