Skip to content

Commit

Permalink
Add sbf-tools version to cargo target cache name on CI agents
Browse files Browse the repository at this point in the history
  • Loading branch information
dmakarov authored and mergify[bot] committed Feb 9, 2022
1 parent 869cfc9 commit c7aa7fb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export PS4="++"
# Restore target/ from the previous CI build on this machine
#
eval "$(ci/channel-info.sh)"
export CARGO_TARGET_CACHE=$HOME/cargo-target-cache/"$CHANNEL"-"$BUILDKITE_LABEL"
eval "$(ci/sbf-tools-info.sh)"
export CARGO_TARGET_CACHE=$HOME/cargo-target-cache/"$CHANNEL"-"$BUILDKITE_LABEL"-"$SBF_TOOLS_VERSION"
(
set -x
MAX_CACHE_SIZE=18 # gigabytes
Expand Down
24 changes: 24 additions & 0 deletions ci/sbf-tools-info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# Finds the version of sbf-tools used by this source tree.
#
# stdout of this script may be eval-ed.
#

here="$(dirname "$0")"

SBF_TOOLS_VERSION=unknown

cargo_build_bpf_main="${here}/../sdk/cargo-build-bpf/src/main.rs"
if [[ -f "${cargo_build_bpf_main}" ]]; then
version=$(sed -e 's/^.*bpf_tools_version\s*=\s*"\(v[0-9.]\+\)".*/\1/;t;d' "${cargo_build_bpf_main}")
if [[ ${version} != '' ]]; then
SBF_TOOLS_VERSION="${version}"
else
echo '--- unable to parse SBF_TOOLS_VERSION'
fi
else
echo "--- '${cargo_build_bpf_main}' not present"
fi

echo SBF_TOOLS_VERSION="${SBF_TOOLS_VERSION}"
2 changes: 2 additions & 0 deletions sdk/cargo-build-bpf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,8 @@ fn main() {
}
}

// The following line is scanned by CI configuration script to
// separate cargo caches according to the version of sbf-tools.
let bpf_tools_version = "v1.23";
let version = format!("{}\nbpf-tools {}", crate_version!(), bpf_tools_version);
let matches = App::new(crate_name!())
Expand Down

0 comments on commit c7aa7fb

Please sign in to comment.