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:
1 file changed
+25
-11
Vendored
+25
-11
@@ -62,17 +62,31 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Archive artifact') {
|
||||
steps {
|
||||
sh '''
|
||||
ls -l target
|
||||
find -name sqm-autorate-rust
|
||||
'''
|
||||
/*dir("target/${TARGET}/release") {
|
||||
sh "cp -v sqm-autorate-rust sqm-autorate-rust-${TARGET}"
|
||||
archiveArtifacts artifacts: "sqm-autorate-rust-${TARGET}", fingerprint: true, onlyIfSuccessful: true
|
||||
}*/
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh '''
|
||||
# 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
|
||||
'''
|
||||
|
||||
// 4. Archive the specific file we just copied
|
||||
archiveArtifacts artifacts: "sqm-autorate-rust-${TARGET}", fingerprint: true, onlyIfSuccessful: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user