-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce script for downloading Scanner blobs
It's actually stolen from #1334 with small modifications.
- Loading branch information
Showing
3 changed files
with
33 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd)" | ||
|
||
if [[ "$#" < 1 ]]; then | ||
>&2 echo "Error: please pass blob filenames as command line arguments." | ||
>&2 echo "For example:" | ||
>&2 echo " $(basename "${BASH_SOURCE[0]}") nvd-definitions.zip k8s-definitions.zip repo2cpe.zip genesis_manifests.json" | ||
exit 1 | ||
fi | ||
|
||
blobs=( "$@" ) | ||
|
||
for blob in "${blobs[@]}"; do | ||
|
||
# TODO(ROX-22130): Assign proper suffix for tagged commits instead of /latest/. | ||
url="https://storage.googleapis.com/definitions.stackrox.io/scanner-data/latest/${blob}" | ||
dest="${REPO_ROOT}/blob-${blob}" | ||
|
||
echo "Downloading ${url} > ${dest}" | ||
curl --fail -s --show-error --retry 4 --retry-max-time 30 --retry-connrefused \ | ||
--output "${dest}" \ | ||
"${url}" | ||
|
||
done |