4747 value : $(tasks.test-metadata.results.job-spec)
4848 script : |
4949 #!/usr/bin/env bash
50- FORK=$(jq -r '.git.source_repo_org' <<< $JOB_SPEC)
51- BRANCH=$(jq -r '.git.source_repo_branch' <<< $JOB_SPEC)
52- curl -o $(results.pict-file.path) https://raw.githubusercontent.com/$FORK/rhtap-cli/refs/heads/$BRANCH/integration-tests/pict-models/default.pict
50+ GIT_REPO="$(jq -r '.git.repo // empty' <<< $JOB_SPEC)"
51+
52+ if [[ "${GIT_REPO}" = "rhtap-cli" ]]; then
53+ REPO_ORG=$(jq -r '.git.source_repo_org' <<< $JOB_SPEC)
54+ BRANCH=$(jq -r '.git.source_repo_branch' <<< $JOB_SPEC)
55+ else
56+ REPO_ORG="redhat-appstudio"
57+ BRANCH="main"
58+ fi
59+ curl -o $(results.pict-file.path) https://raw.githubusercontent.com/$REPO_ORG/rhtap-cli/refs/heads/$BRANCH/integration-tests/pict-models/default.pict
5360 - name : generate-configs
5461 runAfter :
5562 - get-pict-file
@@ -83,22 +90,42 @@ spec:
8390 value : $(tasks.test-metadata.results.job-spec)
8491 - name : CONFIGS_JSON
8592 value : $(tasks.generate-configs.results.configs-json)
93+ - name : KONFLUX_APPLICATION_NAME
94+ valueFrom :
95+ fieldRef :
96+ fieldPath : metadata.labels['appstudio.openshift.io/application']
97+ - name : KONFLUX_COMPONENT_NAME
98+ valueFrom :
99+ fieldRef :
100+ fieldPath : metadata.labels['appstudio.openshift.io/component']
86101 script : |
87102 #!/usr/bin/env bash
88- set -x
103+ set -euxo pipefail
104+
105+ GIT_REPO="$(jq -r '.git.repo // empty' <<< $JOB_SPEC)"
106+
107+ if [[ "${GIT_REPO}" = "rhtap-cli" ]]; then
108+ REPO_ORG=$(jq -r '.git.source_repo_org' <<< $JOB_SPEC)
109+ BRANCH=$(jq -r '.git.source_repo_branch' <<< $JOB_SPEC)
110+ else
111+ REPO_ORG="redhat-appstudio"
112+ BRANCH="main"
113+ fi
114+
89115 echo "Running tests for OCP versions:"
90116 echo "$CONFIGS_JSON" | jq -r '.[][] | select(.key == "OCP").value'
117+
91118 pids=()
92119
93120 while IFS= read -r version; do
94121 (
95- pipeline_run_name=$(tkn pipeline start -f https://raw.githubusercontent.com/redhat-appstudio /rhtap-cli/refs/heads/main /integration-tests/pipelines/rhtap-cli-e2e.yaml \
122+ pipeline_run_name=$(tkn pipeline start -f https://raw.githubusercontent.com/$REPO_ORG /rhtap-cli/refs/heads/$BRANCH /integration-tests/pipelines/rhtap-cli-e2e.yaml \
96123 --param ocp-version="$version"\
97124 --param job-spec="$JOB_SPEC"\
98125 --param konflux-test-infra-secret="$(params.konflux-test-infra-secret)" \
99126 --use-param-defaults \
100- --labels "appstudio.openshift.io/component=rhtap-cli " \
101- --labels "appstudio.openshift.io/application=rhtap-cli " \
127+ --labels "appstudio.openshift.io/component=${KONFLUX_COMPONENT_NAME} " \
128+ --labels "appstudio.openshift.io/application=${KONFLUX_APPLICATION_NAME} " \
102129 --labels "pipelines.appstudio.openshift.io/type=$(context.pipelineRun.name)" \
103130 --labels "test.appstudio.openshift.io/scenario=pr-e2e-tests" \
104131 --prefix-name "e2e-$version"\
@@ -115,11 +142,12 @@ spec:
115142 ) &
116143 pid="$!"
117144 pids+=("$pid")
118- done < <(echo "$CONFIGS_JSON" | jq -r '.[][] | select(.key == "OCP").value');
145+ done < <(echo "$CONFIGS_JSON" | jq -r '.[][] | select(.key == "OCP").value')
146+
119147 for pid in "${pids[@]}"; do
120148 wait "$pid"
121149 return_code=$?
122- if [ ! $return_code -eq 0 ]; then
150+ if [ $return_code -ne 0 ]; then
123151 echo "One or more pipelineruns failed. Exiting with non-zero code."
124152 oc get pipelineruns
125153 exit 1
0 commit comments