You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This task uses RapiDAST to scan a running application. Intended for use in an Integration Test, not a build pipeline. This task requires a KUBECONFIG_SECRET for an existing cluster/namespace
13
+
where the target application is running. To make this application reachable by RapiDAST from outside this environment, `oc port-forward` is used.
14
+
results:
15
+
- name: TEST_OUTPUT
16
+
description: Tekton task test output.
17
+
- name: SCAN_OUTPUT
18
+
description: RapiDAST scan result.
19
+
params:
20
+
- name: KUBECONFIG_SECRET
21
+
description: The name of a kubeconfig used to to access the test environment.
22
+
type: string
23
+
- name: RAPIDAST_CONFIG_VALUE
24
+
description: The contents of a rapidast config file. Target URLs for scanning should point to localhost and match PORT_FORWARD_TARGETS.
25
+
type: string
26
+
- name: PORT_FORWARD_TARGETS
27
+
description: Scan targets in test environment and arguments for `oc port-forward` commands. Each host:port in RAPIDAST_CONFIG_VALUE requires a respective port-forward target. Multiple values can be separated with a comma.
28
+
default: pod/my-pod 5000:5000
29
+
type: string
30
+
# TODO add a dotenv file argument, so users can pass in .env file with secrets etc used for scanning
31
+
volumes:
32
+
- name: shared
33
+
emptyDir: {}
34
+
sidecars:
35
+
- name: port-forward
36
+
image: quay.io/konflux-ci/konflux-test:latest
37
+
volumeMounts:
38
+
- name: shared
39
+
mountPath: /shared
40
+
env:
41
+
- name: KUBECONFIG
42
+
value: /shared/kubeconfig.yml
43
+
- name: KUBECONFIG_VALUE
44
+
valueFrom:
45
+
secretKeyRef:
46
+
name: "$(params.KUBECONFIG_SECRET)"
47
+
key: kubeconfig
48
+
- name: PORT_FORWARD_TARGETS
49
+
value: "$(params.PORT_FORWARD_TARGETS)"
50
+
script: |
51
+
#!/bin/bash
52
+
set -ex
53
+
54
+
# to share with rapidast image
55
+
cp utils.sh /shared
56
+
57
+
cat <<< "$KUBECONFIG_VALUE" > "$KUBECONFIG"
58
+
echo "Wrote kubeconfig for new environment to $KUBECONFIG"
59
+
60
+
echo "${PORT_FORWARD_TARGETS}"
61
+
62
+
check_pid_listening_port() {
63
+
local pid=$1
64
+
# checks that PID has at least one local port open
65
+
if ss -tlnp | grep -q "pid=${pid},"; then
66
+
return 0
67
+
fi
68
+
return 1
69
+
}
70
+
export -f check_pid_listening_port
71
+
72
+
# split on ",", then parse as json to handle whitespace
0 commit comments