diff --git a/src/commands/store_compressed_artifacts.yml b/src/commands/store_compressed_artifacts.yml index b80fd0f..8edc54f 100644 --- a/src/commands/store_compressed_artifacts.yml +++ b/src/commands/store_compressed_artifacts.yml @@ -9,6 +9,10 @@ parameters: path: type: string description: Path to file or directory to store + destination: + type: string + description: Destination directory to store the tarball, defaults to the path but should be provided if the path is a file. + default: "" steps: - run: name: Compressing << parameters.tarball-name >> @@ -16,7 +20,18 @@ steps: TARBALL_NAME: << parameters.tarball-name >> ARTIFACT_PATH: << parameters.path >> command: << include(scripts/store_compressed_artifacts.sh) >> - - store_artifacts: - name: Store << parameters.tarball-name >> - path: /tmp/<< parameters.tarball-name >> - destination: "" + - when: + condition: << parameters.destination >> + steps: + - store_artifacts: + name: Store << parameters.tarball-name >> + path: << parameters.tarball-name >> + destination: << parameters.destination >> + - when: + condition: + not: << parameters.destination >> + steps: + - store_artifacts: + name: Store << parameters.tarball-name >> + path: << parameters.tarball-name >> + destination: << parameters.path >> diff --git a/src/scripts/get-job-artifacts.sh b/src/scripts/get-job-artifacts.sh index 4b88622..b269e6e 100755 --- a/src/scripts/get-job-artifacts.sh +++ b/src/scripts/get-job-artifacts.sh @@ -104,6 +104,7 @@ get_artifacts_for_job() { echo "Unzipping files:" cat "$tmp_zipped" xargs -n 1 tar -xzf < "$tmp_zipped" + xargs -n 1 rm < "$tmp_zipped" fi } @@ -114,7 +115,7 @@ else TARGET_PATH="$CIRCLE_WORKING_DIRECTORY" fi -echo "Downloading artifact(s) from job(s): $JOB_LIST" +echo "Downloading artifact(s) matching \`$TARGET_ARTIFACT_PATTERN\` from job(s): $JOB_LIST" echo "Downloading artifact(s) to $TARGET_PATH" get_jobs_in_workflow for JOB_NAME in ${JOB_LIST//,/ }