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

add github actions to build/push docker images #6679

Merged
merged 2 commits into from
Aug 1, 2021

Conversation

chris48s
Copy link
Member

Closes #6634

We made this switch on another repo I work on so I basically already had this knocking about.. these two actions are very slightly adapted from the solution we've used there.

In anticipation, I have set up DOCKERHUB_USERNAME and DOCKERHUB_TOKEN variables in https://github.com/badges/shields/settings/secrets/actions . I've used a token attached to my dockerhub account (which should have permission to push to shieldsio/shields on dockerhub). We could maybe look at setting up a special bot/machine account for this though if we wanted.

Interestingly the DockerHub builds for our repo seem to still be working even though they were theoretically turned off last week. I did have a look to see if Docker have announced a U-turn or extension but the latest word is that autobuilds for free plans should have been disabled on 18th June. We could just keep this PR "in the chamber" and wait to see if they actually break at some point before we make the switch. If we want to just go ahead with this, before we merge this we should probably disable the autobuilds on DockerHub so we don't have two builds trying to push to the same tags.

@chris48s chris48s added the operations Hosting, monitoring, and reliability for the production badge servers label Jun 27, 2021
@shields-ci
Copy link

shields-ci commented Jun 27, 2021

Messages
📖 ✨ Thanks for your contribution to Shields, @chris48s!

Generated by 🚫 dangerJS against a8cd70b

@@ -0,0 +1,30 @@
name: Build and Publish Snapshot Docker Image
on: create
Copy link
Member

Choose a reason for hiding this comment

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

I gather GitHub still haven't added a tag create filter to this like they have for release?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah there isn't a specific event for tag creation. create is fired when a new ref is created. A ref can either be a tag or a branch, so the way to run an action on tag create is

on: create
jobs:
  build:
    if: github.event.ref_type == 'tag' 

@calebcartwright
Copy link
Member

I'm inclined to go ahead and make the pivot vs. waiting to see. Maybe we could hold off till the July image publish though.

@chris48s
Copy link
Member Author

chris48s commented Jul 1, 2021

Maybe we could hold off till the July image publish though.

Published ok using native dockerhub build:
https://hub.docker.com/layers/shieldsio/shields/server-2021-07-01/images/sha256-967e517c4808936a69a7d80c683be345934d39918ce4e215e58b91fbaa4e8fba

@calebcartwright
Copy link
Member

Published ok using native dockerhub build:

Indeed. Think I'm just a bit paranoid about waiting and having the on-demand/latest builds failing without us realizing.

I don't feel strongly about it at all though so we can certainly park it for a while if you'd prefer

@chris48s
Copy link
Member Author

chris48s commented Jul 7, 2021

Going to just leave this one "in the chamber" while the DockerCloud builds continue to run.
TODO: If we need to resurrect it, we could also run just the docker build action (not the push/tag) as a CI check on pull requests.

@chris48s chris48s added the on-hold Deferred in favor of another approach, blocked on preceding efforts, stale, or abandoned label Jul 7, 2021
@chris48s chris48s removed the on-hold Deferred in favor of another approach, blocked on preceding efforts, stale, or abandoned label Aug 1, 2021
@chris48s
Copy link
Member Author

chris48s commented Aug 1, 2021

Looks like DockerHub disabled our builds about a week ago so I am going to merge this.
I'll move docker build as a CI check to an issue.

@chris48s chris48s merged commit fcd4029 into badges:master Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
operations Hosting, monitoring, and reliability for the production badge servers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build Docker images in CI
3 participants