Skip to content

Commit e2cf21d

Browse files
[#6300] fix(workflow): add an flag to control whether update docker latest tag. (#6322)
### What changes were proposed in this pull request? add an flag to control whether update docker latest tag. <img width="336" alt="image" src="https://github.com/user-attachments/assets/dc2b122a-b1bf-4e42-9f90-717ac6cd55ef" /> ### Why are the changes needed? Fix: #6300 ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? test in whether update latest tag Co-authored-by: FANNG <xiaojing@datastrato.com>
1 parent 01b2347 commit e2cf21d

File tree

4 files changed

+26
-6
lines changed

4 files changed

+26
-6
lines changed

.github/workflows/docker-image.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ on:
3232
description: 'Publish Docker token'
3333
required: true
3434
type: string
35+
publish-latest-tag:
36+
description: 'Whether to update the latest tag. This operation is only applicable to official releases and should not be used for Release Candidate (RC).'
37+
required: false
38+
type: boolean
39+
default: false
3540

3641
jobs:
3742
publish-docker-image:
@@ -83,6 +88,12 @@ jobs:
8388
echo "image_type=iceberg-rest-server" >> $GITHUB_ENV
8489
echo "image_name=apache/gravitino-iceberg-rest" >> $GITHUB_ENV
8590
fi
91+
92+
if [ "${{ github.event.inputs.publish-latest-tag }}" == "true" ]; then
93+
echo "publish_latest=true" >> $GITHUB_ENV
94+
else
95+
echo "publish_latest=false" >> $GITHUB_ENV
96+
fi
8697
8798
- name: Check publish Docker token
8899
run: |
@@ -115,8 +126,16 @@ jobs:
115126
sudo rm -rf /usr/local/lib/android
116127
sudo rm -rf /opt/hostedtoolcache/CodeQL
117128
118-
if [[ "${image_type}" == "gravitino" || "${image_type}" == "iceberg-rest-server" ]]; then
119-
./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag ${{ github.event.inputs.version }} --latest
129+
if [[ -n "${tag_name}" ]]; then
130+
full_tag_name="${tag_name}-${{ github.event.inputs.version }}"
131+
else
132+
full_tag_name="${{ github.event.inputs.version }}"
133+
fi
134+
135+
if [[ "${publish_latest}" == "true" ]]; then
136+
echo "Publish tag ${full_tag_name}, and update latest too."
137+
./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag ${full_tag_name} --latest
120138
else
121-
./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag "${tag_name}-${{ github.event.inputs.version }}"
122-
fi
139+
echo "Publish tag ${full_tag_name}."
140+
./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag ${full_tag_name}
141+
fi
-527 KB
Binary file not shown.
92.1 KB
Loading

docs/publish-docker-images.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ You can use GitHub actions to publish Docker images to the Docker Hub repository
3030
3. `apache/gravitino:0.1.0` if this is a gravitino server image.
3131
4. `apache/gravitino-iceberg-rest:0.1.0` if this is an iceberg-rest server image.
3232
6. You must enter the correct `docker user name`and `publish docker token` before you can execute run `Publish Docker Image` workflow.
33-
7. Wait for the workflow to complete. You can see a new Docker image shown in the [Apache Docker Hub](https://hub.docker.com/u/apache) repository.
33+
7. If you want to update the latest tag, select the box for `Whether to update the latest tag`.
34+
8. Wait for the workflow to complete. You can see a new Docker image shown in the [Apache Docker Hub](https://hub.docker.com/u/apache) repository.
3435

35-
![Publish Docker image](assets/publish-docker-image.jpg)
36+
![Publish Docker image](assets/publish-docker-image.png)
3637

3738
## More details of Apache Gravitino Docker images
3839

0 commit comments

Comments
 (0)