Skip to content

Commit

Permalink
Merge pull request #4 from szh/main
Browse files Browse the repository at this point in the history
Add sleep command to ensure latest usage data
  • Loading branch information
slashben authored Jun 13, 2024
2 parents a3d38c0 + 0fa2e3d commit 230b05f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
14 changes: 9 additions & 5 deletions generate.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
set -x

# Wait the nodeAgent.config.updatePeriod used when installing the Kubescape helm chart.
# This ensures that the VEX documents are updated with the latest usage data.
echo "Waiting for VEX generation..."
sleep 60

# Now attempt to retrieve the VEX documents
timeout=300
start_time=$SECONDS
while [[ -z $(kubectl -n kubescape get openvulnerabilityexchangecontainers.spdx.softwarecomposition.kubescape.io) ]]; do
Expand Down Expand Up @@ -44,11 +49,10 @@ for doc in $vex_docs; do
# # Save the VEX document (the .spec portion) to a file
jq ".spec" <<< "$vex_object" > out/"$image".json

echo "Affected:"
jq "." out/"$image".json | grep -c "\"affected\""
count_affected=$(jq "." out/"$image".json | grep -c "\"affected\"")
count_not_affected=$(jq "." out/"$image".json | grep -c "\"not_affected\"")

echo "Not affected:"
jq "." out/"$image".json | grep -c "\"not_affected\""
echo "Saved VEX document for $image. $count_affected issues affected, $count_not_affected not affected."
done

# Check if there are any VEX documents saved
Expand Down
1 change: 0 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -x

helm install "$HELM_CHART_PATH" --wait --timeout "$INSTALL_TIMEOUT" --generate-name -n "$TESTS_NAMESPACE" --create-namespace

Expand Down
1 change: 0 additions & 1 deletion self-test/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -x

# Get the pod name and container port of the test application
POD_NAME=$(kubectl -n self-test get pods -l "app.kubernetes.io/name=hello-world" -o jsonpath="{.items[0].metadata.name}")
Expand Down
1 change: 0 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -x

# Install Kubescape
helm repo add kubescape https://kubescape.github.io/helm-charts/
Expand Down
1 change: 0 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -x

if [[ -n "$TEST_COMMAND" ]]; then
$TEST_COMMAND
Expand Down

0 comments on commit 230b05f

Please sign in to comment.