cider-ci dotfile yaml

Yaml code posted
created at 09 Apr 10:24

Edit | Back
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
---
jobs:
  Chain-Dependent-Demo:
    tasks:
      sleep:
        name: Sleep
        scripts:
          main:
            body: sleep 10 && echo "done sleeping"
    description: "This demo can only be started if the \"Chain-Prerequisite-Demoe\"
      has\npassed. There is also a trigger which will start this demo when\nthe prerequisite
      has finished and the commit is part of the head of\na brach matching the given
      regular expression. \n"
    name: Chain-Dependent-Demo
    dependencies:
      jobs:
        Chain-Prerequisite-Demo:
          state: passed
    triggers:
      branch: "^.*$"
  Chain-Prerequisite-Demo:
    tasks:
      sleep:
        name: Sleep
        scripts:
          main:
            body: sleep 10 && echo "done sleeping"
    description: 'This one serves as a prerequisite to the "Chain-Dependent-Demo".

'
    name: Chain-Prerequisite-Demo
  Submodule-Demo:
    tasks:
      submodule-file:
        name: Verify that file in submodule does exist
        scripts:
          main:
            body: test -f submodule/README.mkd
      submodule-ls:
        name: List submodule directory
        scripts:
          main:
            body: ls -lah submodule
      submodule-commit:
        name: Verify proper commit in submodule directory
        scripts:
          main:
            body: cd submodule && test $(git log -n 1 --pretty='%H') == cec555fbe7b525c61c53f5233e4af4d4325732ea
      without-submodule-file:
        name: Verify that file in submodule does not exist if clone is False
        git_options:
          submodules:
            clone: false
        scripts:
          main:
            body: test ! -f submodule/README.mkd
    task_defaults:
      eager_trials: 1
      auto_trials: 2
      traits:
        bash: true
        linux: true
      git_options:
        submodules:
          clone: true
          timeout: 30
    name: Submodule demos and tests
    description: "This job demonstrates  the usage of the `git_options`/`submodule`\nspecification.
      \ It also checks some properties of the checked out\nsubmodules and fails if
      they would not be present. \n"
  Exclusive-Resources-Demo:
    tasks:
      Task1:
        name: Task1 - write timestamps
      Task2:
        name: Task2 - write timestamps
    task_defaults:
      traits:
        linux: true
        bash: true
      exclusive_resources:
        tmp/timestamps.log: true
      trial_attachments:
        logs:
          glob: "/tmp/timestamp.log"
          content-type: text/plain
      scripts:
        main:
          body: |
            echo "$CIDER_CI_TASK_ID $CIDER_CI_TRIAL_ID - START $(date)"  >> /tmp/timestamp.log
            sleep 5
            echo "$CIDER_CI_TASK_ID $CIDER_CI_TRIAL_ID - MIDDLE $(date)"  >> /tmp/timestamp.log
            sleep 5
            echo "$CIDER_CI_TASK_ID $CIDER_CI_TRIAL_ID - END $(date)"  >> /tmp/timestamp.log
    name: Exclusive-Resources Demo
    description: "This job demonstrates the `exclusive_resources` directive.\nTwo
      tasks declare exclusive access to `/tmp/timestamps.log`.  The\n`eager_trials`
      directive is used to generate effectively four trials.  At\nany time at **most
      one** trial is _executing_. This can be verified by\nthe timestamps in the attachments.
      \n"
  Ports-Demo:
    task_defaults:
      traits:
        linux: true
        bash: true
    description: |
      This job demonstrates the usage of the `ports` directive.  The
      output of `env | sort` shows the assigned port as the value of the given
      name.
    tasks:
      Ports-Demo:
        name: Ports Demo
        description: This task demonstrates the `ports` property.
        ports:
          XVNC_PORT:
            inet_address: localhost
            min: 5900
            max: 5999
        scripts:
          list:
            body: env | sort
          test:
            body: echo ${XVNC_PORT? "XVNC_PORT is not set!"}
  Info:
    task_defaults:
      traits:
        linux: true
        bash: true
    description: |
      This job runs a few tasks which show various information, e.g.
      `ls`, `git log`, ...
    name: Show info
    tasks:
      git:
        name: Show the last three commits
        scripts:
          main:
            body: git log -n3
      env:
        name: List environment variables
        scripts:
          main:
            body: env | sort
      fun:
        name: Show declared functions
        scripts:
          main:
            body: declare -F | sort
      ls:
        name: List the top level project directory
        scripts:
          main:
            body: ls -lah
  Script-Dependencies-Demo:
    task_defaults:
      traits:
        linux: true
        bash: true
    script_defaults:
      body: echo $(date) && sleep 3 && echo $(date) && test a = a
    tasks:
      task-dependencies:
        scripts:
          script-root: {}
          script-depending-passed-root:
            dependencies:
              scripts:
                script-root:
                  state: passed
          script-failing:
            body: echo $(date) && sleep 3 && echo $(date) && test a = b
            ignore_state: true
            dependencies:
              scripts:
                script-root:
                  state: passed
          script-depend-failing-failed:
            dependencies:
              scripts:
                script-failing:
                  state: failed
          script-depend-failing-passed:
            ignore_state: true
            dependencies:
              scripts:
                script-failing:
                  state: passed
  Result-Demo:
    task_defaults:
      traits:
        linux: true
        bash: true
    description: "This job creates the specially treated `result.json` file with\n`value`,
      and `summary` properties.  It also attaches the `result.json` by\nthe `trial_attachments`
      directive. \n"
    name: Result Demo
    tasks:
      result:
        name: Result Embedding Demo
        description: "This tasks creates a result.json file and demonstrates the embedding
          of the contents as the result in script, and task.  The result property
          is available in the job if and only if it contains exactly this task and
          no further.  \n"
        trial_attachments:
          result_file:
            glob: result.json
            content-type: application/json
        scripts:
          main:
            body: "./bin/create-result-json"
  Environment-Variables-Demo:
    description: "This job Demonstrates the usage of the `environment_variables`\ndirective.
      \ It specifies a tasks which lists the environment variables\nwith `env | sort`.
      \n"
    name: Environment Variables Demo
    task_defaults:
      traits:
        linux: true
        bash: true
      environment_variables:
        CI_TASK_DEFAULTS: Inherited!
    tasks:
      env_vars:
        name: Set and Show Environment Variables
        environment_variables:
          CI_THE_ANSWER: 42
          CI_NULL_ENV_VAR: 
          CI_BOOL_ENV_VAR: false
        scripts:
          main:
            body: env | sort
  Attachments-Demo:
    task_defaults:
      traits:
        linux: true
        bash: true
    description: "This job demonstrates the usage of the `tree_attachments` and\n`trial_attachments`
      directive.  It creates a file which is then attached\nas a tree- as well as
      a trial-attachment. \n"
    name: Attachments Demo
    tasks:
      Attachments-Demo:
        name: Attachments Demo
        trial_attachments:
          logs:
            glob: tmp/*trial*.txt
            content-type: text/plain
        tree_attachments:
          logs:
            glob: tmp/*tree*.txt
            content-type: text/plain
        scripts:
          trial-attachment:
            body: 'mkdir -p tmp && echo ''I am a trial attachment!'' > tmp/a-trial-attachment.txt

'
          tree-attachment:
            body: 'mkdir -p tmp && echo ''I am a tree attachment!'' > tmp/a-tree-attachment.txt

'
  Tests:
    tasks:
      sleep3min:
        name: Just sleeping three minutes
        scripts:
          main:
            body: sleep 180 && exit 0
      sleep2min:
        name: Just sleeping two minutes
        scripts:
          main:
            body: sleep 120 && exit 0
      sleep1min:
        name: Just sleeping a minute
        scripts:
          main:
            body: sleep 60 && exit 0
      sleeprand:
        name: Timeout for a randomly sleeping bash script
        scripts:
          main:
            body: "./bin/sleeping-randomly-long"
            timeout: 40
      failrand:
        name: Success with exactly p=1/7
        eager_trials: 3
        auto_trials: 10
        scripts:
          main:
            body: "./bin/randomly-failing"
    task_defaults:
      eager_trials: 1
      auto_trials: 2
      traits:
        linux: true
    name: Run tests
    description: 'This jobs runs several bash scripts. Some of them sleep for a while.  Some
      of them fail with a certain probability.  One of them combines both by using
      the `timeout` directive of a script.

'
  Trigger-Demo:
    tasks:
      sleep:
        name: Sleep
        scripts:
          main:
            body: sleep 10 && echo "done sleeping"
    description: "This job will be automatically run when a commit containing\nit
      becomes the head of a branch which name matches /^.*trigger.*$/. \nThe `trigger`
      property accepts the same values as the `dependencies` property.\n"
    triggers:
      branch: "^.*trigger.*$"
9.63 KB in 9 ms with coderay