forked from google/go-containerregistry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
45 lines (36 loc) · 1.95 KB
/
cloudbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
steps:
- name: golang
entrypoint: sh
args:
- -c
- |
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"
# 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=./ko
# Use the ko binary to build the crane and gcrane 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"
# Use the ko binary to build the crane and gcrane 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"
# Tag-specific debug images are pushed to gcr.io/go-containerregistry/{g}crane/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"
# Use the crane builder to get the digest for crane and gcrane.
- 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']