GitLab CI/CD — Built-in CI/CD system in GitLab.
1stages:2 - build3 - test4 - deploy_staging5 - deploy_production67cache:8 key: ${CI_COMMIT_REF_SLUG}9 paths:10 - node_modules/1112build:13 stage: build14 image: node:1815 script:16 - npm ci17 - npm run build18 artifacts:19 paths:20 - dist/21 expire_in: 1 hour2223test:unit:24 stage: test25 image: node:1826 script:27 - npm ci28 - npm run test:unit29 coverage: '/Lines\s*:\s*(\d+\.\d+)%/'3031build:docker:32 stage: build33 image: docker:2434 services:35 - docker:24-dind36 before_script:37 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY38 script:39 - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .40 - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA4142deploy_staging:43 stage: deploy_staging44 script:45 - kubectl set image deployment/myapp myapp=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -n staging46 environment:47 name: staging48 url: https://staging.myapp.com49 only:50 - develop5152deploy_production:53 stage: deploy_production54 script:55 - kubectl set image deployment/myapp myapp=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA -n production56 environment:57 name: production58 url: https://myapp.com59 when: manual60 only:61 - main
Key features: Cache, Artifacts, Environments, Rules, Include.