-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathcompute-workflow-parameters.yml
More file actions
197 lines (187 loc) · 7.65 KB
/
Copy pathcompute-workflow-parameters.yml
File metadata and controls
197 lines (187 loc) · 7.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: "Compute workflow, scenarios and weblogs to run"
on:
workflow_call:
inputs:
library:
description: "Library to run"
required: true
type: string
ref:
description: "system-tests ref to run the tests on (can be any valid branch, tag or SHA in system-tests repo)"
type: string
scenarios:
description: "Comma-separated list of scenarios to run"
type: string
default: ""
scenarios_groups:
description: "Comma-separated list of scenarios groups to run"
type: string
default: ""
excluded_scenarios:
description: "Comma-separated list of scenarios not to run"
type: string
default: ""
weblogs:
description: "Comma-separated list of weblogs to run. By default, all weblogs are run"
default: ''
required: false
type: string
parametric_job_count:
description: "*EXPERIMENTAL* : How many jobs should be used to run PARAMETRIC scenario"
default: 1
required: false
type: number
desired_execution_time:
description: "In seconds, system-tests will try to respect this time budget."
default: "-1"
required: false
type: string
binaries_artifact:
description: "Artifact name containing the binaries to test"
default: ''
required: false
type: string
_system_tests_dev_mode:
description: "Shall we run system tests in dev mode (library and agent dev binary)"
default: false
required: false
type: boolean
_system_tests_library_target_branch_map:
description: "If system-tests dev mode, JSON map of library to branch (e.g. {\"java\":\"b1\",\"dotnet\":\"b2\"})"
default: ''
required: false
type: string
# Map the workflow outputs to job outputs
outputs:
endtoend_scenarios: # legacy
description: ""
value: ${{ jobs.main.outputs.endtoend_scenarios }}
endtoend_weblogs: # legacy
description: ""
value: ${{ jobs.main.outputs.endtoend_weblogs }}
libinjection_scenarios:
description: ""
value: ${{ jobs.main.outputs.libinjection_scenarios }}
parametric_enable:
description: ""
value: ${{ jobs.main.outputs.parametric_enable }}
parametric_job_matrix:
description: ""
value: ${{ jobs.main.outputs.parametric_job_matrix }}
endtoend_defs_parallel_enable:
description: ""
value: ${{ jobs.main.outputs.endtoend_defs_parallel_enable }}
endtoend_defs_parallel_weblogs:
description: ""
value: ${{ jobs.main.outputs.endtoend_defs_parallel_weblogs }}
endtoend_defs_parallel_jobs:
description: ""
value: ${{ jobs.main.outputs.endtoend_defs_parallel_jobs }}
ci_environment:
description: ""
value: ${{ jobs.main.outputs.ci_environment }}
binaries_artifact:
description: ""
value: ${{ jobs.main.outputs.binaries_artifact }}
unique_id:
description: "A unique ID for the workflow run, used to set unique artifact names if the workflow is called in a matrix"
value: ${{ jobs.main.outputs.unique_id }}
jobs:
main:
name: Get parameters
runs-on: ubuntu-latest
outputs:
endtoend_defs_parallel_enable: ${{ steps.main.outputs.endtoend_defs_parallel_enable }}
endtoend_defs_parallel_weblogs: ${{ steps.main.outputs.endtoend_defs_parallel_weblogs }}
endtoend_defs_parallel_jobs: ${{ steps.main.outputs.endtoend_defs_parallel_jobs }}
libinjection_scenarios: ${{ steps.main.outputs.libinjection_scenarios }}
parametric_enable: ${{ steps.main.outputs.parametric_enable }}
parametric_job_matrix: ${{ steps.main.outputs.parametric_job_matrix }}
parametric_job_count: ${{ steps.main.outputs.parametric_job_count }}
endtoend_scenarios: ${{ steps.main.outputs.endtoend_scenarios }} # legacy
endtoend_weblogs: ${{ steps.main.outputs.endtoend_weblogs }} # legacy
ci_environment: ${{ steps.main.outputs.miscs_ci_environment }}
binaries_artifact: ${{ steps.main.outputs.miscs_binaries_artifact }}
unique_id: ${{ steps.main.outputs.unique_id }}
steps:
- name: Compute ref
id: compute_ref
run: |
if [[ "${{ inputs.ref }}" != "" ]]; then
echo "ref=${{ inputs.ref }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.repository }}" == "DataDog/system-tests" ]]; then
echo "ref=" >> $GITHUB_OUTPUT
else
echo "ref=main" >> $GITHUB_OUTPUT
fi
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
with:
repository: 'DataDog/system-tests'
ref: ${{ steps.compute_ref.outputs.ref }}
- name: Install runner
uses: ./.github/actions/install_runner
- name: main
id: main
run: |
source venv/bin/activate
python utils/scripts/compute-workflow-parameters.py ${{ inputs.library }} \
-t ${{ inputs.desired_execution_time }} \
-s "${{ inputs.scenarios }}" \
-g "${{ inputs.scenarios_groups }}" \
--excluded-scenarios "${{ inputs.excluded_scenarios }}" \
--weblogs "${{ inputs.weblogs }}" \
--parametric-job-count ${{ inputs.parametric_job_count }} \
--explicit-binaries-artifact "${{ inputs.binaries_artifact }}" \
--system-tests-dev-mode "${{ inputs._system_tests_dev_mode }}" \
--output $GITHUB_OUTPUT
- name: log
run: |
source venv/bin/activate
python utils/scripts/compute-workflow-parameters.py ${{ inputs.library }} \
-t ${{ inputs.desired_execution_time }} \
-s "${{ inputs.scenarios }}" \
-g "${{ inputs.scenarios_groups }}" \
--excluded-scenarios "${{ inputs.excluded_scenarios }}" \
--weblogs "${{ inputs.weblogs }}" \
--parametric-job-count ${{ inputs.parametric_job_count }} \
--explicit-binaries-artifact "${{ inputs.binaries_artifact }}" \
--system-tests-dev-mode "${{ inputs._system_tests_dev_mode }}" \
--format json | jq
- name: Extract library target branch
if: ${{ inputs._system_tests_dev_mode }}
id: extract_branch
shell: python
run: |
import json
import os
branch_map_str = os.environ.get("TARGET_BRANCH_MAP", "")
library = os.environ.get("LIBRARY", "")
library_branch = ""
agent_branch = ""
if branch_map_str:
branch_map = json.loads(branch_map_str)
library_branch = branch_map.get(library, "")
agent_branch = branch_map.get("agent", "")
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
f.write(f"library_branch={library_branch}\n")
f.write(f"agent_branch={agent_branch}\n")
env:
TARGET_BRANCH_MAP: ${{ inputs._system_tests_library_target_branch_map }}
LIBRARY: ${{ inputs.library }}
- name: Get dev artifacts
if: ${{ inputs._system_tests_dev_mode }}
run: |
./utils/scripts/load-binary.sh agent
./utils/scripts/load-binary.sh ${{ inputs.library }}
env:
LIBRARY_TARGET_BRANCH: "${{ steps.extract_branch.outputs.library_branch }}"
AGENT_TARGET_BRANCH: "${{ steps.extract_branch.outputs.agent_branch }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
if: ${{ inputs._system_tests_dev_mode }}
uses: ./.github/actions/upload_artifact
with:
name: binaries_dev_${{ inputs.library }}
path: binaries/
include-hidden-files: ${{ inputs.library == 'python' || inputs.library == 'python_lambda' }}