Build your first CI/CD pipeline for the telekom-app project: create a .gitlab-ci.yml, watch jobs run, add stages and manual deploys, break things on purpose, and publish artifacts — all inside VS Code and GitLab.
telekom-app project from the Git & GitLab labgit --version in any terminal: Windows, macOS: brew install git, Linux: sudo apt install git-allOpen the project from the previous lab and define your first CI/CD pipeline.
A. Open the project in VS Code:
telekom-app folder you cloned in the Git & GitLab labB. Create the pipeline file:
.gitlab-ci.yml (leading dot!)# First CI/CD pipeline: 2 stages, 3 jobs stages: - build - test build-job: stage: build script: - echo "Building the application…" test-job-1: stage: test script: - echo "Running unit tests…" test-job-2: stage: test script: - echo "Running integration tests…"
build-job runs first; then test-job-1 and test-job-2 run in parallel — jobs in the same stage always run at the same time..gitlab-ci.yml may not appear in some file managers. In the VS Code Explorer it is visible and sorted to the top. GitLab only recognizes the pipeline if the file has this exact name, dot included..gitlab-ci.yml in your workshop-<your_name> branch — pushing is what triggers GitLab.workshop-<your_name> from the previous lab.gitlab-ci.yml: hover over it and click the + (Stage Changes) buttonAdd GitLab CI pipeline and click ✓ Commitworkshop-<your_name>. The pipeline you must verify is the one on your branch, not main and not a teammate’s.test-job-1 and test-job-2 running in paralleldeploy stage yourself and add a job that only runs when a human presses play..gitlab-ci.yml in VS Codestages: list, add - deploy below - test (same indentation — 2 spaces). Your list should end up like this:stages: - build - test - deploy
deploy-production: stage: deploy script: - echo "Deploying to production…" when: manual
Add manual deploy-production job) and pushdeploy-production appears with a ▶ play button instead of runningwhen: manual do? It tells GitLab: never start this job automatically. The job waits in the pipeline view with a ▶ Play button until a human clicks it. This is how teams protect environments like production — code cannot reach production just because someone pushed; a person makes that decision. The rest of the pipeline still runs and passes on its own.rules — and see what happens when the condition is not true.deploy-test: stage: deploy script: - echo "Deploying to the TEST server…" rules: - if: '$CI_COMMIT_BRANCH == "develop"'
Add deploy-test job for develop branch) and pushworkshop-<your_name> branch againwhen: manual — which shows a job that waits — a rules condition that is false removes the job from the pipeline completely. Your branch is not develop, so the condition is false and GitLab acts as if the job never existed.$CI_COMMIT_BRANCH is a variable GitLab injects into every job — it holds the name of the branch being built. The rules keyword evaluates it before the pipeline is created. This is the standard way to deploy different branches to different environments.VERSION file — standard practice for tracking releases:# Quality gate: the VERSION file must exist check-job: stage: test script: - echo "Checking that the VERSION file is present…" - 'test -f VERSION || (echo "ERROR: VERSION file is missing in the repository root" && exit 1)'
Add VERSION check to the pipeline) and pushcheck-job and open the log. Find the error line:ERROR: VERSION file is missing in the repository rootbuild-job passed, but because the test stage failed, the deploy stage never started — a broken commit cannot move forward. This is CI doing its job: fast feedback, minutes after the push.ERROR: …) — in an unquoted YAML value, : (colon + space) starts a new key and makes the configuration invalid.