forked from google/go-containerregistry
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudbuild.yaml
61 lines (50 loc) · 2.68 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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']