Skip to content

Commit 616320e

Browse files
[YOLO] Update pipeline test functional by framework (#1421)
1 parent fb4100b commit 616320e

File tree

3 files changed

+102
-74
lines changed

3 files changed

+102
-74
lines changed

.harness/env_image_publish.yaml

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,13 @@ pipeline:
2626
identifier: BuildAndPushDockerRegistry_1
2727
when:
2828
stageStatus: Success
29-
pipelineStatus: Success
30-
condition: <+pipeline.variables.use_local_dockerfile> != "true"
3129
spec:
3230
connectorRef: datarobot_user_models_read_write
3331
repo: datarobotdev/datarobot-user-models
3432
tags:
3533
- <+pipeline.variables.image_tag>
36-
dockerfile: <+pipeline.variables.env_folder>/<+pipeline.variables.env_name>/Dockerfile
37-
context: <+pipeline.variables.env_folder>/<+pipeline.variables.env_name>
38-
resources:
39-
limits:
40-
memory: 3G
41-
- step:
42-
type: BuildAndPushDockerRegistry
43-
name: LocalBuildAndPushDockerRegistry_1
44-
identifier: LocalBuildAndPushDockerRegistry_1
45-
when:
46-
stageStatus: Success
47-
pipelineStatus: Success
48-
condition: <+pipeline.variables.use_local_dockerfile> == "true"
49-
spec:
50-
connectorRef: datarobot_user_models_read_write
51-
repo: datarobotdev/datarobot-user-models
52-
tags:
53-
- <+pipeline.variables.image_tag>
54-
dockerfile: <+pipeline.variables.env_folder>/<+pipeline.variables.env_name>/Dockerfile.local
55-
context: <+pipeline.variables.env_folder>/<+pipeline.variables.env_name>
34+
dockerfile: <+pipeline.variables.dockerfile_path>
35+
context: <+pipeline.variables.context_path>
5636
resources:
5737
limits:
5838
memory: 3G
@@ -66,25 +46,19 @@ pipeline:
6646
type: Cloud
6747
spec: {}
6848
variables:
69-
- name: env_folder
49+
- name: context_path
7050
type: String
71-
description: ""
7251
required: true
73-
value: <+input>.allowedValues(public_dropin_environments, public_dropin_gpu_environments, public_dropin_nim_environments)
74-
- name: env_name
52+
value: <+input>
53+
- name: dockerfile_path
7554
type: String
76-
description: ""
7755
required: true
78-
value: <+input>.allowedValues(python3_sklearn,python3_xgboost,python3_onnx,python3_pytorch,python3_keras,python3_pmml,python311_genai,python39_genai,java_codegen,r_lang,python311,vllm,triton_server,nim_llama_8b,nim_sidecar)
56+
value: <+input>
7957
- name: image_tag
8058
type: String
8159
description: ""
8260
required: true
83-
value: <+input>.default(<+pipeline.variables.env_folder>_<+pipeline.variables.env_name>_latest)
84-
- name: use_local_dockerfile
85-
type: String
86-
required: false
87-
value: <+input>.default("false")
61+
value: <+input>
8862
description: |-
8963
Builds an environment image and pushes it to the DockerHub registry. These images are used to run functional tests for every PR.
9064

.harness/test_functional_by_framework.yaml

Lines changed: 92 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -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

harness_scripts/functional_by_framework/check_env_changed_check_diff.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ else
3636
fi
3737

3838
# If the environment variable 'USE_LOCAL_DOCKERFILE' is set to "true", than add '.local'
39-
if [ -n $USE_LOCAL_DOCKERFILE ] && [ "$USE_LOCAL_DOCKERFILE" = "true" ]; then
40-
test_image_tag=${test_image_tag}.local
41-
fi
39+
#if [ -n $USE_LOCAL_DOCKERFILE ] && [ "$USE_LOCAL_DOCKERFILE" = "true" ]; then
40+
# test_image_tag=${test_image_tag}.local
41+
#fi
4242

4343
# Required by the Harness step
4444
export changed_deps

0 commit comments

Comments
 (0)