Skip to content

Commit

Permalink
Update scripts/ci/jobs/diff-dumps.sh
Browse files Browse the repository at this point in the history
Co-authored-by: J. Victor Martins <[email protected]>
  • Loading branch information
daynewlee and jvdm committed Feb 21, 2024
1 parent 335d5cc commit f9965e1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/ci/jobs/diff-dumps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ upload_offline_dump() {
latest_version=$(grep -oE '^[0-9]+\.[0-9]+' "$version_file" | sort -V | tail -n 1)

file_to_check="scanner-v4-defs-${latest_version}.zip"

curl --silent --show-error --max-time 60 --retry 3 -o $file_to_check https://storage.googleapis.com/scanner-v4-test/offline-bundles/$file_to_check

if [ -f "$file_to_check" ]; then
if curl --silent --show-error --max-time 60 --retry 3 -o $file_to_check https://storage.googleapis.com/scanner-v4-test/offline-bundles/$file_to_check; then
# If the file exists, add it to scanner-vuln-updates.zip
zip scanner-vuln-updates.zip "$file_to_check"
echo "$file_to_check added to scanner-vuln-updates.zip"
Expand All @@ -119,17 +117,19 @@ upload_v4_versioned_vuln() {
cmd+=(echo "Would do")
fi
cd /tmp/offline-dump
version_file="out/RELEASE_VERSION.txt"
versions=$(grep -oE '^[0-9]+\.[0-9]+' "$version_file" | sort -V | uniq)
while IFS= read -r version; do

cat out/RELEASE_VERSION.txt |
grep -oE '^[0-9]+\.[0-9]+' |
sort -V |
uniq |
while read -r version; do
echo "$version"
if curl --silent --show-error --max-time 60 --retry 3 -o "scanner-v4-defs-${version}.zip" "https://storage.googleapis.com/scanner-v4-test/offline-bundles/scanner-v4-defs-${version}.zip"; then
zip scanner-vulns-${version}.zip scanner-defs.zip k8s-istio.zip scanner-v4-defs-${version}.zip
"${cmd[@]}" gsutil cp scanner-vulns-${version}.zip gs://scanner-support-public/offline/v1/${version}/scanner-vulns-${version}.zip
else
echo "Failed to download scanner-v4-defs-${version}.zip, skipping..."
fi
done <<< "$versions"
}

diff_dumps() {
Expand Down

0 comments on commit f9965e1

Please sign in to comment.