-
Notifications
You must be signed in to change notification settings - Fork 361
/
Copy pathconfig.yml
88 lines (79 loc) · 2.44 KB
/
config.yml
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
---
# currently just a thin wrapper around real_config to add dynamic parameters
version: '2.1'
setup: true
orbs:
continuation: circleci/continuation@1.0.0
gh: circleci/github-cli@2.0
parameters:
workspace_path:
type: string
default: '/tmp/workspace'
params_basename:
type: string
default: params.json
all-filters: &all-filters
branches:
only:
- /.*/
tags:
only:
- /.*/
workflows:
determined_ai:
jobs:
- set_up_param_file:
filters: *all-filters
context:
- github-read
- exec_config:
filters: *all-filters
requires:
- set_up_param_file
jobs:
exec_config:
executor: continuation/default
steps:
- checkout
- attach_workspace:
at: '<<pipeline.parameters.workspace_path>>'
- continuation/continue:
configuration_path: .circleci/real_config.yml
parameters: '<<pipeline.parameters.workspace_path>>/<<pipeline.parameters.params_basename>>'
set_up_param_file:
docker:
- image: cimg/base:stable
steps:
- gh/install
- checkout
# this must be first; default to an empty params list
- run:
name: clear param file
command: echo '{}' > "<<pipeline.parameters.params_basename>>"
# add whatever parameters are needed.
# repeating keys is ok, since jq will either add or overwrite
- run:
name: Check for scheduled nightly run
command: |
if [[ "scheduled_pipeline" == "<<pipeline.trigger_source>>"
&& "nightly_tests" == "<<pipeline.schedule.name>>"
]]
then
# add the parameter(s) to the temp file
jq '. += {"do_nightly_tests": true}' < "<<pipeline.parameters.params_basename>>" > tmpfile
mv -v tmpfile "<<pipeline.parameters.params_basename>>"
fi
- run:
name: Check for labeled nightly run
command: |
if gh pr view --json labels --jq ".labels[].name" \
| grep -w "ci-run-nightly"
then
jq '. += {"do_nightly_tests": true}' < "<<pipeline.parameters.params_basename>>" > tmpfile
mv -v tmpfile "<<pipeline.parameters.params_basename>>"
fi
# this must be last; persist the file to the workspace
- persist_to_workspace:
root: .
paths:
- '<<pipeline.parameters.params_basename>>'