Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sleep command to ensure latest usage data #4

Merged
merged 3 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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