chore(cicd): Setup build system to work with forks - #868
Open
gmpinder wants to merge 22 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows other developers to easily fork the CLI repo, build, and publish their own images to test their changes. Several types of changes were made to support this.
Earthfile
By refactoring the Earthfile to make use of
EARTH_GIT_PROJECT_NAMEbuilt-in arg, we can publish the build image to the user's own container registry. The labels are also updated to make use of this arg so that images are appropriately tied back to the forked repo. Somejustfilerecipes were also added to make calling them easier in the workflow files.GHA Workflows
The action workflows were also refactored to consolidate all the repeated jobs defined in each job in
test.yml. There were some inputs added to trigger installing certain tools for different test scenarios like docker, qemu, or earthbuild. There is a particular input that gets passed in to make dealing with forks easier calledfork_pr, the value of which is calculated from a higher workflow file. This flag is used to flip certain jobs on and off to disable pushing images since fork PR GitHub Action tokens do not appear to have the ability to authorize pushing to either the head repo's registry or the base repo's.Forks should always be able to build and publish images when not running the jobs in a PR against the main repo.
Integration Test Recipe files
The integration test recipes were originally setup to push to the
cli/{test_scenario}image repository. Not every dev will fork to a repo namedcli, so I added some logic in thejustfileto retrieve the repository name and set it toBB_TEST_IMAGE_NAME. This is then used in the recipes using the environment variable expansion feature (#749) to rename the image to match the dev's name for the forked repo.GitHub Driver
I found a logic error in the
github_driverthat was not properly detecting when a build was running in a PR. I made sure to update the logic so that theheadof the PR is used when obtaining information about the build to keep in line with the other logic setup above.Closes #802