Calculate Docker cache hash precisely from Dockerfile's dependencies#59253
Merged
bors merged 1 commit intorust-lang:masterfrom Mar 20, 2019
Merged
Calculate Docker cache hash precisely from Dockerfile's dependencies#59253bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
(rust_highfive has picked a reviewer for you, use r? to override) |
Member
Author
Member
|
Seems good to me. @bors r+ |
Collaborator
|
📌 Commit 3cb77ac751a12680f20c4a9c9a7400106ffbe60e has been approved by |
Member
|
No, wait, it behaves weirdly when tested locally, let me investigate. @bors r- |
emilyalbini
requested changes
Mar 17, 2019
Member
emilyalbini
left a comment
There was a problem hiding this comment.
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.
Member
Author
|
@bors r=pietroalbini |
This comment has been minimized.
This comment has been minimized.
Collaborator
|
📌 Commit 07aee1d has been approved by |
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Mar 19, 2019
…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.
bors
added a commit
that referenced
this pull request
Mar 20, 2019
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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
#58549 changed the Docker cache calculation to include every file under
src/ci/docker, so that when files underdist-x86_64-linuxis changed, its dependent imagedist-i686-linuxwill also be rebuilt.However, this ultraconservative solution caused the
dist-i686-linuxto 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.