diff --git a/src/commands/get-job-artifacts.yml b/src/commands/get-job-artifacts.yml index 5030ac7..7865493 100644 --- a/src/commands/get-job-artifacts.yml +++ b/src/commands/get-job-artifacts.yml @@ -17,6 +17,10 @@ parameters: path-pattern: description: A regex pattern for the artifact path(s) to be downloaded type: string + processes: + type: integer + default: 10 + description: Number of parallel downloads steps: - run: name: Downloading artifacts @@ -25,4 +29,5 @@ steps: TARGET_PATH: << parameters.save-to-directory >> PRESERVE_PATHS: << parameters.preserve-paths >> TARGET_ARTIFACT_PATTERN: << parameters.path-pattern >> + PROCESSES: << parameters.processes >> command: << include(scripts/get-job-artifacts.sh) >> diff --git a/src/scripts/get-job-artifacts.sh b/src/scripts/get-job-artifacts.sh index d1eeefa..60c8850 100755 --- a/src/scripts/get-job-artifacts.sh +++ b/src/scripts/get-job-artifacts.sh @@ -70,7 +70,8 @@ get_artifacts_for_job() { echo "No Artifacts found." return 0; fi - + local tmp_config + tmp_config=$(mktemp) while read -r ARTIFACT do # shellcheck disable=SC2086 @@ -87,8 +88,13 @@ get_artifacts_for_job() { fi echo "Downloading: $FILE_PATH" echo " => $OUTPUT_PATH" - curl -s -L --retry 3 --retry-all-errors --create-dirs -H "Circle-Token: $CIRCLE_TOKEN" -o "$OUTPUT_PATH" "$URL" + { + echo "url $URL" + echo "output \"$OUTPUT_PATH\"" + } >> "$tmp_config" done <<< "$REQUIRED_ARTIFACTS" + curl -K "$tmp_config" -s -L --retry 3 --retry-all-errors --create-dirs -H "Circle-Token: $CIRCLE_TOKEN" --parallel --parallel-immediate --parallel-max "$PROCESSES" + rm "$tmp_config" } if [ -n "$TARGET_PATH" ]; then