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.
GitLab pipelines are embedded into the CI/CD configuration, .sourcecraft/ci.yaml, as separate cubes with the gitlab_workflow parameter. For example:
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
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:
See also
Was the article helpful?
Previous
Next