You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Re-design images building
## Note for review:
Since `atomic_pipeline.py` is largely a refactored version of
`pipeline.py`, it’s much clearer to review their side-by-side diff than
to wade through GitHub’s “all new lines” view.
Here's the diff:
https://gist.github.com/Julien-Ben/3698d532d17bafb380f2e4f05b5db153
You can also take a look at the related [TD
Section](https://docs.google.com/document/d/1eJ8iKsI0libbpcJakGjxcPfbrTn8lmcZDbQH1UqMR_g/edit?tab=t.thts6hu4qyrq)
# Changes
The PR refactors our Docker image build system. Most notably by
replacing `pipeline.py` along with other components, detailed below.
## Usage of standalone Dockerfiles
Added in a previous PR, they eliminate the need for templating, and make
it possible to **retire Sonar** once the Atomic Releases Epic is
completed.
## Building with docker buildx, multi-platform builds
In `build_images.py` we use docker buildx through a python API. It
eliminates the need for building images separately for each platform
(ARM/AMD), and then manually bundling them in a manifest.
## Handle build environments explicitly
We’ve introduced a framework that centralizes build configuration by
scenario (e.g local development, staging releases etc) so the pipeline
automatically picks sensible defaults (registry, target platforms,
signing flags, and more) based on where you’re running.
In `pipeline_main.py` (with support from `build_configuration.py` and
`build_context.py`) we treat each execution context (local dev, merge to
master, release etc...) as an explicit, top-level environment.
It infers defaults automatically but lets you override any value via CLI
flags, ensuring all build parameters live in one single source of truth
rather than scattered through pipeline scripts.
## CLI usage
```
usage: pipeline_main.py [-h] [--parallel] [--debug] [--sign] [--scenario {BuildScenario.RELEASE,BuildScenario.PATCH,BuildScenario.STAGING,BuildScenario.DEVELOPMENT}]
[--platform PLATFORM] [--version VERSION] [--registry REGISTRY] [--parallel-factor PARALLEL_FACTOR]
image
Build container images.
positional arguments:
image Image to build.
options:
-h, --help show this help message and exit
--parallel Build images in parallel.
--debug Enable debug logging.
--sign Sign images.
--scenario {BuildScenario.RELEASE,BuildScenario.PATCH,BuildScenario.STAGING,BuildScenario.DEVELOPMENT}
Override the build scenario instead of inferring from environment. Options: release, patch, master, development
--platform PLATFORM Target platforms for multi-arch builds (comma-separated). Example: linux/amd64,linux/arm64. Defaults to linux/amd64.
--version VERSION Override the version/tag instead of resolving from build scenario
--registry REGISTRY Override the base registry instead of resolving from build scenario
--parallel-factor PARALLEL_FACTOR
Number of builds to run in parallel, defaults to number of cores
```
# Proof of work
CI is building images with the new pipeline, and tests pass.
# Note
For the duration of the Atomic Releases epic, both pipelines will be in
the repository, until we are done with the staging and promotion
process. This new pipeline will only be used for Evergreen patches.
This PR also heavily depends on changes that are introduced by the agent
matrix removal, and the multi-platform support epic.
The existing Evergreen function, that uses `pipeline.py` has been
renamed `legacy_pipeline`, and is used for release and periodic builds
tasks.
A new one has been created, calling the new pipeline.
Once the Atomic Release Epic is complete, we'll be able to remove:
- Sonar
- Inventories
- Periodic builds
- `pipeline.py`
Follow up ticket to this PR:
https://jira.mongodb.org/browse/CLOUDP-335471
Copy file name to clipboardExpand all lines: docker/mongodb-kubernetes-upgrade-hook/Dockerfile
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@ WORKDIR /go/src
4
4
ADD . .
5
5
6
6
ARG TARGETARCH
7
-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -a -o /data/scripts/version-upgrade-hook ./mongodb-community-operator/cmd/versionhook/main.go
7
+
ARG TARGETOS
8
+
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o /data/scripts/version-upgrade-hook ./mongodb-community-operator/cmd/versionhook/main.go
0 commit comments