Skip to content

Commit 69469ea

Browse files
committed
Tag images with ci- prefix instead
1 parent 1e6af16 commit 69469ea

3 files changed

Lines changed: 33 additions & 7 deletions

File tree

.github/workflows/docker-tag.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Tag new images version
2+
on:
3+
schedule:
4+
# Quarterly schedule, roughly aligned with JDK CPU
5+
- cron: '0 0 30 1,4,7,10 *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
tag-images:
10+
name: Tag new images version
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
18+
- name: Login to ghcr.io
19+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # 3.7.0
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Tag images
25+
run: ./build --tag

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Image variants are available on a per JDK basis:
1111
- The `zulu8`, `zulu11`, `oracle8`, `ibm8`, `semeru8`, `semeru11`, `semeru17`, `graalvm17`, `graalvm21`, and `graalvm25` variants all contain the base JDKs in addition to the specific JDK from their name.
1212
- The `latest` variant contains the base JDKs and all of the specific JDKs above.
1313

14+
Images are tagged via the [Tag new images version](https://github.com/DataDog/dd-trace-java-docker-build/actions/workflows/docker-tag.yml) workflow. This workflow tags the latest images built from the specified branch with a `ci-` prefix. It runs quarterly on `master` but can also be triggered manually as needed.
15+
1416
## Development
1517

1618
To build all the Docker images:
@@ -31,7 +33,7 @@ Images are built per PR for ease in testing. These test images are prefixed with
3133

3234
To test these images in `dd-trace-java` CI:
3335

34-
1. Open a PR in [DataDog/dd-trace-java-docker-build](https://github.com/DataDog/dd-trace-java-docker-build) with the changes you want to test. It's important that this PR is opened on the latest tip of `master` to ensure that the test images are up-to-date. Let's say these changes are made in PR #123.
36+
1. Open a PR in [DataDog/dd-trace-java-docker-build](https://github.com/DataDog/dd-trace-java-docker-build) with the changes you want to test. Let's say these changes are made in PR #123 ([example](https://github.com/DataDog/dd-trace-java-docker-build/pull/123)).
3537
2. Run the [generate-test-image-yaml](https://github.com/DataDog/dd-trace-java-docker-build/tree/master/scripts/generate-test-image-yaml.sh) script to generate the YAML snippets that you will need in the following steps:
3638
```bash
3739
./scripts/generate-test-image-yaml.sh 123
@@ -42,7 +44,7 @@ Note that the test images have `renovate` enabled. This means that any changes t
4244
```bash
4345
docker pull registry.ddbuild.io/images/mirror/datadog/dd-trace-java-docker-build:123_merge-base
4446
```
45-
4. Open a PR in [DataDog/dd-trace-java](https://github.com/DataDog/dd-trace-java) that updates the `TESTER_IMAGE_VERSION_PREFIX` variable according to the output from step 2. Here, you can check your test images with `DataDog/dd-trace-java` CI.
47+
4. Open a PR in [DataDog/dd-trace-java](https://github.com/DataDog/dd-trace-java) that updates the `BUILDER_IMAGE_VERSION_PREFIX` variable according to the output from step 2. Here, you can check your test images with `DataDog/dd-trace-java` CI.
4648
5. For each following change made to your original PR #123, ensure the test image (i.e. prefixed with `123_merge-`) SHAs in `DataDog/images` are updated. This should be done via the bot mentioned in step 2 but can also be updated manually.
4749
6. When the test images look good and `DataDog/dd-trace-java` CI is green, merge your `DataDog/dd-trace-java-docker-build` PR #123, close the test `DataDog/dd-trace-java` PR, and **revert the `DataDog/images` PR**.
48-
7. Finally, confirm that the original image (i.e. no prefix) SHAs in `DataDog/images` are updated.
50+
7. Finally, run the [Tag new images version](https://github.com/DataDog/dd-trace-java-docker-build/actions/workflows/docker-tag.yml) workflow and confirm that the corresponding image (i.e. `ci-` prefix) SHAs in `DataDog/images` are updated.

build

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,20 +233,19 @@ function do_push() {
233233
}
234234

235235
function do_tag() {
236-
local tag token version
236+
local tag
237237
TAG_PREFIX=
238238
echo "Pulling latest images"
239239
for tag in base latest "${BASE_VARIANTS[@]}" "${VARIANTS[@]}"; do
240240
tag="${tag,,}"
241241
tag="$(image_name "${tag}")"
242242
docker pull "$tag"
243243
done
244-
version="$(date +%y.%m)"
245-
echo "Tagging version $version"
244+
echo "Tagging ci- images"
246245
for tag in base latest "${BASE_VARIANTS[@]}" "${VARIANTS[@]}"; do
247246
tag="${tag,,}"
248247
tag="$(image_name "${tag}")"
249-
new_tag="${tag/:/:v$version-}"
248+
new_tag="${tag/:/:ci-}"
250249
docker tag "$tag" "$new_tag"
251250
docker push "$new_tag"
252251
done

0 commit comments

Comments
 (0)