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

Migration to Github Actions and multiarch builds #114

Merged

Conversation

LucasRoesler
Copy link
Member

Description

  • Create makefile for locally building and testing
  • Create github workflows
  • Use buildx to create multiarch builds
  • Remove travisci

Motivation and Context

  • I have raised an issue to propose this change (required)

Relates to openfaas/faas#1585

How Has This Been Tested?

Testing in my fork

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

GIT_COMMIT=${{ github.sha }}
load: true
push: false
tags: ghcr.io/openfaas/certifier:latest
Copy link
Member

Choose a reason for hiding this comment

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

(certifier typo)

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@LucasRoesler LucasRoesler force-pushed the migrate-to-github-actions-and-buildx branch from 4374bad to bacda06 Compare November 26, 2020 09:00
@alexellis
Copy link
Member

Hi @LucasRoesler, this came up on my radar again. How does this PR now compare to the approach we took in the classic watchdog?

https://github.com/openfaas/classic-watchdog/tree/master/.github/workflows

-
name: Docker meta
id: meta
uses: crazy-max/ghaction-docker-meta@v1
Copy link
Member Author

Choose a reason for hiding this comment

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

@alexellis to answer you question about how this differ from classic watchdogt is only here in how the docker metatdata is generated versus https://github.com/openfaas/classic-watchdog/blob/f5f0832493e8165695673fa6855039e08ef524a6/.github/workflows/publish.yaml#L25-L27

Copy link
Member

Choose a reason for hiding this comment

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

Do you see any issue in replicating the approach from the classic watchdog here, so that they are the same and easier to maintain?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess, originally this was my recommendation on what we should be doing. But this PR was ignored and the current pattern adopted without considering this one. I will update it to match

Copy link
Member

Choose a reason for hiding this comment

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

Thanks that would be appreciated. There is a rebase needed too, for the Dockerfile.

Copy link
Member Author

Choose a reason for hiding this comment

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

@alexellis after making the changes i remember the main benefit of this action for creating the tag, this step understands your forked repo and creates the tag accordingly. The workflow for classic-watchdog does not handle forks correctly and can not push to the forked ghcr because the repository is fixed to openfaas

if you are ok with not having it work in forks, then i guess we can remove this, but if you want forked image builds to actually be publishable automatically, we would either need to add more complexity to the workflow or use this action

Copy link
Member Author

Choose a reason for hiding this comment

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

a note about using this action, it is completely templated, so the exact same snippet can be used in all repos, versus the currently hard coded repo name that needs to be updated to match the repo you copy it to

Copy link
Member

Choose a reason for hiding this comment

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

Templates make sense to me, that is something both should have IMHO.

My real concern is having two divergent builds for the two watchdogs, which should both be doing the same thing

build go binary and upload it
build docker image and upload it

Copy link
Member Author

Choose a reason for hiding this comment

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

they both do the same flow now, I rebased and updated to copy all of the workflows and makefile changes from classic-watchdog

but I think that crazy-max/ghaction-docker-meta@v1 is probably a more robust way to construct the docker tags and labels

**What**
- Create makefile for locally building and testing
- Create github workflows
- Use buildx to create multiarch builds
- Remove travisci

Signed-off-by: Lucas Roesler <[email protected]>
@LucasRoesler LucasRoesler force-pushed the migrate-to-github-actions-and-buildx branch from bacda06 to 6ede08a Compare February 12, 2021 09:49
**What**
- Replicate the build process from classic-watchdog. The makefile will
  now cross-compile the binary on the local host and the Dockerfile will
  simply copy the required binary instead of building it inside docker

Signed-off-by: Lucas Roesler <[email protected]>
@alexellis
Copy link
Member

To avoid any release tags being released which have no binaries attached due to failed builds, can you take a moment to test this with your own account and to confirm it worked as expected? The suggestion you made to template the owner makes sense.

If you need somewhere to copy/paste from see - https://github.com/alexellis/faasd-example/blob/master/.github/workflows/build.yml#L27

@LucasRoesler
Copy link
Member Author

To avoid any release tags being released which have no binaries attached due to failed builds, can you take a moment to test this with your own account and to confirm it worked as expected? The suggestion you made to template the owner makes sense.

If you need somewhere to copy/paste from see - https://github.com/alexellis/faasd-example/blob/master/.github/workflows/build.yml#L27

I don't know how to accurately test this in my own fork. Per the comment #114 (comment) I can't really test this in my own fork because the repos are hard coded to openfaas

@LucasRoesler
Copy link
Member Author

If I update with your copy and paste are you going to update classic-watchdog as well?

@alexellis
Copy link
Member

I am not sure what you mean by "with your copy/paste"?

The idea is to have two both watchdogs build and published in a consistent way. The classic watchdog could benefit from having a generated owner name, just like you suggested.

It would be worth having both the same, but I don't know whether that's something I am going to pick up or another contributor. Whoever does it, needs to test that the change works on their fork before it gets merged - it looks bad when we have tags with no binaries attached because a build can't pass.

@alexellis
Copy link
Member

For tracking - openfaas/classic-watchdog#3

@alexellis
Copy link
Member

Actions are enabled now, so if you can force a push, it should run.

build:
strategy:
matrix:
go-version: [ 1.13.x ]
Copy link
Member

Choose a reason for hiding this comment

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

Can we use 1.15 like the Dockerfile has?

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

**What**
- Calculate the repo owner from the repository owner, so that docker
  images can be pushed to forked GHCR

Signed-off-by: Lucas Roesler <[email protected]>
@LucasRoesler LucasRoesler force-pushed the migrate-to-github-actions-and-buildx branch from 0855904 to e059b42 Compare February 12, 2021 10:52
@LucasRoesler
Copy link
Member Author

**What**
- Fix copy-pasta error and use Go 1.15 for both the build and publish
  workflows

Signed-off-by: Lucas Roesler <[email protected]>
@LucasRoesler
Copy link
Member Author

I am not sure what you mean by "with your copy/paste"?

The idea is to have two both watchdogs build and published in a consistent way. The classic watchdog could benefit from having a generated owner name, just like you suggested.

It would be worth having both the same, but I don't know whether that's something I am going to pick up or another contributor. Whoever does it, needs to test that the change works on their fork before it gets merged - it looks bad when we have tags with no binaries attached because a build can't pass.

I mean that the classic-watchdog workflow will need to be updated to allow the repo owner to be dynamic or else these two projects will have divergent GHA workflows

@alexellis
Copy link
Member

FYI @techknowlogick has now updated the classic watchdog -> openfaas/classic-watchdog@681b861

Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

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

Approved

@alexellis alexellis merged commit a49fcb4 into openfaas:master Feb 12, 2021
@alexellis
Copy link
Member

Thanks for all the work you put into this @LucasRoesler - sorry that it took so long to get to it, and that we changed the approach a couple of times in the interim.

@alexellis
Copy link
Member

This is the tag created with the latest changes, please check it and see if it looks as expected:

https://github.com/openfaas/of-watchdog/releases/tag/0.8.3

I may need to make the matching Docker image public once it's available.

@LucasRoesler LucasRoesler deleted the migrate-to-github-actions-and-buildx branch February 13, 2021 09:22
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.

None yet

2 participants