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

Pushing docker images to GitHub Container Registry rather than DockerHub #291

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

asaphirabaruta
Copy link

No description provided.

- name: Push image
env:
DOCKERHUB_ACCOUNT: ${{ secrets.DOCKERHUB_ACCOUNT }}
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }}
GITHUB_ACCOUNT: ${{ secrets.GITHUB_ACCOUNT }}
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to somehow infer the github account name from the variables the this action is triggered with? I imagine the opencrvs is available somewhere when the repository the pipeline is in is opencrvs/opencrvs-countryconfig

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, it's possible to use the default environment variables and infer the github account rather than hard-coding it! Let me refactor!

DOCKERHUB_ACCOUNT: ${{ secrets.DOCKERHUB_ACCOUNT }}
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }}
GITHUB_ACCOUNT: ${{ secrets.GITHUB_ACCOUNT }}
GH_CONTAINER_REGISTRY_REPO: ${{ secrets.GH_CONTAINER_REGISTRY_REPO }}
Copy link
Member

Choose a reason for hiding this comment

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

Could this also default to something like the name of this current repo?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, sure!

password: ${{ secrets.DOCKER_TOKEN }}
registry: ghcr.io
username: ${{ env.GITHUB_ACCOUNT }}
password: ${{ secrets.GH_PAT}}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could replace this with GH_TOKEN too which is currently collected from the developer as part of the "setup environment" script 🤔

https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/infrastructure/environments/setup-environment.ts#L271-L282

Suggested change
password: ${{ secrets.GH_PAT}}
password: ${{ secrets.GH_TOKEN}}

@rikukissa
Copy link
Member

Looking good! Can't wait to try this out. As part of the server setup process, we ask countries to run a "setup environment" script that effectively creates all environment variables on Github. This happens before servers get provisioned. You can read about it from here.

I think this change needs to also change which variables we collect here:
https://github.com/opencrvs/opencrvs-countryconfig/blob/develop/infrastructure/environments/setup-environment.ts#L284-L326

There might be other places like this too. I suggest searching the country config codebase with DOCKER_ and seeing what references are found. I'm guessing we need to change them all 😬

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