Skip to content

Commit

Permalink
Fix missing fi, rename variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhopp committed Jan 7, 2025
1 parent 2461049 commit 261b416
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions integration-tests/pipelines/e2e-main-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ spec:
fieldPath: metadata.namespace
script: |
#!/usr/bin/env bash
set -euxo pipefail
set -euo pipefail
GIT_REPO="$(jq -r '.git.repo // empty' <<< $JOB_SPEC)"
Expand All @@ -115,7 +115,7 @@ spec:
echo "Running tests for OCP versions:"
echo "$CONFIGS_JSON" | jq -r '.[][] | select(.key == "OCP").value'
PIPELINERUNS_ARRAY=()
export PIPELINERUNS_ARRAY=()
while IFS= read -r config; do
OCP_VERSION=$(echo "$config" | jq -r '.[] | select(.key == "OCP").value')
Expand Down Expand Up @@ -144,50 +144,47 @@ spec:
--prefix-name "e2e-$OCP_VERSION"\
-o name)
echo "Started new pipelinerun: https://console.redhat.com/application-pipeline/workspaces/${KONFLUX_NAMESPACE}/applications/${KONFLUX_APPLICATION_NAME}/pipelineruns/${pipeline_run_name}"
KONFLUX_TENANT="${KONFLUX_NAMESPACE%-tenant}"
PIPELINERUNS_ARRAY+=($pipeline_run_name)
echo "Started new pipelinerun: https://console.redhat.com/application-pipeline/workspaces/${KONFLUX_TENANT}/applications/${KONFLUX_APPLICATION_NAME}/pipelineruns/${pipeline_run_name}"
# tkn pipelinerun logs "$pipeline_run_name" -f | sed "s/^/$pipeline_run_name: /"
PIPELINERUNS_ARRAY+=($pipeline_run_name)
# pipelinerun_status=$(tkn pipelinerun describe "$pipeline_run_name" -o jsonpath='{.status.conditions[0].status}')
# if [ "$pipelinerun_status" != "True" ]; then
# echo "Pipelinerun $pipeline_run_name failed"
# exit 1
# fi
done < <(echo "$CONFIGS_JSON" | jq -c '.[]')
# Wait for all PLRs to finish
# Wait for all PLRs to finish
timeout --foreground 120m /bin/bash -c '
set -x
while true; do
IS_SOMETHING_RUNNING=false
ARE_PIPELINES_RUNNING=false
for PIPELINE_RUN in "${PIPELINERUNS_ARRAY[@]}"; do
if [[ $(oc get pipelinerun/$PIPELINE_RUN -n ${KONFLUX_NAMESPACE} -o jsonpath="{.status.conditions[?(@.type==\"Succeeded\")].status}") == "Unknown" ]]; then
#something is still running. Break this cycle and wait one minute.
IS_SOMETHING_RUNNING=true
ARE_PIPELINES_RUNNING=true
break
fi
done
if $IS_SOMETHING_RUNNING ; then
if $ARE_PIPELINES_RUNNING ; then
echo "Nested pipelines are still running. Waiting 1 minute"
sleep 60
else
echo "All nested pipelines finished"
break
fi
done
'
## Explore and report status of all failed pipelineruns. Fail if anything failed
SOMETHING_FAILED=false
SOME_PIPELINE_FAILED=false
for PIPELINE_RUN in "${PIPELINERUNS_ARRAY[@]}"; do
if [[ $(oc get pipelinerun/$PIPELINE_RUN -n ${KONFLUX_NAMESPACE} -o jsonpath="{.status.conditions[?(@.type==\"Succeeded\")].status}") == "Failed" ]]; then
if ! $SOMETHING_FAILED ; then
if ! $SOME_PIPELINE_FAILED ; then
echo "List of failed PLRs:"
fi
echo "https://console.redhat.com/application-pipeline/workspaces/${KONFLUX_NAMESPACE}/applications/${KONFLUX_APPLICATION_NAME}/pipelineruns/${PIPELINE_RUN}"
SOMETHING_FAILED=true
SOME_PIPELINE_FAILED=true
fi
done
if $SOMETHING_FAILED ; then
done
if $SOME_PIPELINE_FAILED ; then
exit 1
fi
fi

0 comments on commit 261b416

Please sign in to comment.