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

Improve docker image autobuild workflow #245

Merged
merged 61 commits into from
Oct 13, 2021

Conversation

thenewguy
Copy link
Contributor

@thenewguy thenewguy commented Oct 11, 2021

Supersedes #242

Improves #239, #240

Adds the option to push image to Github container registry and/or docker hub

Uses the following secrets:

  • GHCR_IMAGE
  • GITHUB_TOKEN
  • DOCKERHUB_IMAGE
  • DOCKERHUB_TOKEN
  • DOCKERHUB_USERNAME

Simple sanity check runs most commands (see #244) expected to be available. A follow up commit can test they work as expected.

Currently, the docker image is built and tested for the master branch after the test workflow completes. It is built on every commit for PRs to provide continuous feedback during development.

The image is explicitly tagged with the branch/tag, sha, and timestamp. Not sure how you will want release tags to work, but the template is laid out. The workflow_run trigger is used to ensure we only push images that have completed the "Build and Test" job on the master branch with a successful conclusion per github.event.workflow_run.conclusion == 'success'. It would be simple to add :stable or something along those lines when pushing the image - this should be straightforward to adjust in a follow up commit.

Images are saved as artifacts with a unique name based on these details to shuffle between steps. This keeps development images from getting into the docker repo and lingering around. Currently, we rely on the artifact retention of 1 day to remove old artifacts after jobs complete. There is supposedly an API for removing them but it is unclear if this can work within the running workflow (refer to actions/upload-artifact#5)

@thenewguy
Copy link
Contributor Author

Let me know if I have missed something important - otherwise, I think this covers all the bases now

@thenewguy thenewguy marked this pull request as ready for review October 11, 2021 15:26
@thenewguy
Copy link
Contributor Author

Sorry - working on this to keep busy while waiting at hospital - running this against my branch to demonstrate working function

@thenewguy
Copy link
Contributor Author

Ok - demonstrated to work as expected

Build passes - https://github.com/thenewguy/ippsample/actions/runs/1329947866
Then docker runs - https://github.com/thenewguy/ippsample/actions/runs/1329953289

This pushed to a docker repo under my namespace since I merged it into my personal branch: https://hub.docker.com/repository/docker/thenewguy/ippsample/tags?page=1&ordering=last_updated

This is complete and ready to merge

@thenewguy
Copy link
Contributor Author

@michaelrsweet are you happy with this approach? I have a little bit of sitting around time available for the next day or so - want to make sure you like it before moving on to something else

@thenewguy
Copy link
Contributor Author

Just wanted to update I've been able to work this docker image into some initial testing! Awesome! Thanks for providing the Dockerfile to get all of this rolling

@michaelrsweet
Copy link
Contributor

@thenewguy This looks fine, still not sure what we'll be doing to officially support this but happy to merge it...

@michaelrsweet michaelrsweet merged commit b2bbdbf into istopwg:master Oct 13, 2021
@thenewguy
Copy link
Contributor Author

Ok - I will create an issue for the follow up action

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