Skip to content

Commit a388fe5

Browse files
authored
fix(internal/postprocessor): use approved image tag (#10341)
Change the tag used for postprocessor image to approved prefix. Add one with `latest` suffix on approved prefix, and another using the commit sha that produced the image - this way when the next image is pushed with `latest` the dangling image(s) will still be tagged with the approved tag prefix. Update instructions accordingly. Note: the `docker inspect` and `sed` commands weren't working for me on gLinux, so I removed them and replaced them with the slightly simpler, but not automated, steps of copying it from the `pull` output. internal bug http://b/334181347
1 parent 52e7ade commit a388fe5

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

internal/postprocessor/README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ You can verify the name of the docker container name can be found in the
2121
In the `google-cloud-go` root directory:
2222

2323
```bash
24-
docker pull gcr.io/cloud-devrel-public-resources/owlbot-go:latest
25-
docker run --user $(id -u):$(id -g) --rm -v $(pwd):/repo -w /repo gcr.io/cloud-devrel-public-resources/owlbot-go:latest
24+
docker pull gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-latest
25+
docker run --user $(id -u):$(id -g) --rm -v $(pwd):/repo -w /repo gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-latest
2626
```
2727

2828
## Making changes, rebuilding the docker container and updating the OwlBot SHA
@@ -59,15 +59,14 @@ the OwlBot lock file.
5959

6060
After making changes to this package land in `main`, a new Docker image will be
6161
built and pushed automatically. To update the image version used by OwlBot, run
62-
the following commands (_you will need Docker installed and running_):
62+
the following command (_you will need Docker installed and running_):
6363

6464
```sh
65-
docker pull gcr.io/cloud-devrel-public-resources/owlbot-go:latest
66-
LATEST=`docker inspect --format='{{index .RepoDigests 0}}' gcr.io/cloud-devrel-public-resources/owlbot-go:latest`
67-
sed -i -e 's/sha256.*/'${LATEST#*@}'/g' ./.github/.OwlBot.lock.yaml
65+
docker pull gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-latest
6866
```
6967

70-
_Note: If run on macOS, the `sed -i` flag will need a `''` after it._
68+
Extract the `sha256` Digest from the logs emitted by the `pull` and set it as
69+
the digest in the [lockfile](../../.github/.OwlBot.lock.yaml).
7170

7271
Send a pull request with the updated `.github/.OwlBot.lock.yaml`.
7372

internal/postprocessor/cloudbuild.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,22 @@ steps:
2222
[
2323
"build",
2424
"-t",
25-
"gcr.io/cloud-devrel-public-resources/owlbot-go",
25+
"gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-$COMMIT_SHA",
2626
"-f",
2727
"Dockerfile",
2828
".",
2929
]
3030
dir: internal/postprocessor
31+
- name: gcr.io/cloud-builders/docker
32+
args:
33+
[
34+
"tag",
35+
"gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-$COMMIT_SHA",
36+
"gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-latest",
37+
]
3138
options:
3239
logging: CLOUD_LOGGING_ONLY
3340

3441
images:
35-
- gcr.io/cloud-devrel-public-resources/owlbot-go:latest
42+
- gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-$COMMIT_SHA
43+
- gcr.io/cloud-devrel-public-resources/owlbot-go:infrastructure-public-image-latest

0 commit comments

Comments
 (0)