From bd3e1731c00b66347ddf0ef5733e5f6b3b4a0f09 Mon Sep 17 00:00:00 2001 From: iximeow Date: Thu, 26 Sep 2024 23:54:18 +0000 Subject: [PATCH] quasi-lock dependencies in omicron-common job (#6692) "fixes" https://github.com/oxidecomputer/omicron/issues/6691 by stealing the checked-in Cargo.lock when building the standalone `omicron-common` crate created for this job. this lets us keep the specific refs of git dependencies that are `ref="main"` and similar, which might otherwise resolve to different commits than the rest of the tree (and its `omicron-common`) can actually build with. it'd be nice to have fewer git dependencies using branch names for refs, either by using a cratesio crate or specific commit or _something_, but this seems to make things a bit less brittle in the mean time. --- .github/buildomat/jobs/omicron-common.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/buildomat/jobs/omicron-common.sh b/.github/buildomat/jobs/omicron-common.sh index e9e2774cd2..0e248f9d3d 100755 --- a/.github/buildomat/jobs/omicron-common.sh +++ b/.github/buildomat/jobs/omicron-common.sh @@ -21,5 +21,16 @@ cd /tmp cargo new --lib test-project cd test-project cargo add omicron-common --path /work/oxidecomputer/omicron/common +# Bootstrap `test-project`'s dependencies from the checked-in Cargo.lock. +# This means that `test-project` builds with the same commits as the main repo +# for any dependencies referenced as `{ git = "...", ref = "" }`. If we +# do not prepopulate `Cargo.lock` like this, an update in a dependency might get +# picked up here and be incompatible with `omicron-common`, causing it to fail +# to build (see Omicron issue #6691). +# +# The extra dependencies in `omicron` will get pruned by Cargo when it +# recalculates dependencies, but any dependencies that match will stay at the +# commit/version/etc already indicated in the lockfile. +cp /work/oxidecomputer/omicron/Cargo.lock Cargo.lock cargo check cargo build --release