Install goreleaser into go 1.18 image for build

This commit is contained in:
Katrina Verey
2022-04-04 23:43:47 -04:00
parent 4fc02497ae
commit fe604fd3d1
4 changed files with 26 additions and 22 deletions

View File

@@ -9,27 +9,41 @@
#
# To test it locally, run it in a goreleaser container:
#
# # Get goreleaser image from cloudbuild.yaml
# export GORELEASER_IMAGE=goreleaser/goreleaser:v0.179.0
# # Get build image from cloudbuild.yaml
# export GOLANG_IMAGE=golang:1.18
#
# # Drop into a shell
# docker run -it --entrypoint=/bin/bash -v $(pwd):/go/src/github.com/kubernetes-sigs/kustomize -w /go/src/github.com/kubernetes-sigs/kustomize $GORELEASER_IMAGE
# docker run -it --entrypoint=/bin/bash -v $(pwd):/go/src/github.com/kubernetes-sigs/kustomize -w /go/src/github.com/kubernetes-sigs/kustomize $GOLANG_IMAGE
#
# # Run this script in the container, where $TAG is the tag to "release" (e.g. kyaml/v0.13.4)
# ./releasing/cloudbuild.sh $TAG --snapshot
#
set -e
set -x
set -o errexit
set -o nounset
set -o pipefail
if [[ -z "${1-}" ]] ; then
echo "Usage: $0 <fullTag> [--snapshot]"
echo "Example: $0 kyaml/v0.13.4"
exit 1
fi
set -x
fullTag=$1
shift
if ! command -v jq &> /dev/null
then
# This assumes we are in an alpine container (which is the case for goreleaser images)
# This is expecting to be run from Cloud Build, in a Debian-based official golang container
echo "Installing jq."
apk add jq --no-cache
apt-get update && apt-get install -y jq
fi
if ! command -v goreleaser &> /dev/null
then
echo "Installing goreleaser."
make --file Makefile-tools.mk "$(go env GOPATH)/bin/goreleaser"
fi
./releasing/run-goreleaser.sh "$fullTag" release "$@"