From 8a3dbcfd0b6e441aa708f50f9b16e581424ccde4 Mon Sep 17 00:00:00 2001 From: Nils Andreas Svee Date: Sat, 21 Feb 2026 15:02:51 +0700 Subject: [PATCH] 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. --- Jenkinsfile | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7950261..4047aca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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 + } + } } } }