---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/gl-pipelines.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/concepts/gl-pipelines.md
  - href: https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/gl-pipelines.md
    type: text/markdown
    title: Markdown version
  - href: https://sourcecraft.dev/portal/docs/en/llms.txt
    type: text/markdown
    title: llms.txt
title: GitLab pipelines in the SourceCraft CI/CD
description: How to use GitLab pipelines in SourceCraft CI/CD workflows to automate builds and testing.
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt


# GitLab pipelines in the SourceCraft CI/CD

<!-- source: en/_includes/sourcecraft/ci-cd/gl-pipelines-intro.md -->
[SourceCraft CI/CD](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md) workflows support [pipelines](https://docs.gitlab.com/ci/pipelines/) with [GitLab syntax](https://docs.gitlab.com/ci/yaml/).

This allows transferring projects from GitLab without any major CI/CD reconfiguration and reusing the extensive library of existing pipeline examples.
<!-- endsource: en/_includes/sourcecraft/ci-cd/gl-pipelines-intro.md -->

<!-- source: en/_includes/sourcecraft/ci-cd/gh-gl-cloud-workers.md -->
{% note warning %}

Only [cloud workers](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/workers.md#cloud-workers) support running GitHub Actions or GitLab pipelines in SourceCraft CI/CD.

{% endnote %}
<!-- endsource: en/_includes/sourcecraft/ci-cd/gh-gl-cloud-workers.md -->

GitLab pipelines are embedded into the CI/CD configuration, `.sourcecraft/ci.yaml`, as separate [cubes](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md#cubes) with the `gitlab_workflow` parameter. For example:

<!-- source: en/_includes/sourcecraft/ci-cd/gl-pipeline-in-cube-example.md -->
```yaml
on:
  push:
    - workflows: [sample-workflow]
      filter:
        branches: ["main"]

workflows:
  sample-workflow:
    tasks:
      - name: demo-gitlab-ci
        cubes:
          - name: run-gitlab-workflow
            # Path to the GitLab pipeline configuration file
            gitlab_workflow: .sourcecraft/.gitlab-ci.yaml
```
<!-- endsource: en/_includes/sourcecraft/ci-cd/gl-pipeline-in-cube-example.md -->

<!-- source: en/_includes/sourcecraft/ci-cd/gl-pipeline-example.md -->
{% cut "Example of a GitLab pipeilne, .gilab-ci.yaml" %}

```yaml
build-job:
  stage: build
  script:
    - echo "Hello, GitLab CI/CD!"

test-job1:
  stage: test
  script:
    - echo "This job tests something"

test-job2:
  stage: test
  script:
    - echo "This job tests something, but takes more time than test-job1."
    - echo "After the echo commands complete, it runs the sleep command for 20 seconds"
    - echo "which simulates a test that runs 20 seconds longer than test-job1"
    - sleep 20

deploy-prod:
  stage: deploy
  script:
    - echo "This job deploys something."
```

{% endcut %}

Supported [GitLab pipeline syntax](https://docs.gitlab.com/ci/yaml/) elements:
* [after_script](https://docs.gitlab.com/ci/yaml/#after_script)
* [artifacts](https://docs.gitlab.com/ci/yaml/#artifacts)
* [before_script](https://docs.gitlab.com/ci/yaml/#before_script)
* [image](https://docs.gitlab.com/ci/yaml/#image)
* [include](https://docs.gitlab.com/ci/yaml/#include), also for remote files in other repositories and on websites
* [needs](https://docs.gitlab.com/ci/yaml/#needs)
* [rules](https://docs.gitlab.com/ci/yaml/#rules)
* [script](https://docs.gitlab.com/ci/yaml/#script)
* [services](https://docs.gitlab.com/ci/yaml/#services)
* [stage](https://docs.gitlab.com/ci/yaml/#stage)
* [stages](https://docs.gitlab.com/ci/yaml/#stages)
* [variables](https://docs.gitlab.com/ci/yaml/#job-variables)

{% note alert %}

SourceCraft does not support these GitLab pipeline syntax elements:
* [environment](https://docs.gitlab.com/ci/yaml/#environment)
* [pages](https://docs.gitlab.com/ci/yaml/#pages)
* [release](https://docs.gitlab.com/ci/yaml/#release)
* [resource_group](https://docs.gitlab.com/ci/yaml/#resource_group)
* [trigger](https://docs.gitlab.com/ci/yaml/#trigger)

{% endnote %}
<!-- endsource: en/_includes/sourcecraft/ci-cd/gl-pipeline-example.md -->

<!-- source: en/_includes/sourcecraft/configuration-tip.md -->
{% note tip %}

You can set up and view repository configurations in the SourceCraft interface under ![image](../../_assets/console-icons/gear.svg) **Repository settings** in the ![image](../../_assets/console-icons/nut-hex.svg) **Configurations** section. Learn more in [this article](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/configuration-edit.md).

{% endnote %}
<!-- endsource: en/_includes/sourcecraft/configuration-tip.md -->

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

* [Using GitLab pipelines in the SourceCraft CI/CD](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/gl-pipelines.md)
* [Integration with GitHub Actions in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/gh-actions.md)
* [Using GitHub Actions in SourceCraft CI/CD](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/gh-actions.md)
* [Setting up CI/CD to deploy an application to Yandex Serverless Containers using GitHub Actions](https://sourcecraft.dev/portal/docs/en/sourcecraft/tutorials/ci-cd-sourcecraft-github-actions.md)
* [Continuous integration and continuous deployment in SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/ci-cd.md)
* [Service connections SourceCraft](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/service-connections.md)