Skip to content

Commit

Permalink
Tag crane/gcrane images with Git tag (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh committed Apr 23, 2021
1 parent f37e4de commit 0976a27
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
20 changes: 13 additions & 7 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ steps:
args:
- -c
- |
set -ex
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 @@ -17,23 +18,28 @@ steps:
ln -s $$PWD $$shadow || stat $$shadow
# Install ko from release.
curl -L -o ko.tar.gz https://github.com/google/ko/releases/download/v0.6.0/ko_0.6.0_Linux_i386.tar.gz
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"
ko publish --platform=all -B github.com/google/go-containerregistry/cmd/gcrane -t latest -t "$COMMIT_SHA"
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=/workspace/.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
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']

4 changes: 3 additions & 1 deletion cmd/crane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ $ docker run --rm gcr.io/go-containerregistry/crane ls ubuntu
12.10
```

And it's also available with a shell, which uses the `debug` tag
And it's also available with a shell, at the `:debug` tag:

```sh
docker run --rm -it --entrypoint "/busybox/sh" gcr.io/go-containerregistry/crane:debug
```

Tagged debug images are available at `gcr.io/go-containerregistry/crane/debug:[tag]`.

### Using with GitLab

```yaml
Expand Down
4 changes: 3 additions & 1 deletion cmd/gcrane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ gcr.io/google-containers/busybox@sha256:d8d3bc2c183ed2f9f10e7258f84971202325ee60
gcr.io/google-containers/busybox:latest
```

And it's also available with a shell, which uses the `debug` tag
And it's also available with a shell, at the `:debug` tag:

```sh
docker run --rm -it --entrypoint "/busybox/sh" gcr.io/go-containerregistry/gcrane:debug
```

Tagged debug images are available at `gcr.io/go-containerregistry/gcrane/debug:[tag]`.

0 comments on commit 0976a27

Please sign in to comment.