-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflow to retag docker images with CalVer string #32
Changes from 1 commit
1fbd80e
e35c33d
5b276e7
014714b
f58fac1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,58 @@ | ||||
# Re-tag staging SHA-tagged image with git tag and 'latest' | ||||
# tags can be anything, but typically calver string (2022.12.02) | ||||
name: Retag | ||||
on: | ||||
push: | ||||
tags: | ||||
- '*' | ||||
|
||||
env: | ||||
GITHUB_SHA: ${{ github.sha }} | ||||
GITHUB_REF: ${{ github.ref }} | ||||
|
||||
permissions: # added using https://github.com/step-security/secure-workflows | ||||
contents: read | ||||
|
||||
jobs: | ||||
retag-using-calver: | ||||
runs-on: ubuntu-latest | ||||
steps: | ||||
- name: Checkout Repository | ||||
uses: actions/checkout@v3 | ||||
|
||||
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 | ||||
- name: Free up disk space | ||||
run: | | ||||
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc | ||||
df -h | ||||
|
||||
- name: Set Job Environment Variables | ||||
run: | | ||||
SHA12="${GITHUB_SHA::12}" | ||||
TAG="${GITHUB_REF##*/}" | ||||
echo "SHA12=${SHA12}" >> $GITHUB_ENV | ||||
echo "TAG=${TAG}" >> $GITHUB_ENV | ||||
|
||||
- name: Set up Docker Buildx | ||||
uses: docker/setup-buildx-action@v2 | ||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we actually need buildx here. Does the default GitHub Actions runner come with Edit: Yes, |
||||
- name: Login to Quay.io | ||||
uses: docker/login-action@v2 | ||||
with: | ||||
registry: quay.io | ||||
username: ${{ secrets.QUAY_USERNAME }} | ||||
password: ${{ secrets.QUAY_PASSWORD }} | ||||
|
||||
- name: Pull Image for Corresponding GitHub Commit | ||||
run: | | ||||
docker pull quay.io/cryointhecloud/cryo-hub-image:${SHA12} | ||||
|
||||
- name: Retag Images | ||||
run: | | ||||
docker tag cryointhecloud/cryo-hub-image:${SHA12} quay.io/cryointhecloud/cryo-hub-image:latest | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So we explicitly turn off the 'latest' tag here: hub-image/.github/workflows/build.yaml Line 43 in f254450
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair point. I've removed the retagging with 'latest' at f58fac1. |
||||
docker tag cryointhecloud/cryo-hub-image:${SHA12} quay.io/cryointhecloud/cryo-hub-image:${TAG} | ||||
|
||||
- name: Push Tags To Quay.io | ||||
run: | | ||||
docker push quay.io/cryointhecloud/cryo-hub-image:latest | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here about 'latest' |
||||
docker push quay.io/cryointhecloud/cryo-hub-image:${TAG} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be removed too, since the cryo-hub-image is only ~2GB in size. Not expecting it to become too big unless some machine learning libraries are added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I generally suggest keeping it, because when the disk does become full, it can throw weird errors. And the image size is calculated compressed, while it can definitely become bigger when on disk. And GitHub actions by default only has about 10-12GB of free space, so it can add up fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've added it back in 014714b. This step will take ~50 seconds to execute. GitHub Actions runners have 14GB of space according to https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @weiji14!