Skip to content

Commit bb95c7a

Browse files
authored
Fix CI triggers with dynamic config (DataDog#5773)
Regular triggers do not play well with dynamic config in Circle CI. We need to use pipeline triggers at: https://app.circleci.com/settings/project/github/DataDog/dd-trace-java/triggers
1 parent 1689d5c commit bb95c7a

3 files changed

Lines changed: 33 additions & 20 deletions

File tree

.circleci/config.continue.yml.j2

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ profiling_modules: &profiling_modules "dd-java-agent/agent-profiling"
3232
default_system_tests_commit: &default_system_tests_commit 9659a5e409cf8bacabd739b6af07c5f03c9bcbd6
3333

3434
parameters:
35+
nightly:
36+
type: boolean
37+
default: false
38+
weekly:
39+
type: boolean
40+
default: false
41+
3542
gradle_flags:
3643
# Using no-daemon is important for the caches to be in a consistent state
3744
type: string
@@ -1248,32 +1255,18 @@ build_test_jobs: &build_test_jobs
12481255
stage: required
12491256
12501257
workflows:
1258+
{% if is_regular %}
12511259
build_test:
12521260
jobs:
12531261
*build_test_jobs
1254-
1262+
{% endif %}
1263+
{% if is_nightly %}
12551264
nightly:
1256-
triggers:
1257-
- schedule:
1258-
# Run this job at 00:35 UTC every day
1259-
# The 30 minutes will allow weekly to finish before nightly is triggered on Mondays
1260-
cron: "35 0 * * *"
1261-
filters:
1262-
branches:
1263-
only:
1264-
- master
12651265
jobs:
12661266
*build_test_jobs
1267-
1267+
{% endif %}
1268+
{% if is_weekly %}
12681269
weekly:
1269-
triggers:
1270-
- schedule:
1271-
# Run this job at 00:05 UTC every Monday
1272-
cron: "5 0 * * 1"
1273-
filters:
1274-
branches:
1275-
only:
1276-
- master
12771270
jobs:
12781271
# This will rebuild a main caches with a new timestamp from a clean slate
12791272
- build_clean_cache:
@@ -1301,3 +1294,4 @@ workflows:
13011294
name: build_cache_profiling
13021295
gradleTarget: :profilingTest
13031296
cacheType: profiling
1297+
{% endif %}

.circleci/config.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
version: 2.1
22
setup: true
33
python310_image: &python310_image cimg/python:3.10
4+
parameters:
5+
nightly:
6+
type: boolean
7+
default: false
8+
weekly:
9+
type: boolean
10+
default: false
411
orbs:
512
continuation: circleci/continuation@0.1.2
613
executors:
@@ -18,7 +25,10 @@ jobs:
1825
command: pip3 install jinja2 requests
1926
- run:
2027
name: Generate config
21-
command: .circleci/render_config.py
28+
command: >-
29+
CIRCLE_IS_NIGHTLY="<< pipeline.parameters.nightly >>"
30+
CIRCLE_IS_WEEKLY="<< pipeline.parameters.weekly >>"
31+
.circleci/render_config.py
2232
- continuation/continue:
2333
configuration_path: .circleci/config.continue.yml
2434
workflows:

.circleci/render_config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,16 @@
7171
all_jdks = ALWAYS_ON_JDKS | (MASTER_ONLY_JDKS & labels)
7272
nocov_jdks = [j for j in all_jdks if j != "8"]
7373

74+
# Is this a nightly or weekly build? These environment variables are set in
75+
# config.yml based on pipeline parameters.
76+
is_nightly = os.environ.get("CIRCLE_IS_NIGHTLY", "false") == "true"
77+
is_weekly = os.environ.get("CIRCLE_IS_WEEKLY", "false") == "true"
78+
is_regular = not is_nightly and not is_weekly
79+
7480
vars = {
81+
"is_nightly": is_nightly,
82+
"is_weekly": is_weekly,
83+
"is_regular": is_regular,
7584
"all_jdks": all_jdks,
7685
"nocov_jdks": nocov_jdks,
7786
"flaky": branch == "master" or "flaky" in labels or "all" in labels,

0 commit comments

Comments
 (0)