
include: - template: Security/Secret-Detection.gitlab-ci.yml These security jobs run automatically, enforcing "shift-left" security. Environments Track deployments by defining environments:
(set in GitLab UI → Settings → CI/CD → Variables) can be masked or protected for specific branches. 3.2 Conditional Logic with rules The only/except keywords are deprecated in favor of rules .
DevOps emerged to bridge the gap between development and operations. Its core philosophy is — automating builds, tests, deployments, and monitoring. Among the many CI/CD tools available today (Jenkins, CircleCI, GitHub Actions), GitLab CI/CD has emerged as a powerful, integrated, and scalable solution. Why? Because GitLab isn't just a Git repository manager. It's a complete DevOps platform with CI/CD built directly into the same application that hosts your code.
deploy: stage: deploy trigger: project: backend/infra branch: main strategy: depend You can trigger a pipeline via API with a token:
GitLab then shows a dashboard of deployments, and you can roll back from the UI. For secure cluster access, use the GitLab Agent instead of storing kubeconfig .
curl --request POST --form "token=$CI_JOB_TOKEN" --form "ref=main" "https://gitlab.com/api/v4/projects/123/trigger/pipeline" This allows external systems (monitoring, chatops) to start pipelines. DevOps automation must include security. GitLab provides native security scanning. SAST (Static Application Security Testing) Add to your pipeline: