From 3d20eb128a653b1e68dc01859acc75bc3f3ef4a5 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 1 Oct 2024 09:32:33 +0700 Subject: [PATCH 1/4] fix(rust): Add --keep-ts like the original cache fix had. Also, use a common builder. --- rust/Earthfile | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/rust/Earthfile b/rust/Earthfile index af84cf1404d..b81a226baa6 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -5,15 +5,15 @@ IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/rust-cache-update COPY_SRC: FUNCTION - COPY Cargo.toml clippy.toml deny.toml rustfmt.toml . - COPY --dir .cargo .config \ - c509-certificate \ - cardano-chain-follower \ - catalyst-voting \ - cbork \ - cbork-abnf-parser \ - cbork-cddl-parser \ - hermes-ipfs . + COPY --keep-ts --dir \ + Cargo.toml clippy.toml deny.toml rustfmt.toml \ + .cargo .config \ + c509-certificate \ + cardano-chain-follower \ + catalyst-voting \ + cbork cbork-abnf-parser cbork-cddl-parser \ + hermes-ipfs \ + . FINGERPRINT_SRC: FUNCTION @@ -36,6 +36,9 @@ sync-cfg: builder: DO rust-ci+SETUP +builder-src: + FROM +builder + # Cached copy of the source we build. DO +COPY_SRC @@ -45,13 +48,13 @@ builder: # check : Run basic check. check: - FROM +builder + FROM +builder-src DO rust-ci+EXECUTE --cmd="/scripts/std_checks.py" # build : Build crates. build: - FROM +builder + FROM +builder-src RUN --no-cache echo "Cache Disabled" @@ -74,9 +77,9 @@ build: # build-src-check: Check for any caching issues with the source we are building against. check-builder-src-cache: - DO rust-ci+SETUP + FROM +builder - COPY +builder/src_fingerprint.txt . + COPY +builder-src/src_fingerprint.txt . RUN --no-cache echo "Cache Disabled" From 09cc829e97f6c49b3fa1e0b447f9fca1c94e2112 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 1 Oct 2024 10:08:52 +0700 Subject: [PATCH 2/4] refactor(rust): Move FINGERPRINT_SRC to the common rust definitions in cat-ci --- rust/Earthfile | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/rust/Earthfile b/rust/Earthfile index b81a226baa6..4c330c23e38 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -15,18 +15,6 @@ COPY_SRC: hermes-ipfs \ . -FINGERPRINT_SRC: - FUNCTION - - ARG WHENCE=.. - ARG DIR=build - ARG FINGERPRINT=src_fingerprint.txt - - RUN cd $WHENCE; \ - tar -C ./ -cf - --sort=name --mtime='UTC 2019-01-01' --group=0 --owner=0 --numeric-owner $DIR \ - | sha256sum > $FINGERPRINT - RUN cat $WHENCE/$FINGERPRINT - # sync-cfg: Synchronize local config with CI version. # Must be run by the developer manually. sync-cfg: @@ -43,7 +31,7 @@ builder-src: DO +COPY_SRC # Generate Checksums of the source - DO +FINGERPRINT_SRC + DO rust-ci+FINGERPRINT_SRC SAVE ARTIFACT ../src_fingerprint.txt # check : Run basic check. @@ -87,7 +75,7 @@ check-builder-src-cache: DO +COPY_SRC # Generate Checksums of the source - DO +FINGERPRINT_SRC --FINGERPRINT=src_fingerprint_uncached.txt + DO rust-ci+FINGERPRINT_SRC --FINGERPRINT=src_fingerprint_uncached.txt RUN diff src_fingerprint.txt ../src_fingerprint_uncached.txt \ || (echo "ERROR: Source fingerprints do not match. Caching Error Detected!!" && exit 1) \ From f03a2c666078ea3eec44ac4f905c1a4a0a9506a3 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 1 Oct 2024 10:14:19 +0700 Subject: [PATCH 3/4] fix(rust): Remove deliberate cache break --- rust/Earthfile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/rust/Earthfile b/rust/Earthfile index 4c330c23e38..b33229a42d3 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -44,13 +44,6 @@ check: build: FROM +builder-src - RUN --no-cache echo "Cache Disabled" - - # RUN /scripts/std_build.py \ - # --libs=c509-certificate --libs=cardano-chain-follower --libs=hermes-ipfs \ - # --libs=cbork-cddl-parser --libs=cbork-abnf-parser \ - # --bins=cbork/cbork - DO rust-ci+EXECUTE \ --cmd="/scripts/std_build.py" \ --output="release/[^\./]+" \ From b73b943970aa199898b3314a3c85d038c1474d21 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 1 Oct 2024 10:23:07 +0700 Subject: [PATCH 4/4] ci(general): Bump to latest CI release with updated rust builders --- Earthfile | 4 ++-- docs/Earthfile | 2 +- rust/Earthfile | 2 +- rust/c509-certificate/Earthfile | 2 +- rust/cbork/Earthfile | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Earthfile b/Earthfile index 7a5a3c75dd0..8cdb62309da 100644 --- a/Earthfile +++ b/Earthfile @@ -1,7 +1,7 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.10 AS mdlint-ci -IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.10 AS cspell-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.11 AS mdlint-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.11 AS cspell-ci FROM debian:stable-slim diff --git a/docs/Earthfile b/docs/Earthfile index 4c76fb7c516..32c3cb59dfc 100644 --- a/docs/Earthfile +++ b/docs/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.10 AS docs-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.11 AS docs-ci IMPORT .. AS repo diff --git a/rust/Earthfile b/rust/Earthfile index b33229a42d3..49200d45bbe 100644 --- a/rust/Earthfile +++ b/rust/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:fix/rust-cache-updates AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.11 AS rust-ci COPY_SRC: FUNCTION diff --git a/rust/c509-certificate/Earthfile b/rust/c509-certificate/Earthfile index 035e6d42337..b1295317da7 100644 --- a/rust/c509-certificate/Earthfile +++ b/rust/c509-certificate/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.10 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.11 AS rust-ci IMPORT .. AS rust-local IMPORT ../.. AS repo diff --git a/rust/cbork/Earthfile b/rust/cbork/Earthfile index 4399e006883..f0a641f556b 100644 --- a/rust/cbork/Earthfile +++ b/rust/cbork/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.10 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust::v3.2.11 AS rust-ci IMPORT .. AS rust-local