Title / Description
Code --- 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.*$"
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code