flagsmith
flagsmith copied to clipboard
Minimise Docker builds in CI
The following Docker builds are unneccessary:
For E2E:
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/platform-pull-request.yml#L55-L56
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/platform-pull-request.yml#L84-L85
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/platform-pull-request.yml#L113-L114
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/platform-pull-request.yml#L142-L143
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/platform-pull-request.yml#L270-L271
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/platform-pull-request.yml#L293-L294
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/platform-pull-request.yml#L317-L318
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/platform-test-merge-to-main.yml#L32-L33
For Uffizzi:
- https://github.com/Flagsmith/flagsmith/blob/1e75ae9b573063684c5935fd01ac1945bc869a93/.github/workflows/uffizzi-build.yml#L40-L41
All of the above are building the same couple of images. We should build them once per CI run, push to ephemeral registry, and pass the reference around.
I think we should tie into this work, the addition of e.g. Docker Scout into our CI pipeline.
https://github.com/docker/scout-action
https://github.com/quay/clair-action looks good too
trivy is pretty good — found vulns both from claire's (Quay) and Docker Scout outputs
Still todo: create a dockerfile for our private-cloud image and build this once as part of CI, test against it, and then deploy to SaaS environments as necessary.
Related to private-cloud work:
- https://github.com/Flagsmith/flagsmith-saml/issues/43
- https://github.com/Flagsmith/flagsmith-auth-controller/issues/12
- https://github.com/Flagsmith/flagsmith-rbac/issues/20
More context for https://github.com/Flagsmith/flagsmith/issues/3718#issuecomment-2161033501:
Having merged the work related to E2E, and significantly reducing Depot costs, we still have workflows that duplicate each other, specifically the private cloud image build and both of the ECS deployments (staging, production). This makes our shipping process prone to human error and hard to comprehend. Additionally, we have a need to use private cloud build for testing in CI, which potentially worsens duplication even more (see #4140).
This can be alleviated by moving the private cloud image build to the Dockerfile, building it once per commit, and reusing the built image for deployments, testing, and shipping. This will eliminate duplication, significantly reduce cognitive load required to maintain the builds, and give us more flexibility to test the private images in various environments — for example, we'll be able to deploy to private cloud straight from the PR to quickly verify a fix, or recommend a customer to deploy latest main branch without having to perform a release.