-
Notifications
You must be signed in to change notification settings - Fork 15
Reliable and automated base image build process #7270
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
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
90e8984
feat(base-images): build content-addressed images in GitLab
nccatoni d935f5a
ci: wait for GitLab-built weblog base images
nccatoni 5ce2f00
docs(base-images): document automated image publishing
nccatoni 3e66c2c
fix(php): install mbstring in php-fpm base images
nccatoni 6a9e4c9
chore(base-images): use content-addressed tags
nccatoni 578a92d
feat(base-images): resolve consumers through locked contexts
nccatoni 1a1bb3a
More reliable hashes
nccatoni 5d90e00
Lock file should not be drift checked
nccatoni 5ac604f
Update gitlab mirroring lock file
nccatoni b6c689f
Merge branch 'main' into nccatoni/base-image-build
nccatoni 708d11c
Updating base image lock file
nccatoni 5da13be
Merge branch 'main' into nccatoni/base-image-build
nccatoni dcf56a6
Merge branch 'main' into nccatoni/base-image-build
nccatoni 50c134f
Doc fix
nccatoni 028ce39
Merge branch 'main' into nccatoni/base-image-build
nccatoni d75ecd4
Update base image lockfile
nccatoni f1605e2
Update image mirroring targets
nccatoni 6d665cd
Steam build output to stdout, add build materialization dir to docker…
nccatoni 023d512
Remove build comments in base images
nccatoni f1ac7a4
Move base image scripts to utils/base_image and add dash-named wrappers
nccatoni 0642e14
Simplify base image update script UI
nccatoni 7d7d69a
Wait for base images unconditionally in GitHub when running in DataDo…
nccatoni de57e1d
Rename build-base-images.py
nccatoni e8195f7
Rename base-image.py
nccatoni b9cdcd6
Merge branch 'main' into nccatoni/base-image-build
nccatoni 556f60c
Lock script fix and lock update
nccatoni 5f24f1f
Update docs and comments to reference renamed base-image scripts
nccatoni 677aa8b
docs: document base image copy sources
nccatoni 79e9f4f
fix: fail fast while waiting for base images
nccatoni cdb8cde
chore: remove obsolete base image workflow flag
nccatoni 78bf968
chore: pluralize base image tooling
nccatoni ea52a29
Merge branch 'main' into nccatoni/base-image-build
nccatoni b6a3e19
format
nccatoni 2546794
Update locks
nccatoni 7668b2f
Solving import issues
nccatoni bf2ed4b
Fix weblogs without docker files
nccatoni 15ca33f
Update image mirror lock file
nccatoni 51d5a92
Merge branch 'main' into nccatoni/base-image-build
nccatoni 844a315
Merge branch 'main' into nccatoni/base-image-build
nccatoni 9244bd2
Replace print with logger
nccatoni b8855a6
Lock update
nccatoni a12b7ed
Merge branch 'main' into nccatoni/base-image-build
nccatoni 567321d
Merge branch 'main' into nccatoni/base-image-build
nccatoni 79765aa
Base image lock update
nccatoni a5dfcef
Image mirror update
nccatoni ee4b7b9
Fix mirror update
nccatoni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,32 @@ | ||
| Some of images used in system-tests are prebuild and used threw [hub.docker.com/datadog/system-tests](https://hub.docker.com/repository/docker/datadog/system-tests/). | ||
|
|
||
| If you need to update them, you will need to follow those | ||
|
|
||
| 1. update the version in the tag for the image you've just modified (there should be 3 or 4 occurences in the code) | ||
| 2. create your PR, and add the relevant label to rebuild the image in the CI | ||
| * `build-python-base-images` for python weblogs | ||
| * `build-php-base-images` for PHP weblogs | ||
| * `build-nodejs-base-images` for Node.js weblogs | ||
| * `build-proxy-image` for proxy image | ||
| 3. just before merging your PR, ping somebody from Reliability & Performance team to push your image to hub.docker.com (`#apm-shared-testing` on slack) | ||
| For weblog base images (nodejs, python, php), publishing and consumer selection use a | ||
| two-step lock-file workflow: | ||
|
|
||
| 1. GitLab CI's `build_base_images` job (`utils/base_images/build_base_images.py`) runs on every push, on every | ||
| branch. For each target in a library's `docker-bake.hcl`, it derives the target's dependencies from the | ||
| `COPY` instructions in its `<name>.base.Dockerfile` (see `docs/understand/weblogs/weblog-metadata.md` | ||
| for the Dockerfile rules this relies on), computes a content hash of those dependencies, and, if a base | ||
| image tagged with that hash doesn't already exist on Docker Hub, builds and pushes it as | ||
| `<base tag>-<hash>`. If `utils/build/docker/base-images.lock.json` is stale, the job fails | ||
| only after it has published all missing images. | ||
| 2. After that publish job finishes, regenerate the lock and mirror artifacts: | ||
|
|
||
| ```sh | ||
| python utils/scripts/update-base-images-lock.py | ||
| python utils/scripts/update_mirror_images.py | ||
| ``` | ||
|
|
||
| Commit `base-images.lock.json`, `mirror_images.yaml`, `mirror_images.lock.yaml`, and | ||
| `utils/build/docker/buildkitd.toml`. The lock maps stable aliases such as | ||
| `system_tests_base_nodejs_express4` to immutable content tags. Consumer Dockerfiles keep | ||
| the stable alias in `FROM`; they do not change when base content changes. | ||
| 3. GitHub Actions never builds these images itself. It resolves the consumer alias through | ||
| the committed lock and polls Docker Hub for that real image before building the weblog. | ||
|
|
||
| The supported consumer build entrypoint is `./build.sh`, which supplies each locked image as | ||
| a BuildKit named context. A raw `docker build` command does not resolve these aliases. | ||
|
|
||
| For other prebuilt images (e.g. the proxy image), add the `build-proxy-image` label to your PR to force a | ||
|
nccatoni marked this conversation as resolved.
|
||
| rebuild in GitHub CI; then, just before merging, ping somebody from Reliability & Performance team to push | ||
| your image to hub.docker.com (`#apm-shared-testing` on slack). | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.