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

AUT-105: Add GitHub deployment workflow #330

Merged
merged 11 commits into from
Sep 19, 2024

Conversation

oskirby
Copy link
Contributor

@oskirby oskirby commented Sep 10, 2024

This PR attempts to add a workflow which can push container images to both Dockerhub and the Google Artifact Registry. This is a pretty straightforeward copy of the same workflow from the autograph repository, and uses the docker/build-push-action to do all of the heavy lifting for us.

In order to generate a version.json file, we add a script to generate it from the CI environment, and then add the necessary Makefile or go generate scaffolding to run it as appropriate. I also felt it was a good idea to remove the checked-in version.json from the repository to prevent it from being able to spread incorrect version information around.

To upload container images to Dockerhub, the following secrets and variables need to be provided:

  • vars.DOCKERHUB_REPO: The repository on Dockerhub to which the image should be pushed (eg: mozilla/autographedge).
  • vars.DOCKERHUB_USERNAME: The username of the account that will login to Dockerhub.
  • secrets.DOCKERHUB_PASSWORD: The password (or personal access token) used to authenticate with Dockerhub.

To upload container images to the Google Artifact regsitry, the following variables need to be provided:

  • vars.GAR_LOCATION: The Google Artifact Registry location. (eg: us)
  • vars.GCP_PROJECT_ID: The GCP Project identifier.
  • vars.GAR_REPOSITORY: The Google Artifact Registry repository to which the image should be pushed.
  • vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER: The identity provider to use in the google-github-actions/auth action.

I have not been able to test the Google Artifact Registry code in a fork, but the results of the Dockerhub push can be found at nkirby/autograph-edge

@oskirby oskirby force-pushed the aut-105-github-deployment-workflow branch from 79e7809 to aab5392 Compare September 10, 2024 03:58
@oskirby oskirby marked this pull request as ready for review September 10, 2024 04:03
@oskirby oskirby requested review from a team as code owners September 10, 2024 04:03
.circleci/config.yml Outdated Show resolved Hide resolved
@@ -46,9 +52,9 @@ FROM base
EXPOSE 8080

# Copy compiled appliation from the builder.
ADD . /app/src/autograph
RUN mkdir /app
Copy link

Choose a reason for hiding this comment

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

I don't think you need to mkdir before running the ADD on the next line

@oskirby oskirby force-pushed the aut-105-github-deployment-workflow branch from 5c55fdb to 9218548 Compare September 11, 2024 19:46
@oskirby oskirby force-pushed the aut-105-github-deployment-workflow branch from c248c54 to b9d7aeb Compare September 11, 2024 20:01
jmhodges
jmhodges previously approved these changes Sep 11, 2024
@jmhodges
Copy link
Contributor

I see this hasn't merged in. Is there a reason why?

@jmhodges
Copy link
Contributor

(FYI, to shortcut what could be the next question: all of the env vars and secrets are set correctly and had been set before this PR was posted)

This means that forks can still deploy to either GAR or Dockerhub
depending on which credentials that have been configured with, and
skips any that are missing.
@oskirby oskirby merged commit 13a1246 into main Sep 19, 2024
7 checks passed
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.

3 participants