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

chore: Use GitHub Actions to build Docker Images to allow publishing Windows Images #3291

Merged
merged 2 commits into from
Jul 9, 2020
Merged

Conversation

lippertmarkus
Copy link
Member

@lippertmarkus lippertmarkus commented Jun 24, 2020

As mentioned in #2747 Docker Hub Automated Build Hooks don't allow to build Windows images. As v2.9.0 comes with Windows support for argoexec and as you migrated CI to GitHub Actions also, it would make sense to use GitHub Actions also for building the Docker images.

I added a workflow file which builds and pushes the images for Linux (workflow-controller, argoexec, argocli) and Windows (argoexec only) whenever a new tag v* is pushed. I used the existing Docker Hub Hooks (https://github.com/argoproj/argo/blob/master/hooks/build) as a base for the scripts. The jobs building and pushing the images are appending -linux or -windows to the tag, a third job is creating a Manifest and pushes it to allow for multiarch. Example:

  1. Tag v2.9.0 is pushed
  2. Job build-linux is building and pushing argoproj/workflow-controller:v2.9.0-linux, argoproj/argoexec:v2.9.0-linux argoproj/argocli:v2.9.0-linux
  3. Job build-windows is building and pushing argoproj/argoexec:v2.9.0-windows
  4. Job push-images is creating and pushing the following image manifest:
    • argoproj/workflow-controller:v2.9.0 referencing argoproj/workflow-controller:v2.9.0-linux
    • argoproj/argoexec:v2.9.0 referencing argoproj/argoexec:v2.9.0-linux and argoproj/argoexec:v2.9.0-windows (multiarch)
    • argoproj/argocli:v2.9.0 referencing argoproj/argocli:v2.9.0-linux

You can find an example run for a tag vtest17 here: https://github.com/lippertmarkus/argo/runs/804344322
Resulting image, e.g. for argoexec: https://hub.docker.com/repository/docker/lippertmarkus/argoexec/tags

You only need to add the following two secrets like described in the GitHub Actions Help before merging:

  • DOCKERIO_USERNAME = argoproj
  • DOCKERIO_PASSWORD = <a-docker-hub-pat-token>

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
  • The title of the PR is (a) conventional, (b) states what changed, and (c) suffixes the related issues number. E.g. "fix(controller): Updates such and such. Fixes #1234".
  • I've signed the CLA.
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
    • not needed
  • My builds are green. Try syncing with master if they are not.

@alexec
Copy link
Contributor

alexec commented Jun 24, 2020

Let me get this right, would this save us building this locally? Just tag and push tag?

@lippertmarkus
Copy link
Member Author

Yes, correct.

@lippertmarkus
Copy link
Member Author

What do you think? Would also help to make the builds more reproducable.

@alexec
Copy link
Contributor

alexec commented Jun 25, 2020

We still need to build binaries. Any thoughts on how that might be possible? Maybe another PR?

@lippertmarkus
Copy link
Member Author

This would be possible with the following steps:

Afterwards you could add your release description manually or you also automate that.

Could look into that in another PR, but this PR would already help a lot with getting "official" Windows Images for argoexec :)

@lippertmarkus
Copy link
Member Author

any updates on this PR?

@alexec alexec self-assigned this Jul 3, 2020
Copy link
Contributor

@alexec alexec left a comment

Choose a reason for hiding this comment

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

I'm cautious on this one for security reasons.

We currently use the hub.docker.io to build images. This would replace that, but I don't really want to enter my username and password. How can we avoid this please?

@lippertmarkus
Copy link
Member Author

For pushing new images we would always need to store credentials. Those are stored securely by GitHub (symmetric encryption, see here). This is done this way by a lot of other projects on GitHub so there shouldn't be a problem.

And you don't use your normal Docker Hub password, you would instead create a new Access Token on Docker Hub and use this for authentication. This token can be revoked at anytime if needed.

@alexec
Copy link
Contributor

alexec commented Jul 8, 2020

I have now set-up the secrets for this.

@lippertmarkus
Copy link
Member Author

lippertmarkus commented Jul 9, 2020

Thanks! I added the master branch and tested again. You can view an example run here and resulting latest docker images e.g. for argoexec here.

@alexec alexec merged commit 6dc04b3 into argoproj:master Jul 9, 2020
@alexec
Copy link
Contributor

alexec commented Jul 9, 2020

Lets see if this works.

@alexec
Copy link
Contributor

alexec commented Jul 9, 2020

@lippertmarkus
Copy link
Member Author

hmm, push seems to be successful. What did you specify as Docker username?

@alexec
Copy link
Contributor

alexec commented Jul 9, 2020

my username: alexcollinsintuit

@alexec
Copy link
Contributor

alexec commented Jul 9, 2020

@alexec
Copy link
Contributor

alexec commented Jul 9, 2020

can you try them out to see if they work?

@lippertmarkus
Copy link
Member Author

lippertmarkus commented Jul 10, 2020

I tested the images, they work fine. Sorry, I overlooked that organizations on Docker Hub work a bit different, and we need to use a different repository than the Docker Hub username you log-in with. I created another PR to fix this: #3442.

alexec pushed a commit that referenced this pull request Jul 15, 2020
@agilgur5 agilgur5 added the area/build Build or GithubAction/CI issues label Mar 9, 2024
@agilgur5 agilgur5 added the area/windows Windows Container support label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build Build or GithubAction/CI issues area/windows Windows Container support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants