-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Calculate Docker cache hash precisely from Dockerfile's dependencies #59253
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Seems good to me. @bors r+ |
📌 Commit 3cb77ac751a12680f20c4a9c9a7400106ffbe60e has been approved by |
No, wait, it behaves weirdly when tested locally, let me investigate. @bors r- |
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.
Other than the two (minor) comments you forgot to include the Dockerfile itself in the hash.
3cb77ac
to
d14f923
Compare
This comment has been minimized.
This comment has been minimized.
`src/ci/docker`, so that when files under `dist-x86_64-linux` is changed, its dependent image `dist-i686-linux` will also be rebuilt. However, this ultraconservative solution caused the `dist-i686-linux` to be rebuilt every time an irrelevant Dockerfile (e.g. the PowerPC ones) is changed, which increases the building time beyond 3 hours and forcing a spurious but expected failure. This commit instead parses the Dockerfile itself and look for the actual dependencies. The scripts needs to be copied into the Docker image, which must be done with the COPY command, so we just need to find all lines with a COPY command and add the source file into the hash calculator. Note: this script only handles single-lined COPY command in the form `COPY src1 src2 src3 dst`, since these are the only variant used inside this repository.
d14f923
to
07aee1d
Compare
This comment has been minimized.
This comment has been minimized.
@bors r=pietroalbini |
This comment has been minimized.
This comment has been minimized.
📌 Commit 07aee1d has been approved by |
…r=pietroalbini Calculate Docker cache hash precisely from Dockerfile's dependencies rust-lang#58549 changed the Docker cache calculation to include every file under `src/ci/docker`, so that when files under `dist-x86_64-linux` is changed, its dependent image `dist-i686-linux` will also be rebuilt. However, this ultraconservative solution caused the `dist-i686-linux` to be rebuilt every time an irrelevant Dockerfile (e.g. the PowerPC ones) is changed, which increases the building time beyond 3 hours and forcing a spurious but expected failure. This commit instead parses the Dockerfile itself and look for the actual dependencies. The scripts needs to be copied into the Docker image, which must be done with the COPY command, so we just need to find all lines with a COPY command and add the source file into the hash calculator. Note: this script only handles single-lined COPY command in the form `COPY src1 src2 src3 dst`, since these are the only variant used inside this repository.
Rollup of 5 pull requests (all of which changes `src/ci/docker`) Successful merges: - #58986 ([CI] Update binutils for powerpc64 and powerpc64le) - #59038 (Track embedded-book in the toolstate) - #59055 (CI: Set job names.) - #59253 (Calculate Docker cache hash precisely from Dockerfile's dependencies) - #59257 (Update CI configuration for building Redox libraries) Failed merges: r? @ghost
#58549 changed the Docker cache calculation to include every file under
src/ci/docker
, so that when files underdist-x86_64-linux
is changed, its dependent imagedist-i686-linux
will also be rebuilt.However, this ultraconservative solution caused the
dist-i686-linux
to be rebuilt every time an irrelevant Dockerfile (e.g. the PowerPC ones) is changed, which increases the building time beyond 3 hours and forcing a spurious but expected failure.This commit instead parses the Dockerfile itself and look for the actual dependencies. The scripts needs to be copied into the Docker image, which must be done with the COPY command, so we just need to find all lines with a COPY command and add the source file into the hash calculator.
Note: this script only handles single-lined COPY command in the form
COPY src1 src2 src3 dst
, since these are the only variant used inside this repository.