Mataki 1: Ƙirƙiri Aiki akan GitLab
Shiga cikin asusun GitLab na ku.
A kan babban haɗin gwiwar GitLab, za ku sami New Project
maɓalli ko alamar "+" a kusurwar sama-dama. Danna kan shi don ƙirƙirar sabon aiki.
Mataki 2: Ƙirƙiri .gitlab-ci.yml
Fayil
Bayan ƙirƙirar aikin, shiga shafin aikin.
A cikin menu na hannun hagu, zaɓi " Repository
don buɗe shafin sarrafa lambar tushe.
Danna New file
maballin don ƙirƙirar sabon fayil kuma suna suna .gitlab-ci.yml
.
Mataki 3: Sanya .gitlab-ci.yml
don Aiki na CI / CD na Asali
Ga misalin .gitlab-ci.yml
fayil tare da takamaiman matakai don aikin CI/CD:
stages:
- build
- test
- deploy
build_job:
stage: build
script:
- echo "Building the application..."
# Add steps to build the application, e.g., compile, build artifacts, etc.
test_job:
stage: test
script:
- echo "Running tests..."
# Add steps to run automated tests, e.g., unit tests, integration tests, etc.
deploy_job:
stage: deploy
script:
- echo "Deploying the application..."
# Add steps to deploy the application, e.g., deploy to staging/production servers.
# Configuration to deploy only on changes to the master branch
only_master:
only:
- master
Mataki 4: Haɗa CI/CD akan GitLab
Lokacin da kuka tura lamba zuwa ma'ajiyar GitLab(misali, ƙara, gyara, ko share fayilolin lamba), GitLab zai fara aiwatar da CI/CD ta atomatik dangane da fayil ɗin .gitlab-ci.yml
.
Kowane mataki( build
,) zai gudana a jere, test
yana deploy
yin ayyukan da aka ayyana.
Mataki 5: Duba Sakamakon CI/CD
A cikin shafin GitLab na aikin, zaɓi shafin "CI/CD" don duba duk ayyukan CI/CD da aka kashe.
Kuna iya ganin tarihin gudu, lokaci, sakamako, kuma idan akwai kurakurai, sanarwar kuskure za a nuna a nan.
Lura: Wannan misali ne mai sauƙi. A hakikanin gaskiya, CI/CD ayyukan aiki na iya zama mafi rikitarwa kuma sun haɗa da matakai da yawa kamar binciken tsaro, gwajin aiki, gwajin haɗin kai, da ƙari. Kuna buƙatar zurfafa zurfafa cikin daidaitawa da daidaita GitLab CI/CD don buƙatun aikinku.