generated from 2i2c-org/hub-user-image-template
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1fbd80e
Workflow to retag docker images with CalVer string
weiji14 e35c33d
Remove free up disk space step
weiji14 5b276e7
Remove set up docker buildx step
weiji14 014714b
Revert "Remove free up disk space step"
weiji14 f58fac1
Don't retag with latest label
weiji14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# 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: 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:${TAG} | ||
|
||
- name: Push Tags To Quay.io | ||
run: docker push quay.io/cryointhecloud/cryo-hub-image:${TAG} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!