Skip to content

Commit

Permalink
[#6300] fix(workflow): add an flag to control whether update docker l…
Browse files Browse the repository at this point in the history
…atest tag. (#6318)

### 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
  • Loading branch information
FANNG1 authored Jan 17, 2025
1 parent 2f0601c commit 5c9685c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ on:
description: 'Publish Docker token'
required: true
type: string
publish-latest-tag:
description: 'Whether to update the latest tag. This operation is only applicable to official releases and should not be used for Release Candidate (RC).'
required: false
type: boolean
default: false

jobs:
publish-docker-image:
Expand Down Expand Up @@ -83,6 +88,12 @@ jobs:
echo "image_type=iceberg-rest-server" >> $GITHUB_ENV
echo "image_name=apache/gravitino-iceberg-rest" >> $GITHUB_ENV
fi
if [ "${{ github.event.inputs.publish-latest-tag }}" == "true" ]; then
echo "publish_latest=true" >> $GITHUB_ENV
else
echo "publish_latest=false" >> $GITHUB_ENV
fi
- name: Check publish Docker token
run: |
Expand Down Expand Up @@ -115,8 +126,16 @@ jobs:
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/hostedtoolcache/CodeQL
if [[ "${image_type}" == "gravitino" || "${image_type}" == "iceberg-rest-server" ]]; then
./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag ${{ github.event.inputs.version }} --latest
if [[ -n "${tag_name}" ]]; then
full_tag_name="${tag_name}-${{ github.event.inputs.version }}"
else
full_tag_name="${{ github.event.inputs.version }}"
fi
if [[ "${publish_latest}" == "true" ]]; then
echo "Publish tag ${full_tag_name}, and update latest too."
./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag ${full_tag_name} --latest
else
./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag "${tag_name}-${{ github.event.inputs.version }}"
fi
echo "Publish tag ${full_tag_name}."
./dev/docker/build-docker.sh --platform all --type ${image_type} --image ${image_name} --tag ${full_tag_name}
fi
Binary file removed docs/assets/publish-docker-image.jpg
Binary file not shown.
Binary file added docs/assets/publish-docker-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions docs/publish-docker-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ You can use GitHub actions to publish Docker images to the Docker Hub repository
3. `apache/gravitino:0.1.0` if this is a gravitino server image.
4. `apache/gravitino-iceberg-rest:0.1.0` if this is an iceberg-rest server image.
6. You must enter the correct `docker user name`and `publish docker token` before you can execute run `Publish Docker Image` workflow.
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.
7. If you want to update the latest tag, select the box for `Whether to update the latest tag`.
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.

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

## More details of Apache Gravitino Docker images

Expand Down

0 comments on commit 5c9685c

Please sign in to comment.