Skip to content

Commit

Permalink
Fix/artifact compression (#41)
Browse files Browse the repository at this point in the history
* fix: store_compressed_artifacts should store tar in path by default, allow optionally specifying a destination

* fix: get-job-artifacts should remove unzipped tarballs

* chore: output artifact pattern in get-job-artifacts
  • Loading branch information
ankorstore-haddowg authored May 12, 2023
1 parent 85beb11 commit df6560f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
23 changes: 19 additions & 4 deletions src/commands/store_compressed_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,29 @@ 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 >>
environment:
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 >>
3 changes: 2 additions & 1 deletion src/scripts/get-job-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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//,/ }
Expand Down

0 comments on commit df6560f

Please sign in to comment.