---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/index.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/ci-cd-ref/index.md
  - href: en/sourcecraft/ci-cd-ref/index.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# CI/CD reference

<!-- source: en/_includes/sourcecraft/ci-cd/config-file-description.md -->
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:

```yaml
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>]

  schedule:
    - workflows: [<list_of_workflows>]
      interval: <execution_interval_in_hours_or_minutes>
      description: <random description>
    - workflows: [<list_of_workflows>]
      cron: "<cron_expression>"
      description: <random description>

workflows:
  <workflow_name>:

    tasks:
      - name: <task_name>
        
        cubes:
          - name: <cube_name>
            image: <Docker_image_path>
            script:
              - <executed_script>
...
```

The configuration may include the following elements:
* [Trigger events](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/on.md) (`on` section)
* [Workflows](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/workflows.md) (`workflows` section)
* [Jobs](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/tasks.md) (`tasks` section)
* [Cubes](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/cubes.md) (`cubes` section)
* [Service connections](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/tokens.md) (`tokens` section)
* [Environment variables](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/env.md) (`env` section)

{% note 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](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/code-navigation.md).

{% endnote %}

You can either use nested structure for configuration elements or mark them up as separate sections.

{% cut "Example of CI/CD configuration marked up as separate sections" %}

```yaml
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
        uses: hello-cube

cubes:
  - name: hello-cube
    script:
      - echo "Hello, world!"
```

{% endcut %}

The configuration file supports [secrets](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/index.md#secrets). Learn more in [Using the value of a secret in CI/CD](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/secrets.md#use-secret-in-ci-cd).
<!-- endsource: en/_includes/sourcecraft/ci-cd/config-file-description.md -->

#### Useful links {#see-also}

* [Repository templates](https://sourcecraft.dev/sourcecraft/repos)
* [Continuous integration and continuous deployment in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md)
* [Configuring CI/CD in a SourceCraft repository](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/ci-cd.md)
* [Configuring CI/CD with Yandex Cloud Functions](https://sourcecraft.dev/portal/docs/en/sourcecraft/tutorials/ci-cd-sourcecraft-functions.md)
* [Predefined environment variables](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/predefined-variables.md)
* [Providing environment variables from one cube to another](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/env-vars-between-cubes.md)
* [Self-hosted worker tags in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/ci-cd-ref/self-hosted-tags.md)