Using GitLab pipelines in the SourceCraft CI/CD
SourceCraft CI/CD workflows support pipelines with GitLab syntax.
This allows transferring projects from GitLab without any major CI/CD reconfiguration and reusing the extensive library of existing pipeline examples.
Warning
Only cloud workers support running GitHub Actions or GitLab pipelines in SourceCraft CI/CD.
For more information, see GitLab pipelines in the SourceCraft CI/CD.
To use a GitLab pipeline in the SourceCraft CI/CD, do the following:
-
If you do not have a repository yet, create one.
-
Add the
.sourcecraft/.gitlab-ci.yamlfile with your GitLab pipeline contents to the repositorymainbranch.Example of a GitLab pipeilne, .gilab-ci.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."Supported GitLab pipeline syntax elements:
- after_script
- artifacts
- before_script
- image
- include, also for remote files in other repositories and on websites
- needs
- rules
- script
- services
- stage
- stages
- variables
Alert
SourceCraft does not support these GitLab pipeline syntax elements:
-
Similarly, add
.sourcecraft/ci.yamlto themainbranch. To run a GitLab pipeline in the SourceCraft CI/CD, use a cube withgitlab_workflow, like this: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.yamlAs you can see in the example, the CI process will automatically start after committing changes to the
mainbranch. -
Check the CI process:
-
Under
CI/CD on the repository page, go to CI/CD. -
Open a running workflow.
The page that opens will display the workflow tasks, cubes (task steps), as well as statuses and execution results.
-
In the bottom-right corner of the
run-gitlab-workflowcube, click . -
Wait for the workflow to complete.
-
See also
- GitLab pipelines in the SourceCraft CI/CD
- Integration with GitHub Actions in SourceCraft
- Using GitHub Actions in SourceCraft CI/CD
- Setting up CI/CD to deploy an application to Yandex Serverless Containers using GitHub Actions
- Continuous integration and continuous deployment in SourceCraft
- Service connections SourceCraft