Skip to content

Commit c97be68

Browse files
Merge RUN_E2E_TESTS and RUN_KITCHEN_TESTS variables (#23613)
* Merge RUN_E2E_TESTS and RUN_KITCHEN_TESTS variables * Rename more rules * Rename test var * Fix gitlab-ci file * Fix if_not_e2e * Rename if not e2e * Rename if not e2e * Fix yaml aliases * Update pipeline run task * Rename alias run_e2e_tests * fixI(CI): Replace test with false by off * fixI(CI): Condition to not trigger windows PR test * fix(invoke): change RUN_E2E_TESTS values * fix(CI): Fix variable name * Update .gitlab-ci.yml Co-authored-by: Nicolas Schweitzer <[email protected]> * doc(CI): Explain behavior of auto --------- Co-authored-by: Nicolas Schweitzer <[email protected]>
1 parent bcceb0d commit c97be68

File tree

3 files changed

+46
-65
lines changed

3 files changed

+46
-65
lines changed

.gitlab-ci.yml

Lines changed: 39 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ variables:
209209
CLANG_LLVM_VER: 12.0.1
210210
KERNEL_MATRIX_TESTING_X86_AMI_ID: "ami-0c54d42f8f4180b0c"
211211
KERNEL_MATRIX_TESTING_ARM_AMI_ID: "ami-021f04c00ecfa8590"
212-
RUN_E2E_TESTS: "manual" # Should be "auto", "manual", "off" it will change the trigger condition for new-e2e tests on branch != main
212+
RUN_E2E_TESTS: "auto" # Should be "off", "auto" or "on" it will change the trigger condition for new-e2e tests on branch != main
213213
# skip known flaky tests by default
214214
GO_TEST_SKIP_FLAKE: "true"
215215

@@ -282,31 +282,29 @@ variables:
282282
.if_not_run_all_builds: &if_not_run_all_builds
283283
if: $CI_COMMIT_BRANCH != "main" && $DEPLOY_AGENT != "true" && $RUN_ALL_BUILDS != "true"
284284

285-
# Rule to trigger test kitchen setup, run, and cleanup.
285+
# Rule to trigger test setup, run, and cleanup.
286286
# By default:
287-
# - on main and deploy pipelines, kitchen tests are run
288-
# - on branch pipelines, kitchen tests are not run
289-
# RUN_KITCHEN_TESTS can be set to true to force kitchen tests to be run on a branch pipeline.
290-
# RUN_KITCHEN_TESTS can be set to false to force kitchen tests to not run on main/deploy pipelines.
291-
.if_kitchen: &if_kitchen
292-
if: ($CI_COMMIT_BRANCH == "main" || $DEPLOY_AGENT == "true" || $RUN_KITCHEN_TESTS == "true") && $RUN_KITCHEN_TESTS != "false"
293-
294-
# Rules to trigger default kitchen tests.
295-
# Some of the kitchen tests are run on all pipelines by default. They can only be disabled
296-
# by setting RUN_KITCHEN_TESTS to false.
297-
.if_default_kitchen: &if_default_kitchen
298-
if: $RUN_KITCHEN_TESTS != "false"
287+
# - on main and deploy pipelines, installer tests are run
288+
# - on branch pipelines, installer tests are run on a subset of the OSes we test
289+
# RUN_E2E_TESTS can be set to on to force all the installer tests to be run on a branch pipeline.
290+
# RUN_E2E_TESTS can be set to false to force installer tests to not run on main/deploy pipelines.
291+
.if_installer_tests: &if_installer_tests
292+
if: ($CI_COMMIT_BRANCH == "main" || $DEPLOY_AGENT == "true" || $RUN_E2E_TESTS == "on") && $RUN_E2E_TESTS != "off"
299293

300294
.if_testing_cleanup: &if_testing_cleanup
301295
if: $TESTING_CLEANUP == "true"
302296

303-
.if_not_e2e: &if_not_e2e
304-
if: $RUN_KITCHEN_TESTS == "false"
297+
.if_run_all_e2e_tests: &if_run_all_e2e_tests
298+
if: $RUN_E2E_TESTS == "on"
305299

306-
.if_auto_e2e: &if_auto_e2e
300+
# When RUN_E2E_TESTS is set to "auto". We do not enforce a behavior for the tests.
301+
# The behavior of each test will be defined by its rules.
302+
# For example for new-e2e tests created by each team, here is an example of such rules: https://github.com/DataDog/datadog-agent/blob/ba7079d92077ab5898378594dcafb9cd88a77e57/.gitlab-ci.yml#L1160-L1167
303+
# For the installer tests when RUN_E2E_TESTS is set to "auto", we run a subset of tests on branch pipelines and all the tests on main.
304+
.if_auto_e2e_tests: &if_auto_e2e_tests
307305
if: $RUN_E2E_TESTS == "auto"
308306

309-
.if_disable_e2e: &if_disable_e2e
307+
.if_disable_e2e_tests: &if_disable_e2e_tests
310308
if: $RUN_E2E_TESTS == "off"
311309

312310
.if_deploy_on_beta_repo_branch: &if_deploy_on_beta_repo_branch
@@ -797,7 +795,7 @@ workflow:
797795
- when: on_success
798796

799797
.except_no_tests_no_deploy:
800-
- if: $RUN_KITCHEN_TESTS == "false" && $DEPLOY_AGENT == "false" && $RUN_E2E_TESTS == "off"
798+
- if: $DEPLOY_AGENT == "false" && $RUN_E2E_TESTS == "off"
801799
when: never
802800

803801
.on_a6_except_deploy:
@@ -864,45 +862,39 @@ workflow:
864862
.on_kitchen_tests_a6:
865863
- <<: *if_not_version_6
866864
when: never
867-
- <<: *if_kitchen
865+
- <<: *if_installer_tests
868866

869867
.on_kitchen_tests_a6_always:
870868
- <<: *if_not_version_6
871869
when: never
872-
- <<: *if_kitchen
870+
- <<: *if_installer_tests
873871
when: always
874872

875873
.on_all_kitchen_builds_a6:
876874
- <<: *if_not_version_6
877875
when: never
878876
- <<: *if_not_run_all_builds
879877
when: never
880-
- <<: *if_kitchen
878+
- <<: *if_installer_tests
881879

882880
.on_kitchen_tests_a7:
883881
- <<: *if_not_version_7
884882
when: never
885-
- <<: *if_kitchen
886-
887-
.on_kitchen_tests_a7_always:
888-
- <<: *if_not_version_7
889-
when: never
890-
- <<: *if_kitchen
891-
when: always
883+
- <<: *if_installer_tests
892884

893885
.on_all_kitchen_builds_a7:
894886
- <<: *if_not_version_7
895887
when: never
896888
- <<: *if_not_run_all_builds
897889
when: never
898-
- <<: *if_kitchen
890+
- <<: *if_installer_tests
899891

900892
.on_all_new-e2e_tests_a7:
901893
- <<: *if_not_version_7
902894
when: never
903895
- <<: *if_not_run_all_builds
904896
when: never
905-
- <<: *if_kitchen
897+
- <<: *if_installer_tests
906898

907899
# Default kitchen tests are also run on dev branches
908900
# In that case, the target OS versions is a subset of the
@@ -912,8 +904,8 @@ workflow:
912904
when: never
913905
- <<: *if_not_version_7
914906
when: never
915-
- <<: *if_kitchen
916-
- <<: *if_default_kitchen
907+
- <<: *if_installer_tests
908+
- <<: *if_auto_e2e_tests
917909
variables:
918910
KITCHEN_OSVERS: $DEFAULT_KITCHEN_OSVERS
919911

@@ -922,8 +914,10 @@ workflow:
922914
when: never
923915
- <<: *if_not_version_7
924916
when: never
925-
- <<: *if_kitchen
926-
- <<: *if_default_kitchen
917+
- <<: *if_disable_e2e_tests
918+
when: never
919+
- <<: *if_installer_tests
920+
- <<: *if_auto_e2e_tests
927921
variables:
928922
E2E_OSVERS: $E2E_BRANCH_OSVERS
929923

@@ -932,9 +926,9 @@ workflow:
932926
when: never
933927
- <<: *if_not_version_7
934928
when: never
935-
- <<: *if_kitchen
929+
- <<: *if_installer_tests
936930
when: always
937-
- <<: *if_default_kitchen
931+
- <<: *if_auto_e2e_tests
938932
when: always
939933
variables:
940934
KITCHEN_OSVERS: $DEFAULT_KITCHEN_OSVERS
@@ -986,7 +980,7 @@ workflow:
986980
compare_to: main # TODO: use a variable, when this is supported https://gitlab.com/gitlab-org/gitlab/-/issues/369916
987981

988982
.on_windows_installer_changes_or_manual:
989-
- <<: *if_not_e2e
983+
- <<: *if_disable_e2e_tests
990984
when: never
991985
- <<: *if_main_branch
992986
- <<: *if_mergequeue
@@ -1049,11 +1043,11 @@ workflow:
10491043

10501044

10511045
.on_e2e_main_release_or_rc: # This rule is used as a base for all new-e2e rules
1052-
- <<: *if_disable_e2e
1046+
- <<: *if_disable_e2e_tests
10531047
when: never
10541048
- <<: *if_mergequeue
10551049
when: never
1056-
- <<: *if_auto_e2e
1050+
- <<: *if_run_all_e2e_tests
10571051
when: on_success
10581052
- <<: *if_main_branch
10591053
when: on_success
@@ -1068,11 +1062,11 @@ workflow:
10681062
compare_to: main # TODO: use a variable, when this is supported https://gitlab.com/gitlab-org/gitlab/-/issues/369916
10691063

10701064
.always_on_container_or_e2e_changes_or_manual:
1071-
- <<: *if_disable_e2e
1065+
- <<: *if_disable_e2e_tests
10721066
when: never
10731067
- <<: *if_mergequeue
10741068
when: never
1075-
- <<: *if_auto_e2e
1069+
- <<: *if_run_all_e2e_tests
10761070
when: always
10771071
- <<: *if_main_branch
10781072
when: always
@@ -1252,7 +1246,7 @@ workflow:
12521246
when: never
12531247
- <<: *if_not_main_branch
12541248
when: never
1255-
- <<: *if_kitchen
1249+
- <<: *if_installer_tests
12561250
when: manual
12571251
allow_failure: true
12581252

@@ -1271,7 +1265,7 @@ workflow:
12711265
allow_failure: true
12721266

12731267
.on_updater_or_e2e_changes_or_manual:
1274-
- <<: *if_disable_e2e
1268+
- <<: *if_disable_e2e_tests
12751269
when: never
12761270
- <<: *if_mergequeue
12771271
when: never
@@ -1310,7 +1304,7 @@ workflow:
13101304
allow_failure: true
13111305

13121306
.on_main_or_rc_and_no_skip_e2e:
1313-
- <<: *if_not_e2e
1307+
- <<: *if_disable_e2e_tests
13141308
when: never
13151309
- <<: *if_release_branch
13161310
when: on_success
@@ -1323,11 +1317,6 @@ workflow:
13231317
- <<: *if_mergequeue
13241318
when: never
13251319

1326-
.if_run_e2e_tests:
1327-
- <<: *if_disable_e2e
1328-
when: never
1329-
- <<: *if_auto_e2e
1330-
13311320
.on_packaging_change:
13321321
- !reference [.except_mergequeue] # The prerequisites are not run in the mergequeue pipeline so we need to skip this rule
13331322
- changes:

tasks/libs/pipeline_tools.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ def trigger_agent_pipeline(
8787
branch="nightly",
8888
deploy=False,
8989
all_builds=False,
90-
kitchen_tests=False,
9190
e2e_tests=False,
9291
rc_build=False,
9392
rc_k8s_deployments=False,
@@ -111,17 +110,12 @@ def trigger_agent_pipeline(
111110
if all_builds:
112111
args["RUN_ALL_BUILDS"] = "true"
113112

114-
# Kitchen tests can be selectively enabled, or disabled on pipelines where they're
115-
# enabled by default (default branch and deploy pipelines).
116-
if kitchen_tests:
117-
args["RUN_KITCHEN_TESTS"] = "true"
118-
else:
119-
args["RUN_KITCHEN_TESTS"] = "false"
120-
121113
# End to end tests can be selectively enabled, or disabled on pipelines where they're
122114
# enabled by default (default branch and deploy pipelines).
123115
if e2e_tests:
124-
args["RUN_E2E_TESTS"] = "true"
116+
args["RUN_E2E_TESTS"] = "on"
117+
else:
118+
args["RUN_E2E_TESTS"] = "off"
125119

126120
if release_version_6 is not None:
127121
args["RELEASE_VERSION_6"] = release_version_6

tasks/pipeline.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ def run(
221221
repo_branch="dev",
222222
deploy=False,
223223
all_builds=True,
224-
kitchen_tests=True,
225-
e2e_tests=False,
224+
e2e_tests=True,
226225
rc_build=False,
227226
rc_k8s_deployments=False,
228227
):
@@ -302,14 +301,14 @@ def run(
302301
)
303302
)
304303
all_builds = True
305-
if not kitchen_tests:
304+
if not e2e_tests:
306305
print(
307306
color_message(
308-
"WARNING: ignoring --no-kitchen-tests option, RUN_KITCHEN_TESTS is automatically set to true on deploy pipelines",
307+
"WARNING: ignoring --no-e2e-tests option, RUN_E2E_TESTS is automatically set to true on deploy pipelines",
309308
"orange",
310309
)
311310
)
312-
kitchen_tests = True
311+
e2e_tests = True
313312

314313
pipelines = get_running_pipelines_on_same_ref(gitlab, git_ref)
315314

@@ -332,7 +331,6 @@ def run(
332331
repo_branch,
333332
deploy=deploy,
334333
all_builds=all_builds,
335-
kitchen_tests=kitchen_tests,
336334
e2e_tests=e2e_tests,
337335
rc_build=rc_build,
338336
rc_k8s_deployments=rc_k8s_deployments,

0 commit comments

Comments
 (0)