Siklus CI/CD biasanya dilakukan pada branch development > staging > production. Agar proses pipeline pada masing-masing branch tersebut dapat berjalan mulus perlu dilakukan deklarasi yang jelas pada file .gitlab-ci.yml seperti contoh berikut.
1. Membuat repo pada Gitlab dan branch development, staging dan production. Kemudian membuat file .gitlab-ci.yml.
stages: - stage1 #Development - stage2 #Staging - stage3 #Production Job Development: stage: stage1 script: - echo "Ini branch Development" only: - development Job Staging: stage: stage2 script: - echo "Ini branch Staging" only: - staging Job Production: stage: stage1 script: - echo "Ini branch Production" only: - production
2. Melakukan merger branch ke development, staging dan production. Cek proses pipeline pada Gitlab.
Link Referensi :
https://docs.gitlab.com/ee/ci/yaml/