-
Notifications
You must be signed in to change notification settings - Fork 429
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
ci(build): Reusable private cloud build #4165
Merged
Merged
Conversation
This file contains 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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Uffizzi Preview |
d09144c
to
bf48617
Compare
bf48617
to
7c36f69
Compare
7c36f69
to
83a1ec7
Compare
83a1ec7
to
1d8da76
Compare
1d8da76
to
6b3648d
Compare
4c15ffb
to
f8aad40
Compare
5 tasks
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.
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
Contributes to #3718.
This pull request improves our build toolchain to clarify our shipping targets and make building them more accessible. It integrates Private Cloud builds into our platform PR workflow, allowing us to run the E2E test suite against it. It streamlines our deployment workflows, allowing deploy jobs to benefit from Depot caching and cleanly segregates deployment configurations between GitHub environments. It sets up Trivy Docker image scan result uploads to the repo's Security tab, enabling us to address detected vulnerabilities ahead of releases. This PR is large, so I'll break down the changes below.
Single Dockerfile for all targets
I consolidated multiple Dockerfiles into a single Dockerfile containing all build stages. We ship multiple Docker targets:
Previously, Private Cloud and SaaS were awkwardly distributed between API and Unified Dockerfiles and corresponding GHA workflows. The private backend code was manually pulled by the workflow, and a special build argument controlled whether the dependencies for it should be installed. SaaS deployments required specifying private backend code versions for each environment. Changes to the private side required touching two Dockerfiles and 2-3 workflows and hoping the build worked since it was only reproducible in GHA.
Now, every target, including Private Cloud and SaaS, can be built using
docker build
, provided the required secrets are mounted. The final stages are minimal, assembled from building blocks factored out of our former Dockerfiles and GHA workflows. All stages are documented for easy navigation.The
CI_COMMIT_SHA
,.versions.json
, and edition markers are now explicitly requested by the Docker build instead of being added by GHA workflows. Permanent caching for the backend'sget_version_info
utility has been added.To demonstrate improved build sanity, I've added a Private cloud API target. The stage's code is just 5 lines. I've also created
private-cloud-api
private repositories in our GitHub Container registry and Docker Hub organization.The
docker build -t flagsmith:local .
command remains fully backward compatible due to theoss-unified
stage being the last one.Private cloud images built for PRs and on merge to
main
The "Platform Pull Requests" workflow now builds a Unified Private cloud image, enabling faster testing of enterprise features. E2E tests are now run against both Open Source and Private cloud API image versions. We can also deliver improvements and bug fixes to enterprise clients ahead of releases by offering a PR or a staging image.
ECS deployments with less fat
Deployment configuration data values have been moved to their respective GHA environments, allowing a reusable ECS deployment workflow for both staging and production. The workflow uses Depot and the new Dockerfile to leverage cached build stages. The change also results in less infrastructure-specific data in our workflow code.
Platform workflow publishes all Docker images
All Docker image building and publication have been consolidated in
.github/workflows/platform-docker-build-test-publish.yml
, triggered on merges tomain
and releases. Images are built for every merge and release, and published on release only if an E2E run is successful. After successful image publication, a PR toflagsmith-charts
is created. Individual Docker image publication workflows have been removed.CodeQL reports
CodeQL has been enabled for the repository. In addition to free code scanning, Docker image scan results are now available as part of CodeQL reports. Alerts/CI failures will occur on newly detected critical issues.
Bits and Pieces
install-private-modules
Makefile target for use outside of Docker builds, i.e., by the "Run API tests with private package" workflow..ubi
Dockerfiles as they are no longer needed.ghcr.io/flagsmith/flagsmith-e2e
.To do / to think on
docker build
on release trigger; re-tag the main branch images instead. To do that, ensure release jobs run after the latest main branch builds complete, e.g. using a concurrency group.How did you test this code?
Docker builds were tested locally with
docker build
.We need a plan for testing the ECS deployment workflow.