-
Notifications
You must be signed in to change notification settings - Fork 2k
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
makefiles/docker.inc.mk: Pin riotbuild version with BUILD_IN_DOCKER=1 #20472
Conversation
b250006
to
887828a
Compare
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.
LGTM in general, although a proper semver versioning as suggested by @kaspar030 would probably be the cleaner solution. Having a hardcoded hash in here requires us to remember updating it whenever breaking changes happen to RIOT sources.
In any case, I would add a sentence to the documentation explicitly stating this behavior for the default docker image.
The Docker container got updated with the last merge, so we would need to update the whitelist already: https://hub.docker.com/r/riot/riotbuild/tags. I'm wondering if it wouldn't be better to enforce a single specific Docker image at any point in time to avoid having an ever-growing whitelist that would somehow need to be checked for backwards compatibility? @maribu would you mind adding a sentence to the documentation so we can get this in before the next release? |
A suggestion on how to move this forward:
How does that sound to you @maribu ? If you don't find the time for this right now, I can also take over the PR if you want me to. |
I wonder if it is just better to set the docker image to Recalling the last few bumps of riotbuild there was only a single one (adding python-serial) would not have needed to update the docker image to remain bug-for-bug and overflow-for-overflow compatible with the CI. |
Sounds good to me, but I still think the proposed behavior changes of this PR (no automatic download on first use, warning on wrong riotbuild version) make sense. (I think it needs to be |
e791b5f
to
4890c23
Compare
4890c23
to
a52227a
Compare
I think the new behavior is even better: When the required docker image is locally available, it will never pull. But if not, it will pull automatically. That would allow bisecting with Note: In a train in Brandenburg without the docker image available, one could still run |
a52227a
to
e38f9d2
Compare
Thanks for picking this up again! I've just tried the current changeset locally, and it seems This makes the build fail with the not very user-friendly error message:
|
e38f9d2
to
fadf19b
Compare
That makes sense. The |
9939b27
to
fbafd6b
Compare
Yeah sorry, this also happens when using the right hash with 3 at the end. The point is just that docker tries to find the image locally, but when failing to do so, it will just report that it doesn't exist instead of pulling it (since it's missing the docker image location information). |
maybe you can make the Brandenburg case a little more accessible ( and have it produce a warning message) |
04dcf49
to
249e749
Compare
Apparently there are two different hashes involved: The local image ID which can be used to refer to the image, and the repo digest which is the one that is shown on Dockerhub. One can see both with |
cfae283
to
7354517
Compare
Indeed! I now have just added both digest to the Makefile and let the CI verify both are up to date. It is IMO pretty odd to have one ID to identify an image to run, and an unrelated ID to identify the same image for downloading. But anyway, seems to work now. |
it seems like digest needs to be to receive
dockery.sh is for dancing around that token thing that docker hub put in front of the OCI container API it is a stripped version of this
|
@kfessel Yes. This is already implemented in this PR. |
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.
LGTM then, thanks for your effort! 🤗
But let's hold this back until #20721 is merged.
We had a number of issues being reported that in the end were caused by building with a version of riotbuild incompatible with the source, because CI and source were updated in lock-step but users forgot to run `docker pull` to update theirs. In addition, checking out a random old release/commit will likely fail, as older source may contain bugs that did not trigger with older toolchains. To reliably succeed at building, a matching version of riotbuild needs to be used for `BUILD_IN_DOCKER=1`. This just pins the version of riotbuild manually, so it needs to be updated by hand in lock step with updating the docker container. In addition, the latest image is pulled automatically on mismatch. Ideally, this would pull the tagged image. But that fails for unknown reason when using the documented command for this with both docker and podman with: manifest for riot/riotbuild@sha256:f5951bc41dfface6cac869181d703e62cbdd3b7976b0946130a38f2e658000b3 not found: manifest unknown: manifest unknown Co-authored-by: mguetschow <mikolai.guetschow@tu-dresden.de>
This tests if the latest manifest on dockerhub matches the pinned version. The idea is that PRs are not merged until the pinning is fixed, so that we can ensure that `make BUILD_IN_DOCKER=1` will always succeed with the pinned version.
aa4e961
to
17dcb97
Compare
Thanks a bunch! 😄 🎉 |
Contribution description
We had a number of issues being reported that in the end were caused by building with a version of riotbuild incompatible with the source.
With this PR the docker container version is pinned in the RIOT repo code. Running with
BUILD_IN_DOCKER=1
will fetch that container, if not locally present.In addition an CI check was added that makes sure that after a new container was published, no PR other one that updates the pinning can get merged. This check contains a helpful message with exact instructions on how to update the pinning, to which value, and where.
Testing procedure
Compile an app with
BUILD_IN_DOCKER=1
. It should be have as follows:Issues/PRs references
Alternative to #20470
Depends on and includes: