# GitHub Actions — .github/workflows/ci.ymlname: CIon: [push, pull_request] # triggerjobs: test: # a job runs-on: ubuntu-latest # the runner steps: - uses: actions/checkout@v4 # reusable action - run: npm ci # build/install - run: npm test # test step
# GitLab CI — .gitlab-ci.ymlstages: [build, test, deploy] # ordered stagesunit-test: stage: test script: - npm ci - npm test needs: [build-job] # DAG dependency
Tum aur friends mil ke ek giant LEGO castle banate ho. Jab bhi koi brick add karta hai, ek robot
turant check karta hai: kya castle abhi bhi khada hai? kya theek lag raha hai? Agar haan, toh robot castle ki photocopy karta hai
aur copy display shelf par rakh deta hai. CI woh robot hai jo har nayi brick fast check karta hai;
CD woh robot hai jo safe copies shelf par rakhta hai. Har waqt chhote checks karne se end mein kabhi pata nahi chalta
ki poora tower tedha tha.
Continuous Integration — changes ko frequently ek shared branch mein merge karo, har merge auto-build aur auto-test karta hai.
Continuous Delivery aur Continuous Deployment mein kya fark hai?
Delivery mein production se pehle ek manual approval gate hota hai; Deployment bina kisi human gate ke automatically production mein release karta hai.
Pipeline stages ko cheap/fast pehle kyun order kiya jaata hai?
"Fail fast / shift left" — broken code ko sabse saste check (lint) se pakdo slow stages (deploy) ke liye pay karne se pehle.
GitHub Actions hierarchy?
Workflow ➜ Job ➜ Step (ek step ek action use kar sakta hai).
GitLab CI hierarchy?
Pipeline ➜ Stage ➜ Job.
Same stage ke jobs: serial ya parallel?
Parallel; stages khud sequentially chalta hain.
n independent jobs ko m runners par parallel wall-clock time ka formula?
T=t⋅⌈n/m⌉.
n independent jobs ke liye maximum useful runners ki sankhya?
m = n; usse zyada koi extra speedup nahi.
Runner/agent kya hai?
Woh VM/container jo actually pipeline jobs execute karta hai.
Artifact kya hai?
Ek file/output jo ek stage produce karta hai aur baad ke stages ke liye store hoti hai (binary, image, report).
Secrets ko pipeline YAML mein kyun nahi daalna chahiye?
YAML git history mein committed hoti hai; platform ke masked secret store ka use karo.
GitLab CI mein needs: kya enable karta hai?
Ek DAG taaki ek job apni dependencies finish hote hi start ho sake, poore pehle wale stage ka wait kiye bina.
CI mein dependencies cache kyun karo?
Install repeated/deterministic/large hoti hai; cache restore karna (time c ≪ d) har run mein d−c bachata hai.