@@ -48,10 +48,22 @@ pipeline:
4848 export CODEBASE_BRANCH=<+codebase.branch>
4949 export ENV_FOLDER=<+pipeline.variables.env_folder>
5050 export FRAMEWORK=<+pipeline.variables.framework>
51- export USE_LOCAL_DOCKERFILE=<+pipeline.variables.use_local_dockerfile>
5251 export TRIGGER_PR_NUMBER=<+trigger.prNumber>
5352 . ./harness_scripts/functional_by_framework/check_env_changed_check_diff.sh
53+
54+ dockerfile_local="./<+pipeline.variables.env_folder>/<+pipeline.variables.framework>/Dockerfile.local"
55+ ls -la ${dockefile_local}
56+ if [ -f "${dockerfile_local}" ]; then
57+ dockerfile_local_exists=true
58+ matrix_values="${test_image_tag},${test_image_tag}.local"
59+ else
60+ dockerfile_local_exists=false
61+ matrix_values="${test_image_tag}"
62+ fi
63+ export dockerfile_local_exists
5464 outputVariables :
65+ - name : dockerfile_local_exists
66+ - name : matrix_values
5567 - name : changed_deps
5668 - name : test_image_tag
5769 caching :
@@ -63,38 +75,65 @@ pipeline:
6375 runtime :
6476 type : Cloud
6577 spec : {}
66- - stage :
67- name : Build TMP image if framework env has changed
68- identifier : Build_image_because_of_change
69- description : " "
70- type : Pipeline
71- spec :
72- org : Custom_Models
73- pipeline : env_image_publish
74- project : datarobotusermodels
75- inputs :
76- identifier : env_image_publish
77- properties :
78- ci :
79- codebase :
80- build : <+input>
81- variables :
82- - name : env_folder
83- type : String
84- value : <+pipeline.variables.env_folder>
85- - name : env_name
86- type : String
87- value : <+pipeline.variables.framework>
88- - name : image_tag
89- type : String
90- value : <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.test_image_tag>
91- - name : use_local_dockerfile
92- type : String
93- value : <+pipeline.variables.use_local_dockerfile>
94- when :
95- pipelineStatus : Success
96- condition : <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.changed_deps> == true
97- tags : {}
78+ - parallel :
79+ - stage :
80+ name : Build TMP image if framework env has changed
81+ identifier : Build_image_because_of_change
82+ description : " "
83+ type : Pipeline
84+ spec :
85+ org : Custom_Models
86+ pipeline : env_image_publish
87+ project : datarobotusermodels
88+ inputs :
89+ identifier : env_image_publish
90+ properties :
91+ ci :
92+ codebase :
93+ build : <+input>
94+ variables :
95+ - name : context_path
96+ type : String
97+ value : <+pipeline.variables.env_folder>/<+pipeline.variables.framework>
98+ - name : dockerfile_path
99+ type : String
100+ value : <+pipeline.variables.env_folder>/<+pipeline.variables.framework>/Dockerfile
101+ - name : image_tag
102+ type : String
103+ value : <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.test_image_tag>
104+ when :
105+ pipelineStatus : Success
106+ condition : <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.changed_deps> == true
107+ tags : {}
108+ - stage :
109+ name : Build TMP image if framework env has changed LOCAL
110+ identifier : Build_image_because_of_change_local
111+ description : " "
112+ type : Pipeline
113+ spec :
114+ org : Custom_Models
115+ pipeline : env_image_publish
116+ project : datarobotusermodels
117+ inputs :
118+ identifier : env_image_publish
119+ properties :
120+ ci :
121+ codebase :
122+ build : <+input>
123+ variables :
124+ - name : context_path
125+ type : String
126+ value : <+pipeline.variables.env_folder>/<+pipeline.variables.framework>
127+ - name : dockerfile_path
128+ type : String
129+ value : <+pipeline.variables.env_folder>/<+pipeline.variables.framework>/Dockerfile.local
130+ - name : image_tag
131+ type : String
132+ value : <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.test_image_tag>.local
133+ when :
134+ pipelineStatus : Success
135+ condition : <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.changed_deps> == true && <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.dockerfile_local_exists> == true
136+ tags : {}
98137 - stage :
99138 name : Test functional by framework
100139 identifier : check_by_framework
@@ -108,11 +147,22 @@ pipeline:
108147 type : Run
109148 name : Run functional test in provided framework
110149 identifier : Run_1
150+ strategy :
151+ matrix :
152+ image_tag : <+<+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.matrix_values>.split(',')>
111153 spec :
112154 connectorRef : datarobot_user_models_read_write
113- image : datarobotdev/datarobot-user-models:<+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.test_image_tag >
155+ image : datarobotdev/datarobot-user-models:<+matrix.image_tag >
114156 shell : Sh
115157 command : |-
158+ echo "Checking if test for local should run"
159+ echo "Tag: <+matrix.image_tag>"
160+ echo "Dockerfile.local exists: <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.dockerfile_local_exists>"
161+
162+ if [[ "<+matrix.image_tag>" == *local* && <+pipeline.stages.check_env_changed.spec.execution.steps.check_diff.output.outputVariables.dockerfile_local_exists> == false ]]; then
163+ echo "Dockerfile.local does not exist, skippinig test"
164+ exit 0
165+ fi
116166 ./harness_scripts/functional_by_framework/check_by_framework_run1_step_entrypoint.sh \
117167 <+pipeline.variables.framework> <+pipeline.variables.env_folder>
118168 resources :
@@ -129,15 +179,19 @@ pipeline:
129179 image : curlimages/curl:latest
130180 shell : Sh
131181 command : |
132- status="<+execution.steps.Run_1.status>"
182+ status_0="<+execution.steps.Run_1_0.status>"
183+ status_1="<+execution.steps.Run_1_1.status>"
184+ if [[ "$status_1" == "null" ]]; then
185+ status_1="SUCCEEDED"
186+ fi
133187 github_status_key="<+pipeline.stages.check_env_changed.spec.execution.steps.report_status_to_github_pr_0.output.outputVariables.pipeline_execution_github_status_key>"
134188
135189 echo "Update PR status"
136- echo "$status "
137- if [[ "$status " == "SUCCEEDED" ]]; then
190+ echo "Status_0: $status_0; Status_1: $status_1 "
191+ if [[ "$status_0" == "SUCCEEDED" && "$status_1 " == "SUCCEEDED" ]]; then
138192 state="success"
139193 description="Passed"
140- elif [[ "$status " == "PENDING" ]]; then
194+ elif [[ "$status_0" == "PENDING" || "$status_1 " == "PENDING" ]]; then
141195 state="pending"
142196 description="Pending"
143197 else
0 commit comments