Skip to content

Commit

Permalink
Fix krane build (#1223)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor authored Dec 29, 2021
1 parent 3889fab commit 7adcade
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
timeout: 3600s # 60 minutes

steps:
- name: golang
entrypoint: sh
Expand All @@ -7,7 +9,6 @@ steps:
set -eux
export GOROOT=/usr/local/go
export GO111MODULE=off
export KO_DOCKER_REPO="gcr.io/$PROJECT_ID"
export GOFLAGS="-ldflags=-X=github.com/google/go-containerregistry/cmd/crane/cmd.Version=$COMMIT_SHA"
Expand All @@ -21,23 +22,32 @@ steps:
curl -L -o ko.tar.gz https://github.com/google/ko/releases/download/v0.8.2/ko_0.8.2_Linux_i386.tar.gz
tar xvfz ko.tar.gz
chmod +x ko
alias ko=./ko
alias ko=$${PWD}/ko
# Use the ko binary to build the crane-ish builder images.
ko publish --platform=all -B github.com/google/go-containerregistry/cmd/crane -t latest -t "$COMMIT_SHA" -t "$TAG_NAME"
ko publish --platform=all -B github.com/google/go-containerregistry/cmd/gcrane -t latest -t "$COMMIT_SHA" -t "$TAG_NAME"
# ./cmd/krane is a separate module, so switch directories.
cd ./cmd/krane
ko publish --platform=all -B github.com/google/go-containerregistry/cmd/krane -t latest -t "$COMMIT_SHA" -t "$TAG_NAME"
cd ../../
# Use the ko binary to build the crane-ish builder *debug* images.
export KO_CONFIG_PATH=./.ko/debug/
ko publish --platform=all -B github.com/google/go-containerregistry/cmd/crane -t "debug"
ko publish --platform=all -B github.com/google/go-containerregistry/cmd/gcrane -t "debug"
# ./cmd/krane is a separate module, so switch directories.
cd ./cmd/krane
ko publish --platform=all -B github.com/google/go-containerregistry/cmd/krane -t "debug"
cd ../../
# Tag-specific debug images are pushed to gcr.io/go-containerregistry/TOOL/debug:...
KO_DOCKER_REPO=gcr.io/$PROJECT_ID/crane/debug ko publish --platform=all --bare github.com/google/go-containerregistry/cmd/crane -t latest -t "$COMMIT_SHA" -t "$TAG_NAME"
KO_DOCKER_REPO=gcr.io/$PROJECT_ID/gcrane/debug ko publish --platform=all --bare github.com/google/go-containerregistry/cmd/gcrane -t latest -t "$COMMIT_SHA" -t "$TAG_NAME"
# ./cmd/krane is a separate module, so switch directories.
cd ./cmd/krane
KO_DOCKER_REPO=gcr.io/$PROJECT_ID/krane/debug ko publish --platform=all --bare github.com/google/go-containerregistry/cmd/krane -t latest -t "$COMMIT_SHA" -t "$TAG_NAME"
cd ../../
# Use the crane builder to get the digest for crane-ish.
- name: gcr.io/$PROJECT_ID/crane
Expand Down

0 comments on commit 7adcade

Please sign in to comment.