ci: Archives target-specific binary

Ensures the pipeline archives the correct binary for each target architecture. Uses CARGO_BUILD_TARGET to locate and rename the binary before archiving.
This commit is contained in:
Nils Andreas Svee committed 2026-02-21 15:02:51 +07:00
1 parent 611998c5e9
commit 8a3dbcfd0b
1 file changed
+19 -5
Vendored
+19 -5
View File
@@ -64,13 +64,27 @@ pipeline {
stage('Archive artifact') {
steps {
sh '''
ls -l target
find -name sqm-autorate-rust
# 1. Construct the specific path for the current architecture
# CARGO_BUILD_TARGET is provided by the Docker image (e.g., aarch64-unknown-linux-musl)
BINARY_PATH="target/${CARGO_BUILD_TARGET}/release/sqm-autorate-rust"
# 2. Verify it exists
if [ -f "$BINARY_PATH" ]; then
echo "Found compiled binary at: $BINARY_PATH"
# 3. Rename with the matrix tag (e.g., sqm-autorate-rust-aarch64-musl)
# This ensures unique filenames in the shared workspace root
cp "$BINARY_PATH" "sqm-autorate-rust-${TARGET}"
else
echo "ERROR: Could not find binary at $BINARY_PATH"
# List target dir to help debug if it fails
ls -R target/
exit 1
fi
'''
/*dir("target/${TARGET}/release") {
sh "cp -v sqm-autorate-rust sqm-autorate-rust-${TARGET}"
// 4. Archive the specific file we just copied
archiveArtifacts artifacts: "sqm-autorate-rust-${TARGET}", fingerprint: true, onlyIfSuccessful: true
}*/
}
}
}