CI/CD reference
The CI/CD configuration is set up for a particular repository and stored in a file named .sourcecraft/ci.yaml.
General format of the .sourcecraft/ci.yaml configuration file:
on:
pull_request:
- workflows: [<list_of_workflows>]
filter:
source_branches: [<list_of_source_branches>]
target_branches: [<list_of_target_branches>]
paths: [<list_of_paths>]
push:
- workflows: [<list_of_workflows>]
filter:
branches: [<list_of_branches>]
paths: [<list_of_paths>]
- workflows: [<list_of_workflows>]
filter:
tags: [<list_of_tags>]
workflows:
<workflow_name>:
tasks:
- name: <task_name>
cubes:
- name: <cube_name>
image: <Docker_image_path>
script:
- <executed_script>
...
Tip
The .sourcecraft/ci.yaml file supports file structure output as well as search for declarations and element usages. For more information, see Navigating and searching by code in SourceCraft.
You can either use nested structure for configuration elements or mark them up as separate sections.
Example of CI/CD configuration marked up as separate sections
on:
pull_request:
- workflows: my-test-workflow
filter:
source_branches: ["**", "!test**"]
target_branches: "main"
workflows:
my-test-workflow:
tasks:
- my-test-task
tasks:
- name: my-test-task
cubes:
- name: my-test-cube
image: docker.io/library/node
script:
- echo Hello, world!
The configuration file supports secrets. For details, see Using the value of a secret in CI/CD.
See the templates repository in SourceCraft for the full specification of the .sourcecraft/ci.yaml file.
Warning
Support for storing configurations for CI/CD, approval rules, and branch policies in a single .src.ci.yaml file at the repository root will soon be discontinued. Use the separate .sourcecraft/ci.yaml, .sourcecraft/review.yaml, and .sourcecraft/branches.yaml files.
The reference describes the following configuration elements:
The reference also includes a list of predefined environment variables you can use in your CI/CD processes.