Skip to content

Commit

Permalink
add wait condition for port-for
Browse files Browse the repository at this point in the history
Signed-off-by: jcullina <[email protected]>
  • Loading branch information
jencull committed Jan 24, 2025
1 parent 291a4b9 commit 2d5a674
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .tekton/rapidast-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,16 @@ spec:
cat <<< "$KUBECONFIG_VALUE" > /tmp/cfg
export KUBECONFIG=/tmp/cfg
timeout 5m bash -c 'while ! curl -k https://:8083/healthcheck; do sleep 5; done'
echo "Starting port-forward for service/trex on port 8000..."
oc port-forward --address=0.0.0.0 --kubeconfig /tmp/cfg svc/trex 8000:8000
oc port-forward --address=0.0.0.0 --kubeconfig /tmp/cfg svc/trex 8000:8000
# Wait until port-forward is active
timeout 5m bash -c 'until echo > /dev/tcp/127.0.0.1/8000; do sleep 2s; done' || {
echo "[ERROR] Port-forward is not ready. Exiting."
exit 1
}
steps:
- name: get-url
image: registry.redhat.io/openshift4/ose-cli:latest
Expand All @@ -149,18 +157,16 @@ spec:
exit 1
}
BASE_URL="http://127.0.0.1:8000"
BASE_URL="https://127.0.0.1:8000"
CONFIG_PATH="/workspace/config.yaml"
wget -O /tmp/ocm https://github.com/openshift-online/ocm-cli/releases/download/v1.0.3/ocm-linux-amd64
chmod +x /tmp/ocm
export PATH=$PATH:/tmp
dnf install -y jq
/tmp/ocm login --token=${OCM_TOKEN} --url=${BASE_URL}
AUTH_RESPONSE=$(/tmp/ocm get /api/rh-trex/v1/dinosaurs)
AUTH_RESPONSE=$(/tmp/ocm get /api/rh-trex/v1/dinosaurs -k)
# Print the response to the logs
echo "${AUTH_RESPONSE}" | jq '.items[]' || echo "No dinosaurs found or failed to parse the response."
Expand Down

0 comments on commit 2d5a674

Please sign in to comment.