Skip to content

Commit

Permalink
fix: Enable scannerV4 in ACS
Browse files Browse the repository at this point in the history
Recommended configuration after reaching out the ACS team regarding RHTAPBUGS-1316.
Must not be merged before ACS has been updated to 4.6.
  • Loading branch information
Roming22 committed Nov 13, 2024
1 parent 36bfa58 commit e5495a3
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
43 changes: 43 additions & 0 deletions installer/charts/rhtap-acs/scripts/test-acs-image-scan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail

export ROX_CENTRAL_ENDPOINT="$(kubectl get secrets -n rhtap rhtap-acs-integration -o jsonpath='{.data.endpoint}' | base64 -d)"
export ROX_API_TOKEN="$(kubectl get secrets -n rhtap rhtap-acs-integration -o jsonpath='{.data.token}' | base64 -d)"

IMAGE="${IMAGE:-quay.io/fedora/fedora:36-x86_64@sha256:d6e4c7d6d1eaa24d71c8efd7432890acdc0179502224d0aaad6bb05d15ffde19}"

echo "# Download roxctl cli from ${ROX_CENTRAL_ENDPOINT}"
curl --insecure -s -L -H "Authorization: Bearer $ROX_API_TOKEN" \
"https://${ROX_CENTRAL_ENDPOINT}/api/cli/download/roxctl-linux" \
--output ./roxctl \
> /dev/null
if [ $? -ne 0 ]; then
note='Failed to download roxctl'
echo $note
exit 1
fi
chmod +x ./roxctl > /dev/null
echo

while true; do
echo "# roxctl image scan"
date
if ./roxctl image scan \
"--insecure-skip-tls-verify" \
-e "${ROX_CENTRAL_ENDPOINT}" \
--image "$IMAGE" \
--output json \
--force; then
break
fi
echo "Waiting"
echo
sleep 60
echo "Retrying"
done
rm ./roxctl
echo

echo "# Success"
2 changes: 1 addition & 1 deletion installer/charts/rhtap-acs/templates/acs-central.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
required ".acs.scanners.matcher is required"
$acs.scanners.matcher | toYaml | nindent 6
}}
scannerComponent: Default
scannerComponent: Enabled
scanner:
analyzer: {{-
required ".acs.scanners.analyzer is required"
Expand Down
16 changes: 16 additions & 0 deletions installer/charts/rhtap-acs/templates/tests/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ spec:
#
{{- include "acs.copyScripts" . | nindent 4 }}
containers:
#
# Test ACS availibility, pending https://issues.redhat.com/browse/RFE-6727
#
- name: acs-image-scan

Check warning

Code scanning / SonarCloud

Memory limits should be enforced Medium test

Specify a memory limit for this container. See more on SonarQube Cloud

Check warning

Code scanning / SonarCloud

Storage limits should be enforced Medium test

Specify a storage limit for this container. See more on SonarQube Cloud
image: quay.io/codeready-toolchain/oc-client-base:latest
env:
- name: IMAGE
value: quay.io/fedora/fedora:36-x86_64@sha256:d6e4c7d6d1eaa24d71c8efd7432890acdc0179502224d0aaad6bb05d15ffde19
command:
- /scripts/test-acs-image-scan.sh
volumeMounts:
- name: scripts
mountPath: /scripts
securityContext:
runAsNonRoot: false
allowPrivilegeEscalation: false
{{- range tuple "central" "central-db" "scanner" "scanner-db" }}
#
# Test the ACS rollout status.
Expand Down

0 comments on commit e5495a3

Please sign in to comment.