ci / integration :
build
test
merge
cd / delivery :
auto release to repository
cd / deployment :
auto deploy to production
=====
ci = pass test
cd = deliver code to production
======
## gitactions
1 create workflow = superlinter.yml
// linter = run check codes that meet specific criteria or standard
=======
## workflow
terdiri dari 5 :
1 event
2 jobs
3 runner
4 steps
5 actions
1 event = trigger for workflow
- example: when someone push new code
// contoh event di yaml file :
on: push
^ bakal jalanin isi dari jobs
2 jobs = jobs todo
jobs:
super-lint:
name: Lint code base
runs-on : ubuntu-latest // runner => container
steps:
- name: checkout code
uses: actions/checkout@v2 // check our code
- name: Run Super-Linter
uses: github/super-linter@v3 // run linter
env:
DEFAULT_BRANCH: main
3 runner = container yg buat jalanin obs
runs-on : ubuntu-latest
## by default github runs our code in github environtment
## ada ubuntulinux / windows / mac
4 steps = declare berapa jumlah step yg akan dijalankan
stepnya jalanin linter**
=========
superlinter support multiple linter ( understand multiple language )
===========
awal bikin workflow penamaan penting
mygitactions/.github/workflows/superlinter.yml // in main
## trs di commit ke main branch
=========
## msk ke <> code
## check status icon
check pass = turn green
check fail = turn red
atau ke actions tab
=============
CD
klo udah ci pipeline selesai dan image dipush ke registry saatnya bikin cd.
create new repo.
isinya config repo :
- kubernetes manifest / docker compose
push ke test/QA env --> dimonitor pake prometheus / grafana
prometheus = script metric from app
grafana = qa bs visualize change, check latency, check kpi
biasanya ada 3 cd stage:
test/qa
staging : pretend as production. testing live stage
production : customer access
==============
push model:
registry -> dipush ke 3 stage ( kubectl apply ) -> dimonitor pake prometheus / grafana
pull model:
argoCD diinstall di tiap kubernetes cluster
argoCD = cek state repository, cek state masing2 cluster ( di pull )
klo di cluster ada perubahan lgsng ngecek dan ngasih tau klo out of sync
bs otomatis di sync sama si agro atau manually triggered
otomatis sync test/qa env dengan staging env via argo CD
fungsi argoCD : sync dan ngecek state
============
// argo rollout canary deployment
user --- loadbalancer --- app ( kubernetes pod ).
90% traffic
user --- loadbalancer --- app v1
|
| 10% traffic
--------- app v2
90%
10%
80%
20%
**mindahin traffic ke versi baru sampe smuanya pindah ke versi release yg baru
podnya** jg dari aplikasi yg lama dipindah ke app yg baru
==============