-
Notifications
You must be signed in to change notification settings - Fork 22
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
Simplify the current CI/CD workflow #10
Conversation
.github/workflows/cicd.yaml
Outdated
@@ -40,11 +54,9 @@ jobs: | |||
tags: | | |||
type=ref,event=branch | |||
type=ref,event=pr | |||
type=semver,pattern={{version}} | |||
type=semver,pattern={{major}}.{{minor}} | |||
type=semver,pattern=${{ steps.docker-image-version-check.SEMVER }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you articulate your reasons for preferring the manually updated semver
to a more automatically generated unique tag based on date/time or timestamp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shankari: Sure! I've also added a description to this PR that covers my rationale. My main goal in making these changes is to
- get past issues we're experiencing with the
build_pkg_*
-based workflow so that we can merge the other Task 1 PRs in this repo and update our images - while avoiding introducing the chicken-and-egg problem you had concerns over with our first pass CI/CD workflow (from our old private fork).
- The chicken-and-egg problem I'm referring to: Our Docker Compose files reference images defined by
Dockerfile
s in the same repository. If our CI/CD pipeline only builds and pushes updated Docker images (with new semver tags) after we have merged changes intomain
, we either have to then update our Docker Compose files in a separate PR (which is time consuming and more overhead for devs and reviewers) or accept that our Docker Compose files will temporarily reference Docker images that don't exist (until the CI/CD pipeline finishes building and pushing them).
- The chicken-and-egg problem I'm referring to: Our Docker Compose files reference images defined by
The advantage here is that we can set the tags for our Docker images manually to a new version as part of our PRs and have the updated images built before a PR is merged. When a PR is merged, the most recent image builds from the PR will be available either immediately or worst case (if another PR was using the same updated tag and clobbered this PR's builds in the Registry) within a few minutes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not intended to be an elegant solution long-term, but it gets us past our current build issues while also starting the process of moving these images into a more logical spot in the EVerest organization.
@drmrd I don't think this is needed for building most of the images. The whole point of running this as a CI/CD workflow is that we can use the GitHub token and publish images without needing to expand the permission list. When we tested this on US-JOET, the images were built even you didn't have access. Caveats:
|
I requested, and have received, have write access to this repo temporarily while the working groups, and their permissions, are sorted out. Given that permission, I don't think we need to have this work on US-JOET. We are "upstream first" and the image builds on US-JOET were just a stopgap to deal with the lack of permission here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving the workflow anyway to see what happens 😄
But I expect it to fail, given that we are trying to build us-joet
images through a workflow in the everest
org.
I'm not sure why squash-and-merge would make any difference. Concretely:
It seems like the real issue is with pushing images on the pull request. What we really want is:
|
That would be good news. Whether or not PRs from public forks can automatically trigger GitHub Action workflows is a function of the repository and its org. It sounds like EVerest hasn't restricted workflow execution?
👍 Having this happen as part of the working group permissions overhaul makes sense.
Agreed. Once this workflow is in a good state, I'll update the OCPP 1.6J demo documentation with information on the new publishing process as part of that PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I am not going to hold up approval for this, but can you comment on
#10 (comment)
before I merge 😄
Will do! Thanks @shankari! |
This is what I was referring to as a pre-release image. Using a rebase-and-merge strategy will result in a commit on the
I agree this is the ideal. In our older private fork, we briefly had a pipeline set up like this before changing gears. I'm happy to remove the pushes on PRs here, but note that even with caching there can be a brief post-merge period during which Docker Compose files will point to images that don't exist in GHCR. Is this still a concern? I'll plan to keep the push-on-PR portion of the workflow in tact for now but am happy to remove it later. |
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
b7a097c
to
f0f4548
Compare
See actions/runner#1533 Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
@hikinggrass for visibility
and that was good enough for us-joet |
I do note that you cannot grant write permissions to forked repos
|
@drmrd as a temporary workaround while waiting for the permission issues to be resolved, I suggest that we implement:
Note that secrets are available on push since it is approved code and not a pull request, which can potentially include malicious code. Yes, "there can be a brief post-merge period during which Docker Compose files will point to images that don't exist in GHCR" but this is a stop-gap anyway and we can revisit what it will look like after all the permissions are finalized and all the images are built in the separate repos. If we do end up keeping something like this for the long-term, there are workarounds we can consider (e.g. having two environment variables |
Thanks for digging into the permissions @shankari! I'll modify the workflow to not push during PRs. |
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
Signed-off-by: Daniel Moore <[email protected]>
@shankari: All changes are in. Please merge when you're available. 🚀 |
Filed #12 since the builds are not getting tagged properly |
Looking into this now |
Highlighted Changes
A common Docker image version is now declared in a config file
A
.env
file is now in the root directory of the repository. For each commit on main, this is intended to contain the semver of the first release containing the changes in that commit.v0.0.3
, the.env
will contain0.0.3
.v0.0.4
,.env
should contain0.0.4
.The pattern in these examples can continue after we move past
0.0.*
releases, but the hope is that we will consolidate these Docker images with others fromeverest-utils
and other EVerest repositories in a location that's separate from the Docker Compose files defining these demos. This would obviate the need for storing version information in the.env
file and further streamline the overall release process.The version specified in
.env
should also match the version of each image in our Docker Compose files going forward.Changes to our CI/CD workflow
The GitHub Actions
cicd.yaml
workflow has been updated to rely on the.env
file for version information. The intent here is to simplify our existing build processes, which were put in place to address a chicken-and-egg problem that occurs in the repository because (a) our Docker Compose files are stored in the same repository as our Dockerfiles and (b) we don't want the Docker Compose files used in our demos to require the user to go through long image build processes themselves.The new CI/CD workflow will do the following:
main,
or push of a server tag..env
matches the version of any existing release..env
assigned as a shared version tag.EVerest/everest-demo
GitHub Container Registry rather than the GHCR forUS-JOET/everest-demo
.Layers to each of the Docker images built by this workflow are also cached to reduce repeat work and workflow execution times.
A future improvement would include a smoke test for each of the demos, validating that each demo's Docker Compose stack can be stood up with newly updated Docker images.
Rationale
Advantages:
Images with manual build steps (such as the SteVe-related images in Generate unique label in sphinx EVerest#7) can still be created outside of this deployment process without major headaches.
Disadvantages:
.env
to include a branch-specific pre-release suffix like1.2.3-pre-branchname
.main
..env
file is one more place developers must remember to update Docker image tags when changes are being made.EVerest/everest-demo
, we may need @caller to provide @couryrr-afs and @drmrd write privileges for this repository (or provide add us as contributors to the EVerest org). (This is less of a problem and more of a nudge for us in a direction we're already headed.)Tasks
everest-demo
that simplifies our existing build processes.Dockerfile
s anddocker-compose.*.yml
files to point to images in the EVerest GHCR namespace..env
file and its usage in theREADME.md
. I'll be working on this early next week.[ ] Test the new workflow in US-JOET? I will work on this early next week. Given the lack of a functioning Docker image-building CI/CD pipeline for this repo, I propose merging changes here and addressing any issues in fast follow-up PRs to this repository if testing in US-JOET proves time-consuming.Unnecessary. See Simplify the current CI/CD workflow #10 (comment)