File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,44 +4,58 @@ metadata:
44 name : integration-and-unit-tests
55 namespace : multiarch-tuning-ope-tenant
66spec :
7- params : [ ]
7+ params :
8+ - name : SNAPSHOT
9+ description : ' Snapshot of the application'
10+ type : string
11+ default : ' {"components": [{"name":"multiarch-tuning-operator", "containerImage": "quay.io/example/repo:latest"}]}'
812 tasks :
913 - name : clone-and-test
14+ params :
15+ - name : SNAPSHOT
16+ value : $(params.SNAPSHOT)
1017 taskSpec :
18+ params :
19+ - name : SNAPSHOT
20+ type : string
1121 volumes :
1222 - name : source
1323 emptyDir : { }
1424 steps :
1525 - image : brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.25
1626 env :
17- - name : URL
18- valueFrom :
19- fieldRef :
20- fieldPath : metadata.annotations['pac.test.appstudio.openshift.io/source-repo-url']
21- - name : REVISION
22- valueFrom :
23- fieldRef :
24- fieldPath : metadata.annotations['pac.test.appstudio.openshift.io/sha']
27+ - name : SNAPSHOT
28+ value : $(params.SNAPSHOT)
2529 computeResources :
2630 limits :
2731 cpu : 8
28- memory : 4Gi
32+ memory : 8Gi
2933 requests :
3034 cpu : 500m
31- memory : 1Gi
35+ memory : 2Gi
3236 volumeMounts :
3337 - name : source
3438 mountPath : /workspace
3539 script : |
3640 #!/bin/bash
3741 set -exuo pipefail
38- if [ -z "$URL" ] || [ -z "$REVISION" ]; then
39- echo "URL and REVISION must be set"
42+
43+ dnf -y install jq
44+
45+ # Extract git URL and revision from SNAPSHOT
46+ URL=$(echo "${SNAPSHOT}" | jq -r '.components[0].source.git.url // empty')
47+ REVISION=$(echo "${SNAPSHOT}" | jq -r '.components[0].source.git.revision // empty')
48+
49+ # If not in SNAPSHOT format, try to get from annotations (PAC compatibility)
50+ if [ -z "$URL" ]; then
51+ echo "SNAPSHOT format not found, this pipeline expects to be called with a SNAPSHOT parameter"
4052 exit 1
4153 fi
54+
4255 echo "Initializing the env vars"
4356 echo "URL: $URL"
4457 echo "REVISION: $REVISION"
58+
4559 mkdir /workspace/source
4660 cd /workspace/source
4761 git init
You can’t perform that action at this time.
0 commit comments