@@ -17,17 +17,18 @@ set -o nounset
1717set -o errexit
1818set -o pipefail
1919
20- # install python-pip3
20+ # install python-pip3
2121apt-get update
2222apt-get install -y python3-pip
2323
24- # install requests module
24+ # install requests module
2525pip3 install requests
2626
27- # python script to generate official-cve-feed.json
27+ # python script to generate official-cve-feed.json
28+ # tee duplicates the output from the script to stdout for logs and the JSON file
2829python3 fetch-official-cve-feed.py | tee official_cve_feed.json
2930
30- # function to calculate the hash value of official-cve-feed.json
31+ # function to calculate the hash value of official-cve-feed.json
3132calculate_hash (){
3233 if command -v shasum > /dev/null 2>&1 ; then
3334 cat " $@ " | shasum -a 256 | cut -d' ' -f1
@@ -39,12 +40,13 @@ calculate_hash(){
3940 fi
4041}
4142
42- # check if official-cve-feed.json blob exists in the bucket
43+ # check if official-cve-feed.json blob exists in the bucket
4344set -e
4445EXIT_CODE=0
4546gsutil ls gs://k8s-cve-feed/official-cve-feed.json > /dev/null 2>&1 || EXIT_CODE=$?
4647
47- # fetch the hash value of existing official-cve-feed.json json, if differs then upload the new cve feed data to the existing blob.
48+ # fetch the hash value of existing official-cve-feed.json json, if differs then
49+ # upload the new cve feed data to the existing blob.
4850if [[ $EXIT_CODE -eq 1 ]]; then
4951 gsutil cp official-cve-feed.json gs://k8s-cve-feed
5052 calculate_hash official-cve-feed.json > cve-feed-hash
0 commit comments