Skip to content
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 5 commits into from
Dec 5, 2022
Merged

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Dec 3, 2022

More human readable Calendar Version (CalVer) tags for docker images published on the docker registry!

Steps to trigger this workflow:

  1. Make a git tag manually, or on https://github.com/CryoInTheCloud/hub-image/tags. Note that this tag should ideally be in CalVer format (e.g. 2022.12.02)
  2. The tag will trigger this Continuous Integration workflow retag.yml which will:
  3. Pull down the build docker image from https://quay.io/repository/cryointhecloud/cryo-hub-image corresponding to the git commit that was tagged
  4. The docker image will be retagged to a name like 2022.12.02
  5. This retagged docker image is then pushed back up to the docker registry

GitHub Actions workflow adapted from https://github.com/pangeo-data/pangeo-docker-images/blob/2022.12.01/.github/workflows/Publish.yml

Motivated by #11 (comment) and #13 (comment).

More human readable Calendar Version (CalVer) tags for docker images published on the docker registry! When there is a new tag made on the git repo, this Continuous Integration workflow will pull down the built docker image, tag it with a string in YYYY.MM.DD format, and push things back to the docker registry. Modified from https://github.com/pangeo-data/pangeo-docker-images/blob/2022.12.01/.github/workflows/Publish.yml
@weiji14 weiji14 self-assigned this Dec 3, 2022
@github-actions
Copy link

github-actions bot commented Dec 3, 2022

Binder 👈 Test this PR on Binder

Copy link
Member Author

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two notes on things I copied from https://github.com/pangeo-data/pangeo-docker-images/blob/2e6d92f01e959ad2a5cc224e5090023dab81d828/.github/workflows/Publish.yml#L26-L43 that could probably be removed from this workflow, since the cryointhecloud docker image isn't as complex or big as pangeo-docker-images.

Comment on lines 36 to 38
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Copy link
Member Author

@weiji14 weiji14 Dec 3, 2022

Choose a reason for hiding this comment

The 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 docker installed?

Edit: Yes, docker seems to be installed on the Ubuntu GitHub Actions runner, according to https://github.com/actions/runner-images/blob/ac8ae6b0eeeec50305bf54ffdf588d5bbe9fc145/images/linux/Ubuntu2204-Readme.md#tools

Comment on lines +23 to +27
# 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
Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @weiji14!

@weiji14 weiji14 requested a review from yuvipanda December 3, 2022 04:17
The `cryo-hub-image` docker image is currently <2.0GB, so shouldn't be at the limits of GitHub Actions runner yet which is ~14GB.
We're not building any docker images, just pulling, retagging and pushing, so shouldn't need `docker-buildx`.
@weiji14 weiji14 marked this pull request as ready for review December 5, 2022 02:53

- name: Retag Images
run: |
docker tag cryointhecloud/cryo-hub-image:${SHA12} quay.io/cryointhecloud/cryo-hub-image:latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we explicitly turn off the 'latest' tag here:

LATEST_TAG_OFF: true
. In our experience, it's mostly caused problems - people use it because it's convenient, but then 'latest' can refer to different images at the same point in time, especially when being pulled across multiple nodes! I'd suggest not having a latest tag.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I've removed the retagging with 'latest' at f58fac1.


- name: Push Tags To Quay.io
run: |
docker push quay.io/cryointhecloud/cryo-hub-image:latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here about 'latest'

Copy link
Contributor

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to merge after removing the 'latest' tag

@weiji14
Copy link
Member Author

weiji14 commented Dec 5, 2022

Thanks Yuvi for the review! I'll merge this in now 🚀

@yuvipanda
Copy link
Contributor

ty, @weiji14!

@weiji14 weiji14 merged commit 4fbc6a4 into main Dec 5, 2022
@weiji14 weiji14 deleted the calver-tag branch December 5, 2022 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants