-
Notifications
You must be signed in to change notification settings - Fork 537
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
Fix Docker build and add concurrency limit #22273
Conversation
97abd6b
to
82f8039
Compare
42b11f3
to
97deb99
Compare
Confirmed run of build-image with push that shows we are pushing the right tag You can run this image locally DOCKER_DIGEST=sha256:72b39bc5098bb4108599f82b869edfd9971d29abe5a0d79b09cbccc1f310e101 make up Cool right? |
2370ea9
to
c018620
Compare
Interesting result that counters what I've written above. I reran the CI job which re "built" and pushed the image. I was expecting it to produce the same digest because literally nothing changed. I can verify that is true by container diffing the images. Build 1: https://github.com/mozilla/addons-server/actions/runs/9206736288/job/25325241509?pr=22273 kmeinhardt@kevins-mbp ~ % container-diff diff remote://mozilla/addons-server@sha256:1e0e0fd67bfec5e6ce4419961315fd13022c01337f5d0c10ebbe387dfd43c7e5 remote://mozilla/addons-server@sha256:01a25462865cfee0f91d2e542b83a3b631a1d52bd167ffe76911fd7d1b4b5a11 --type=history --type=file --type=pip --type=apt --type=node --json
ERRO[0001] error getting diff with HistoryAnalyzer: unsupported status code 404; body: 404 page not found
ERRO[0001] error getting diff with PipAnalyzer: unsupported status code 404; body: 404 page not found
[
{
"Image1": "mozilla/addons-server@sha256:1e0e0fd67bfec5e6ce4419961315fd13022c01337f5d0c10ebbe387dfd43c7e5",
"Image2": "mozilla/addons-server@sha256:01a25462865cfee0f91d2e542b83a3b631a1d52bd167ffe76911fd7d1b4b5a11",
"DiffType": "Apt",
"Diff": {
"Packages1": [],
"Packages2": [],
"InfoDiff": []
}
},
{
"Image1": "mozilla/addons-server@sha256:1e0e0fd67bfec5e6ce4419961315fd13022c01337f5d0c10ebbe387dfd43c7e5",
"Image2": "mozilla/addons-server@sha256:01a25462865cfee0f91d2e542b83a3b631a1d52bd167ffe76911fd7d1b4b5a11",
"DiffType": "File",
"Diff": {
"Adds": null,
"Dels": null,
"Mods": null
}
},
{
"Image1": "mozilla/addons-server@sha256:1e0e0fd67bfec5e6ce4419961315fd13022c01337f5d0c10ebbe387dfd43c7e5",
"Image2": "mozilla/addons-server@sha256:01a25462865cfee0f91d2e542b83a3b631a1d52bd167ffe76911fd7d1b4b5a11",
"DiffType": "Node",
"Diff": {
"Packages1": [],
"Packages2": [],
"InfoDiff": []
}
}
]% No file/pip/apt/node changes. It is failing on the "history" so maybe there is a slight change in the configuration object but I was under the impression the configuration object wouldn't change if the exact same commit on the repo is re-ran twice.. how could it. maybe there is some time based data in the docker context that I don't know about... This isn't really a deal breaker, it's just weird. |
@@ -27,7 +27,7 @@ x-env-mapping: &env | |||
services: | |||
worker: &worker | |||
<<: *env | |||
image: mozilla/addons-server${DOCKER_VERSION:-} | |||
image: ${DOCKER_TAG:-} |
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.
We'll need to warn everyone again that they have to use make up
/make update_docker
(or at least make setup
) when updating, otherwise things will be broken
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.
Yep. running make up will automatically fix and yes running raw docker commands will break.
- get correct Image ID from the build. - set docker tag correctly supporting tag and digest - add concurrency limit to github action ci jobs
Makefile-os
Outdated
@@ -7,7 +7,7 @@ | |||
DOCKER_BUILDER ?= container | |||
DOCKER_PROGRESS ?= auto | |||
DOCKER_PUSH ?= false | |||
DOCKER_OUTPUT ?= | |||
BUILDX_BAKE_METADATA_FILE ?= buildx-bake-metadata.json |
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.
Giving this file a more explanatory name and a default value. It is ignored so we can create it by default. This means you don't have to expcitly opt in or know the location of the file. Useful for CI jobs that want to read this data.
This comment was marked as outdated.
This comment was marked as outdated.
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.
Still unsure about whether or not the added complexity of supporting digests is worth it but we can try it out.
Co-authored-by: Mathieu Pillard <diox@users.noreply.github.com>
fixes: mozilla/addons#14802
Description
Fix the computed image tag in our docker compose file causing tags to be invalid and therrefore failing to push
Context
We added (here) support for running our container via a tag or a digest, but the logic had a bug that meant if you defined DOCKER_VERSION in the shell environment, it would override the formattted value produced by calling make setup.
Essentially, the value in the .env is updated but not in the shel environment.
Fun facts: There is a different between an image Id, and image digest and an image configuration digest.
Testing
There are several flows to test.
First and formost. remove your .env file and create a new one!
rm -f .env && make setup
Not doing this likely won't cause any problems but better consistent than sorry.
Run with digest
DOCKER_DIGEST=<value> make up
This should run the container exactly from the build.
Run with tag
DOCKER_VERSION=latest make up
Test concurrency.
If you have an open PR from this branch, with jobs in progress. Pushing a new commit should queue a new workflow run and cancel the previous one. There should only be one running at a time. This will save a huge amount of resources as the number of jobs per workflow increases.