Skip to content

Commit c79bf57

Browse files
authored
Reduce number of jobs running in Circle CI (#8643)
* Skip Circle CI if only GitLab files change * Disable flaky jobs in master * Move jdk 11 jobs to master-only in Circle CI * Move ssi_smoke tests to master-only in Circle CI
1 parent 7580e7b commit c79bf57

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

.circleci/config.continue.yml.j2

+17
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,7 @@ build_test_jobs: &build_test_jobs
13331333
matrix:
13341334
<<: *test_matrix
13351335
1336+
{% if ssi_smoke %}
13361337
- tests:
13371338
requires:
13381339
- ok_to_test
@@ -1346,6 +1347,7 @@ build_test_jobs: &build_test_jobs
13461347
maxWorkers: 3
13471348
matrix:
13481349
<<: *test_matrix
1350+
{% endif %}
13491351
13501352
- tests:
13511353
requires:
@@ -1389,6 +1391,7 @@ build_test_jobs: &build_test_jobs
13891391
maxWorkers: 3
13901392
testJvm: "8"
13911393
1394+
{% if ssi_smoke %}
13921395
- tests:
13931396
requires:
13941397
- ok_to_test
@@ -1401,13 +1404,16 @@ build_test_jobs: &build_test_jobs
14011404
parallelism: 4
14021405
maxWorkers: 3
14031406
testJvm: "8"
1407+
{% endif %}
14041408
14051409
- fan_in:
14061410
requires:
14071411
- z_test_<< matrix.testJvm >>_base
14081412
- z_test_<< matrix.testJvm >>_inst
14091413
- z_test_<< matrix.testJvm >>_smoke
1414+
{% if ssi_smoke %}
14101415
- z_test_<< matrix.testJvm >>_ssi_smoke
1416+
{% endif %}
14111417
name: test_<< matrix.testJvm >>
14121418
stage: tracing
14131419
matrix:
@@ -1418,7 +1424,9 @@ build_test_jobs: &build_test_jobs
14181424
- z_test_8_base
14191425
- z_test_8_inst
14201426
- z_test_8_smoke
1427+
{% if ssi_smoke %}
14211428
- z_test_8_ssi_smoke
1429+
{% endif %}
14221430
name: test_8
14231431
stage: tracing
14241432
testJvm: "8"
@@ -1512,6 +1520,14 @@ build_test_jobs: &build_test_jobs
15121520
stage: required
15131521
15141522
workflows:
1523+
{% if skip_circleci %}
1524+
build_test:
1525+
jobs:
1526+
# Just a "required" job to make GitHub PR checks happy, and run nothing else.
1527+
- fan_in:
1528+
name: required
1529+
stage: required
1530+
{% else %}
15151531
{% if is_regular %}
15161532
build_test:
15171533
jobs:
@@ -1552,3 +1568,4 @@ workflows:
15521568
gradleTarget: :profilingTest
15531569
cacheType: profiling
15541570
{% endif %}
1571+
{% endif %}

.circleci/no_circleci_changes.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
git diff --name-only "$1" | grep --invert-match --quiet -E '^(.gitlab-ci.yml|.gitlab)'

.circleci/render_config.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
import os.path
5+
import subprocess
56
import time
67

78
import jinja2
@@ -14,9 +15,10 @@
1415
GENERATED_CONFIG_PATH = os.path.join(SCRIPT_DIR, OUT_FILENAME)
1516

1617
# JDKs that will run on every pipeline.
17-
ALWAYS_ON_JDKS = {"8", "11", "17", "21"}
18+
ALWAYS_ON_JDKS = {"8", "17", "21"}
1819
# And these will run only in master and release/ branches.
1920
MASTER_ONLY_JDKS = {
21+
"11",
2022
"ibm8",
2123
"oracle8",
2224
"semeru8",
@@ -74,6 +76,13 @@
7476
run_all = "all" in labels
7577
is_master_or_release = branch == "master" or branch.startswith("release/v")
7678

79+
skip_circleci = False
80+
if pr_base_ref:
81+
ret = subprocess.call([".circleci/no_circleci_changes.sh", f"{pr_base_ref}..HEAD"], shell=False)
82+
if ret == 1:
83+
# Only GitLab-related files have changed, just skip Circle CI jobs.
84+
skip_circleci = True
85+
7786
if is_master_or_release or run_all:
7887
all_jdks = ALWAYS_ON_JDKS | MASTER_ONLY_JDKS
7988
else:
@@ -99,10 +108,12 @@
99108
"all_jdks": all_jdks,
100109
"all_debugger_jdks": all_debugger_jdks,
101110
"nocov_jdks": nocov_jdks,
102-
"flaky": branch == "master" or "flaky" in labels or "all" in labels,
111+
"flaky": "flaky" in labels or "all" in labels,
103112
"docker_image_prefix": "" if is_nightly else f"{DOCKER_IMAGE_VERSION}-",
104113
"use_git_changes": use_git_changes,
105114
"pr_base_ref": pr_base_ref,
115+
"skip_circleci": skip_circleci,
116+
"ssi_smoke": is_regular and is_master_or_release
106117
}
107118

108119
print(f"Variables for this build: {vars}")

0 commit comments

Comments
 (0)