diff options
Diffstat (limited to 'cloudbuild.yaml')
-rw-r--r-- | cloudbuild.yaml | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 0000000..b9f2ad7 --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,61 @@ +timeout: 3600s # 60 minutes + +steps: +- name: golang + entrypoint: sh + args: + - -c + - | + set -eux + + export GOROOT=/usr/local/go + export KO_DOCKER_REPO="gcr.io/$PROJECT_ID" + export GOFLAGS="-ldflags=-X=github.com/google/go-containerregistry/cmd/crane/cmd.Version=$COMMIT_SHA" + + # Put contents of /workspace on GOPATH. + shadow=$$GOPATH/src/github.com/google/go-containerregistry + link_dir=$$(dirname "$$shadow") + mkdir -p $$link_dir + ln -s $$PWD $$shadow || stat $$shadow + + # Install ko from release. + 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=$${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=$(pwd)/.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 + args: ['digest', 'gcr.io/$PROJECT_ID/crane'] + +- name: gcr.io/$PROJECT_ID/crane + args: ['digest', 'gcr.io/$PROJECT_ID/gcrane'] + +- name: gcr.io/$PROJECT_ID/crane + args: ['digest', 'gcr.io/$PROJECT_ID/krane'] + |