Skip to content

Commit ed38f37

Browse files
committed
CI: Add Non-blocking (Woolen wolfdog) CI mode
1 parent 909b4ae commit ed38f37

File tree

8 files changed

+52
-6
lines changed

8 files changed

+52
-6
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ At a minimum, the following information should be added (but add more as needed)
4949
- [ ] <!---ci_include_integration--> Allow: Integration Tests
5050
- [ ] <!---ci_include_performance--> Allow: Performance tests
5151
- [ ] <!---ci_set_builds--> Allow: All Builds
52-
- [ ] <!---ci_set_non_required--> Allow: All NOT Required Checks
5352
- [ ] <!---batch_0_1--> Allow: batch 1, 2 for multi-batch jobs
5453
- [ ] <!---batch_2_3--> Allow: batch 3, 4, 5, 6 for multi-batch jobs
5554
---
@@ -60,6 +59,7 @@ At a minimum, the following information should be added (but add more as needed)
6059
- [ ] <!---ci_exclude_aarch64|release|debug--> Exclude: All with aarch64, release, debug
6160
---
6261
- [ ] <!---do_not_test--> Do not test
62+
- [ ] <!---woolen_wolfdog--> Woolen Wolfdog
6363
- [ ] <!---upload_all--> Upload binaries for special builds
6464
- [ ] <!---no_merge_commit--> Disable merge-commit
6565
- [ ] <!---no_ci_cache--> Disable CI cache

.github/workflows/pull_request.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ jobs:
126126
with:
127127
stage: Builds_2
128128
data: ${{ needs.RunConfig.outputs.data }}
129+
# stage for running non-required checks without being blocked by required checks (Test_1) if corresponding settings is selected
129130
Tests_2:
130-
needs: [RunConfig, Builds_2]
131+
needs: [RunConfig, Builds_1]
131132
if: ${{ !failure() && !cancelled() && contains(fromJson(needs.RunConfig.outputs.data).stages_data.stages_to_do, 'Tests_2') }}
132133
uses: ./.github/workflows/reusable_test_stage.yml
133134
with:

tests/ci/ci.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ def _configure_jobs(
462462
return ci_cache
463463

464464

465-
def _generate_ci_stage_config(jobs_data: Dict[str, Any]) -> Dict[str, Dict[str, Any]]:
465+
def _generate_ci_stage_config(
466+
jobs_data: Dict[str, Any], non_blocking_mode: bool = False
467+
) -> Dict[str, Dict[str, Any]]:
466468
"""
467469
populates GH Actions' workflow with real jobs
468470
"Builds_1": [{"job_name": NAME, "runner_type": RUNNER_TYPE}]
@@ -472,7 +474,7 @@ def _generate_ci_stage_config(jobs_data: Dict[str, Any]) -> Dict[str, Dict[str,
472474
result = {} # type: Dict[str, Any]
473475
stages_to_do = []
474476
for job in jobs_data:
475-
stage_type = CI.get_job_ci_stage(job)
477+
stage_type = CI.get_job_ci_stage(job, non_blocking_ci=non_blocking_mode)
476478
if stage_type == CI.WorkflowStages.NA:
477479
continue
478480
if stage_type not in result:
@@ -1007,7 +1009,9 @@ def main() -> int:
10071009
result["docs"] = ci_cache.job_digests[CI.JobNames.DOCS_CHECK]
10081010
result["ci_settings"] = ci_settings.as_dict()
10091011
if not args.skip_jobs:
1010-
result["stages_data"] = _generate_ci_stage_config(ci_cache.jobs_to_do)
1012+
result["stages_data"] = _generate_ci_stage_config(
1013+
ci_cache.jobs_to_do, ci_settings.woolen_wolfdog
1014+
)
10111015
result["jobs_data"] = {
10121016
"jobs_to_do": list(ci_cache.jobs_to_do),
10131017
"jobs_to_skip": ci_cache.jobs_to_skip,

tests/ci/ci_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ def get_tag_config(cls, label_name: str) -> Optional[LabelConfig]:
545545
return None
546546

547547
@classmethod
548-
def get_job_ci_stage(cls, job_name: str) -> str:
548+
def get_job_ci_stage(cls, job_name: str, non_blocking_ci: bool = False) -> str:
549549
if job_name in [
550550
JobNames.STYLE_CHECK,
551551
JobNames.FAST_TEST,
@@ -572,6 +572,8 @@ def get_job_ci_stage(cls, job_name: str) -> str:
572572
else:
573573
stage_type = WorkflowStages.TESTS_3
574574
assert stage_type, f"BUG [{job_name}]"
575+
if non_blocking_ci and stage_type == WorkflowStages.TESTS_3:
576+
stage_type = WorkflowStages.TESTS_2
575577
return stage_type
576578

577579
@classmethod

tests/ci/ci_definitions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Tags(metaclass=WithIter):
4646
"""
4747

4848
DO_NOT_TEST_LABEL = "do_not_test"
49+
WOOLEN_WOLFDOG_LABEL = "woolen_wolfdog"
4950
NO_MERGE_COMMIT = "no_merge_commit"
5051
NO_CI_CACHE = "no_ci_cache"
5152
# to upload all binaries from build jobs

tests/ci/ci_settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class CiSettings:
2929
no_ci_cache: bool = False
3030
upload_all: bool = False
3131
no_merge_commit: bool = False
32+
woolen_wolfdog: bool = False
3233

3334
def as_dict(self) -> Dict[str, Any]:
3435
return asdict(self)
@@ -108,6 +109,9 @@ def create_from_pr_message(
108109
elif match == CI.Tags.NO_MERGE_COMMIT:
109110
res.no_merge_commit = True
110111
print("NOTE: Merge Commit will be disabled")
112+
elif match == CI.Tags.WOOLEN_WOLFDOG_LABEL:
113+
res.woolen_wolfdog = True
114+
print("NOTE: Woolen Wolfdog mode enabled")
111115
elif match.startswith("batch_"):
112116
batches = []
113117
try:

tests/ci/test_ci_config.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,37 @@ def test_job_stage_config(self):
201201
msg=f"Stage for [{job}] is not correct",
202202
)
203203

204+
def test_job_stage_config_non_blocking(self):
205+
"""
206+
check runner is provided w/o exception
207+
"""
208+
# check stages
209+
for job in CI.JobNames:
210+
if job in CI.BuildNames:
211+
self.assertTrue(
212+
CI.get_job_ci_stage(job)
213+
in (CI.WorkflowStages.BUILDS_1, CI.WorkflowStages.BUILDS_2)
214+
)
215+
else:
216+
if job in (
217+
CI.JobNames.STYLE_CHECK,
218+
CI.JobNames.FAST_TEST,
219+
CI.JobNames.JEPSEN_SERVER,
220+
CI.JobNames.JEPSEN_KEEPER,
221+
CI.JobNames.BUILD_CHECK,
222+
):
223+
self.assertEqual(
224+
CI.get_job_ci_stage(job),
225+
CI.WorkflowStages.NA,
226+
msg=f"Stage for [{job}] is not correct",
227+
)
228+
else:
229+
self.assertTrue(
230+
CI.get_job_ci_stage(job, non_blocking_ci=True)
231+
in (CI.WorkflowStages.TESTS_1, CI.WorkflowStages.TESTS_2),
232+
msg=f"Stage for [{job}] is not correct",
233+
)
234+
204235
def test_build_jobs_configs(self):
205236
"""
206237
check build jobs have non-None build_config attribute

tests/ci/test_ci_options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
2020
#### CI options:
2121
- [ ] <!---do_not_test--> do not test (only style check)
22+
- [x] <!---woolen_wolfdog--> Woolen Wolfdog CI
2223
- [x] <!---no_merge_commit--> disable merge-commit (no merge from master before tests)
2324
- [ ] <!---no_ci_cache--> disable CI cache (job reuse)
2425
@@ -148,6 +149,7 @@ def test_pr_body_parsing(self):
148149
self.assertFalse(ci_options.do_not_test)
149150
self.assertFalse(ci_options.no_ci_cache)
150151
self.assertTrue(ci_options.no_merge_commit)
152+
self.assertTrue(ci_options.woolen_wolfdog)
151153
self.assertEqual(ci_options.ci_sets, ["ci_set_non_required"])
152154
self.assertCountEqual(ci_options.include_keywords, ["foo", "foo_bar"])
153155
self.assertCountEqual(ci_options.exclude_keywords, ["foo", "foo_bar"])
@@ -157,6 +159,7 @@ def test_options_applied(self):
157159
ci_options = CiSettings.create_from_pr_message(
158160
_TEST_BODY_2, update_from_api=False
159161
)
162+
self.assertFalse(ci_options.woolen_wolfdog)
160163
self.assertCountEqual(
161164
ci_options.include_keywords,
162165
["integration", "foo_bar", "stateless", "azure"],

0 commit comments

Comments
 (0)