Enwere ike ịtọ mgbanwe dị na Gitlab n'ọtụtụ ebe:
- N'ime ntọala otu
- Na ntọala oru ngo
- N'ime .gitlab-ci.yml
N'okwu a, enwere ike ịtọ mgbanwe dị na otu na ntọala oru ngo dị ka "faịlụ" ma ọ bụ "mgbanwe oge niile" wee lelee igbe nlele "echekwabara" na "mask".
Ka anyị malite na ihe nketa dị mfe ma ọ ga-eji nwayọọ nwayọọ na-adịwanye mgbagwoju anya.
Enwere ike ịchọta ndepụta ikpeazụ nke ọkwa dị mkpa na njedebe nke akwụkwọ ahụ.
Ihe nketa nwere otu [isi mmalite]
A na-eketa mgbanwe dị iche iche site na otu dị iche iche, na-achị na ka otu ahụ dị nso na ọrụ ahụ, otú ahụ ka uru ya dị mkpa karị.
Otu dị iche iche nwere mgbanwe
.gitlab-ci.yml
image: busybox:latest
variables:
GIT_STRATEGY: none
echo:
stage: test
script:
- echo $MSG
Nsonaazụ pipeline
$ echo $MSG
B
Ọ bụrụ na akọwapụtaghị mgbanwe mgbanwe na otu B, mgbe ahụ anyị gaara ahụ uru A.
Na-eketa mgbanwe n'ime .gitlab-ci.yml [isi mmalite]
Ihe niile dị nnọọ mfe ebe a: ị nwere ike ịtọ mgbanwe n'ụwa nile, ma ọ bụ ị nwere ike degharịa ya n'ime ọrụ.
Otu dị iche iche nwere mgbanwe
.gitlab-ci.yml
Ka anyị mepụta ọrụ 2 ugbu a, n'ime otu n'ime ha, anyị ga-egosi $MSG nke ọma.
image: busybox:latest
variables:
GIT_STRATEGY: none
MSG: "Custom in global .gitlab-ci.yml"
echo:
stage: test
script:
- echo $MSG
echo with var:
stage: test
variables:
MSG: "Custom in job .gitlab-ci.yml"
script:
- echo $MSG
Nsonaazụ pipeline
- ikwughachi:
$ echo $MSG Custom in global .gitlab-ci.yml Job succeeded
- ikwughachi na vars:
$ echo $MSG Custom in job .gitlab-ci.yml Job succeeded
Ihe nketa nwere otu na n'ime .gitlab-ci.yml [isi mmalite]
Ka anyị gbalịa ikpokọta ihe atụ 2 gara aga. Ndị mgbanwe otu na-ebute ụzọ karịa mgbanwe dị n'ime .gitlab-ci.yml.
Otu dị iche iche nwere mgbanwe
.gitlab-ci.yml
image: busybox:latest
variables:
GIT_STRATEGY: none
MSG: "Custom in global .gitlab-ci.yml"
echo:
stage: test
script:
- echo $MSG
echo with var:
stage: test
variables:
MSG: "Custom in job .gitlab-ci.yml"
script:
- echo $MSG
Nsonaazụ pipeline
- ikwughachi:
$ echo $MSG Y Job succeeded
- ikwughachi na vars:
$ echo $MSG Y Job succeeded
Ihe nketa nwere nkọwapụta mgbanwe na ntọala oru ngo [isi mmalite]
Mgbanwe dị na ntọala oru ngo na-enwe ihe kacha mkpa mgbe niile! Na mgbanwe ndị akọwapụtara n'ime .gitlab-ci.yml anaghị arụ ọrụ ọ bụla.
Otu dị iche iche nwere mgbanwe
Ndị mgbanwe otu nwere obere mkpa.
.gitlab-ci.yml
Ka anyị jiri faịlụ sitere na ihe atụ gara aga. N'ebe a ọzọ enwere mgbanwe ndị akọwapụtara n'ime .gitlab-ci.yml, mana mgbanwe dị n'ime otu ka na-ebute ụzọ karịa ha.
image: busybox:latest
variables:
GIT_STRATEGY: none
MSG: "Custom in global .gitlab-ci.yml"
echo:
stage: test
script:
- echo $MSG
echo with var:
stage: test
variables:
MSG: "Custom in job .gitlab-ci.yml"
script:
- echo $MSG
Nsonaazụ pipeline
- ikwughachi:
$ echo $MSG project-3 Job succeeded
- ikwughachi na vars:
$ echo $MSG project-3 Job succeeded
Ihe nketa nwere uru efu [isi mmalite]
Uru efu bụkwa uru
Uru efu abụghị efu
Otu dị iche iche nwere mgbanwe
.gitlab-ci.yml
image: busybox:latest
variables:
GIT_STRATEGY: none
MSG: "Custom in global .gitlab-ci.yml"
echo:
stage: test
script:
- echo $MSG
echo with var:
stage: test
variables:
MSG: "Custom in job .gitlab-ci.yml"
script:
- echo $MSG
Nsonaazụ pipeline
- ikwughachi:
$ echo $MSG Job succeeded
- ikwughachi na vars:
$ echo $MSG Job succeeded
Ihe nketa nwere gụnyere na otu [isi mmalite]
N'ebe a, anyị ga-agbalị ịgụnye project-2 na project-3
Otu dị iche iche na nke a na-ebute ụzọ.
Otu dị iche iche nwere mgbanwe
.gitlab-ci.yml
Ma tọọ mgbanwe n'ụwa niile na .gitlab-ci.yml
variables:
MSG: "With include .gitlab-ci.yml"
include:
- project: how-is-gitlab-ci-inherit-environment-variables/z/y/project-3
file: '.gitlab-ci.yml'
Nsonaazụ pipeline
- ikwughachi:
$ echo $MSG B Job succeeded
- ikwughachi na vars:
$ echo $MSG B Job succeeded
Ihe nketa nwere gụnyere [isi mmalite]
N'ebe a, anyị ga-agbalị ịgụnye project-2 na project-3.
Na ọnọdụ na: ọ bụghị otu ma ọ bụ ọrụ ahụ n'onwe ya enweghị mgbanwe ọ bụla.
Otu dị iche iche nwere mgbanwe
.gitlab-ci.yml
Dị ka ọ dị na ihe atụ gara aga
variables:
MSG: "With include .gitlab-ci.yml"
include:
- project: how-is-gitlab-ci-inherit-environment-variables/z/y/project-3
file: '.gitlab-ci.yml'
Nsonaazụ pipeline
- ikwughachi:
$ echo $MSG With include .gitlab-ci.yml Job succeeded
- ikwughachi na vars:
$ echo $MSG Custom in job .gitlab-ci.yml Job succeeded
Nsonaazụ dị ka ndị a ihe ndị ka mkpa:
- Mgbanwe na ntọala oru ngo
- Mgbanwe na otu
- Ọdịiche akọwapụtara nke ọma n'ime ọrụ (gụnyere faịlụ gụnyere)
- Ngbanwe zuru ụwa ọnụ n'ime .gitlab-ci.yml
- Ụdị mgbanwe zuru ụwa ọnụ n'ime faịlụ gụnyere
nkwubi
Ihe kachasị pụta ìhè bụ na iwu "nke dị nso na mgbanwe dị na koodu ahụ, ọ dị mkpa ka ọ bụrụ" na-arụ ọrụ mbụ maka otu, na otu iwu maka mgbanwe n'ime .gitlab-ci.yml, ma naanị n'okpuru ọnọdụ. na akọwapụtaghị mgbanwe ndị dị na otu.
Na-esote, otu ihe dị mkpa bụ ịghọta na oghere zuru ụwa ọnụ maka isi na gụnyere .gitlab-ci.yml bụ ihe nkịtị. Na faịlụ nke nsonye na-eme nwere mkpa.
isi: www.habr.com