Skip to content

Commit 39d6439

Browse files
committed
Update pre-release workflow to include docker images
1 parent 8d7732f commit 39d6439

File tree

7 files changed

+84
-33
lines changed

7 files changed

+84
-33
lines changed

.bin/docker-build-ice

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ set -euo pipefail
33
cd "$(dirname "${BASH_SOURCE[0]}")/.."
44

55
test -n "$VERSION" || (echo "VERSION env variable must be set" >&2; exit 1)
6+
IMAGE_TAG="${IMAGE_TAG:-$VERSION}"
67

7-
./mvnw -pl ice validate # fail-fast
8+
if [[ "${SKIP_VERIFY:-}" != "1" ]]; then
9+
./mvnw -pl ice validate # fail-fast
10+
fi
811

912
image_name=altinity/ice
1013

@@ -14,8 +17,8 @@ for q in "" "debug-"; do
1417
if [[ "$q" == "" ]]; then
1518
base_image_prefix="latest-"
1619
fi
17-
docker build --platform linux/amd64 --build-arg "BASE_IMAGE_TAG=${base_image_prefix}amd64" --build-arg "VERSION=$VERSION" -t "$image_name:$q$VERSION-amd64" -f ice/Dockerfile .
18-
docker build --platform linux/arm64 --build-arg "BASE_IMAGE_TAG=${base_image_prefix}arm64" --build-arg "VERSION=$VERSION" -t "$image_name:$q$VERSION-arm64" -f ice/Dockerfile .
20+
docker build --platform linux/amd64 --build-arg "BASE_IMAGE_TAG=${base_image_prefix}amd64" --build-arg "VERSION=$VERSION" -t "$image_name:$q$IMAGE_TAG-amd64" -f ice/Dockerfile .
21+
docker build --platform linux/arm64 --build-arg "BASE_IMAGE_TAG=${base_image_prefix}arm64" --build-arg "VERSION=$VERSION" -t "$image_name:$q$IMAGE_TAG-arm64" -f ice/Dockerfile .
1922
done
2023

2124
push=false
@@ -31,14 +34,14 @@ if ! $push; then
3134
fi
3235

3336
for q in "" "debug-"; do
34-
docker push "$image_name:$q$VERSION-amd64"
35-
docker push "$image_name:$q$VERSION-arm64"
37+
docker push "$image_name:$q$IMAGE_TAG-amd64"
38+
docker push "$image_name:$q$IMAGE_TAG-arm64"
3639
# `docker manifest` requires metadata from the registry, hence the `docker push`es above
37-
docker manifest create "$image_name:$q$VERSION" \
38-
--amend "$image_name:$q$VERSION-amd64" \
39-
--amend "$image_name:$q$VERSION-arm64"
40-
docker manifest push "$image_name:$q$VERSION"
40+
docker manifest create "$image_name:$q$IMAGE_TAG" \
41+
--amend "$image_name:$q$IMAGE_TAG-amd64" \
42+
--amend "$image_name:$q$IMAGE_TAG-arm64"
43+
docker manifest push "$image_name:$q$IMAGE_TAG"
4144
done
4245

43-
regctl image copy "$image_name:$VERSION" "$image_name:latest"
44-
regctl image copy "$image_name:debug-$VERSION" "$image_name:debug"
46+
regctl image copy "$image_name:$IMAGE_TAG" "$image_name:latest"
47+
regctl image copy "$image_name:debug-$IMAGE_TAG" "$image_name:debug"

.bin/docker-build-ice-rest-catalog

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ set -euo pipefail
33
cd "$(dirname "${BASH_SOURCE[0]}")/.."
44

55
test -n "$VERSION" || (echo 'VERSION env variable must be set' >&2; exit 1)
6+
IMAGE_TAG="${IMAGE_TAG:-$VERSION}"
67

7-
./mvnw -pl ice-rest-catalog validate # fail-fast
8+
if [[ "${SKIP_VERIFY:-}" != "1" ]]; then
9+
./mvnw -pl ice-rest-catalog validate # fail-fast
10+
fi
811

912
image_name=altinity/ice-rest-catalog
1013

@@ -14,12 +17,12 @@ for q in "" "debug-"; do
1417
if [[ "$q" == "" ]]; then
1518
base_image_prefix="latest-"
1619
fi
17-
docker build --platform linux/amd64 --build-arg "BASE_IMAGE_TAG=${base_image_prefix}amd64" --build-arg "VERSION=$VERSION" -t "$image_name:$q$VERSION-amd64" -f ice-rest-catalog/Dockerfile .
18-
docker build --platform linux/arm64 --build-arg "BASE_IMAGE_TAG=${base_image_prefix}arm64" --build-arg "VERSION=$VERSION" -t "$image_name:$q$VERSION-arm64" -f ice-rest-catalog/Dockerfile .
20+
docker build --platform linux/amd64 --build-arg "BASE_IMAGE_TAG=${base_image_prefix}amd64" --build-arg "VERSION=$VERSION" -t "$image_name:$q$IMAGE_TAG-amd64" -f ice-rest-catalog/Dockerfile .
21+
docker build --platform linux/arm64 --build-arg "BASE_IMAGE_TAG=${base_image_prefix}arm64" --build-arg "VERSION=$VERSION" -t "$image_name:$q$IMAGE_TAG-arm64" -f ice-rest-catalog/Dockerfile .
1922
done
2023

21-
docker build --platform linux/amd64 --build-arg "BASE_IMAGE_TAG=debug-amd64" --build-arg "VERSION=$VERSION" --build-arg "ICE_IMAGE_TAG=$VERSION-amd64" -t "$image_name:debug-with-ice-$VERSION-amd64" -f ice-rest-catalog/Dockerfile.with-ice .
22-
docker build --platform linux/arm64 --build-arg "BASE_IMAGE_TAG=debug-arm64" --build-arg "VERSION=$VERSION" --build-arg "ICE_IMAGE_TAG=$VERSION-arm64" -t "$image_name:debug-with-ice-$VERSION-arm64" -f ice-rest-catalog/Dockerfile.with-ice .
24+
docker build --platform linux/amd64 --build-arg "BASE_IMAGE_TAG=debug-amd64" --build-arg "VERSION=$VERSION" --build-arg "ICE_IMAGE_TAG=$IMAGE_TAG-amd64" -t "$image_name:debug-with-ice-$IMAGE_TAG-amd64" -f ice-rest-catalog/Dockerfile.with-ice .
25+
docker build --platform linux/arm64 --build-arg "BASE_IMAGE_TAG=debug-arm64" --build-arg "VERSION=$VERSION" --build-arg "ICE_IMAGE_TAG=$IMAGE_TAG-arm64" -t "$image_name:debug-with-ice-$IMAGE_TAG-arm64" -f ice-rest-catalog/Dockerfile.with-ice .
2326

2427
push=false
2528
for arg in "$@"; do
@@ -34,15 +37,15 @@ if ! $push; then
3437
fi
3538

3639
for q in "" "debug-" "debug-with-ice-"; do
37-
docker push "$image_name:$q$VERSION-amd64"
38-
docker push "$image_name:$q$VERSION-arm64"
40+
docker push "$image_name:$q$IMAGE_TAG-amd64"
41+
docker push "$image_name:$q$IMAGE_TAG-arm64"
3942
# `docker manifest` requires metadata from the registry, hence the `docker push`es above
40-
docker manifest create "$image_name:$q$VERSION" \
41-
--amend "$image_name:$q$VERSION-amd64" \
42-
--amend "$image_name:$q$VERSION-arm64"
43-
docker manifest push "$image_name:$q$VERSION"
43+
docker manifest create "$image_name:$q$IMAGE_TAG" \
44+
--amend "$image_name:$q$IMAGE_TAG-amd64" \
45+
--amend "$image_name:$q$IMAGE_TAG-arm64"
46+
docker manifest push "$image_name:$q$IMAGE_TAG"
4447
done
4548

46-
regctl image copy "$image_name:$VERSION" "$image_name:latest"
47-
regctl image copy "$image_name:debug-$VERSION" "$image_name:debug"
48-
regctl image copy "$image_name:debug-with-ice-$VERSION" "$image_name:debug-with-ice"
49+
regctl image copy "$image_name:$IMAGE_TAG" "$image_name:latest"
50+
regctl image copy "$image_name:debug-$IMAGE_TAG" "$image_name:debug"
51+
regctl image copy "$image_name:debug-with-ice-$IMAGE_TAG" "$image_name:debug-with-ice"

.bin/pre-release-docker

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
cd "$(dirname "${BASH_SOURCE[0]}")/.."
4+
5+
export VERSION=0.0.0-latest-master+$(git rev-parse --short HEAD)
6+
export IMAGE_TAG="latest-master"
7+
export SKIP_VERIFY=1
8+
9+
export PATH="$(pwd)/.bin:$PATH"
10+
11+
echo >&2 'Pushing ice Docker image'
12+
docker-build-ice --push
13+
echo >&2 'Pushing ice-rest-catalog Docker image'
14+
docker-build-ice-rest-catalog --push
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
set -euo pipefail
33
cd "$(dirname "${BASH_SOURCE[0]}")/.."
44

5+
test -n "$GITHUB_TOKEN" || (echo 'GITHUB_TOKEN env variable must be set' >&2; exit 1)
6+
57
VERSION=0.0.0-latest-master+$(git rev-parse --short HEAD)
8+
VERSION_TAG="latest-master"
69

710
_undo_mvn_version_set() {
811
./mvnw versions:revert
@@ -13,8 +16,6 @@ trap _undo_mvn_version_set EXIT
1316
./mvnw clean package -Dmaven.test.skip=true
1417
_undo_mvn_version_set
1518

16-
VERSION_TAG="latest-master"
17-
1819
# TODO: go install github.com/aktau/github-release@v0.10.0
1920
github-release delete --user altinity --repo ice --tag "$VERSION_TAG" || true
2021
sleep 7

.bin/release

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -euo pipefail
33
cd "$(dirname "${BASH_SOURCE[0]}")/.."
44

55
test -n "$VERSION" || (echo 'VERSION env variable must be set' >&2; exit 1)
6+
test -n "$GITHUB_TOKEN" || (echo 'GITHUB_TOKEN env variable must be set' >&2; exit 1)
67

78
./mvnw clean verify
89

.github/workflows/pre-release.yaml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,51 @@
11
name: pre-release
22
on:
33
push:
4+
paths:
5+
- '**/pom.xml'
6+
- 'ice/src/main/**'
7+
- 'ice-rest-catalog/src/main/**'
48
branches:
59
- master
610
concurrency: pre-release
711
jobs:
8-
pre-release:
12+
github:
913
runs-on: ubuntu-24.04
1014
steps:
1115
- uses: actions/checkout@v4
12-
- name: Setup Go ${{ matrix.go-version }}
13-
uses: actions/setup-go@v5
16+
17+
- uses: actions/setup-go@v5
1418
with:
1519
go-version: 1.23
1620
- run: go install github.com/aktau/github-release@v0.10.0
21+
1722
- uses: actions/setup-java@v4
1823
with:
1924
java-version: '21'
2025
distribution: 'graalvm'
2126
cache: maven
22-
- run: .bin/pre-release
27+
28+
- run: .bin/pre-release-github
2329
env:
2430
GITHUB_TOKEN: ${{ github.token }}
31+
docker:
32+
runs-on: ubuntu-24.04
33+
steps:
34+
- uses: docker/login-action@v3
35+
with:
36+
username: ${{ secrets.DOCKERHUB_USERNAME }}
37+
password: ${{ secrets.DOCKERHUB_TOKEN }}
38+
39+
# https://github.com/docker/setup-buildx-action
40+
- name: Set up QEMU
41+
uses: docker/setup-qemu-action@v3
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
- name: Install regctl
45+
uses: regclient/actions/regctl-installer@main
46+
- name: regctl login
47+
uses: regclient/actions/regctl-login@main
48+
49+
- uses: actions/checkout@v4
50+
51+
- run: .bin/pre-release-docker

.github/workflows/release.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@ jobs:
2828
uses: regclient/actions/regctl-login@main
2929

3030
- uses: actions/checkout@v4
31-
- name: Setup Go ${{ matrix.go-version }}
32-
uses: actions/setup-go@v5
31+
32+
- uses: actions/setup-go@v5
3333
with:
3434
go-version: 1.23
3535
- run: go install github.com/aktau/github-release@v0.10.0
36+
3637
- uses: actions/setup-java@v4
3738
with:
3839
java-version: '21'
3940
distribution: 'graalvm'
4041
cache: maven
42+
4143
- run: .bin/release --push
4244
env:
4345
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)