# 14 · เทียบแพลตฟอร์ม & บทสรุป

Chapter 14 of 14 in: CI/CD Handbook

Level 5 of 5 — ระดับเทพ (chapters 12–14)

Source: https://tayakorn.dev/handbooks/cicd/platform-comparison

Updated: 2026-07-13 (whole book)

Full book: https://tayakorn.dev/handbooks/cicd.md (~45K chars)

Previous: [13 · Runners & ความเร็วของ Pipeline](https://tayakorn.dev/handbooks/cicd/runners-performance.md)

Also in this file, after this chapter — end matter for the whole book: รายการอ้างอิง

---

ตลอดเล่มเราใช้ GitHub Actions เป็นตัวอย่าง แต่ย้ำมาตลอดว่าแนวคิดข้ามแพลตฟอร์มได้ บทสุดท้ายนี้พิสูจน์คำกล่าวนั้น แล้วม้วนทุกอย่างกลับมาเป็นแก่นที่ถือกลับไปใช้ได้จริง

### 14.1 คำเดียวกัน คนละชื่อ

ทุกแพลตฟอร์มมีลำดับชั้นเดียวกับบทที่ 2 เปลี่ยนแค่คำศัพท์และรูปแบบไฟล์:

| แนวคิด | GitHub Actions | GitLab CI | Jenkins |
| --- | --- | --- | --- |
| **ไฟล์นิยาม** | `.github/workflows/*.yml` | `.gitlab-ci.yml` | `Jenkinsfile` |
| **หน่วยรวม** | workflow | pipeline | pipeline |
| **กลุ่มงาน** | job | job (จัดกลุ่มด้วย stage) | stage |
| **เครื่องรัน** | runner | runner | agent / node |
| **ของสำเร็จรูป** | action | template / include | plugin / shared library |

นี่คือเหตุผลที่เล่มนี้เน้น "แนวคิด" — เรียนกลไกหนึ่งครั้ง ย้ายแพลตฟอร์มเมื่อไรก็แค่เรียนคำศัพท์ใหม่ ไม่ต้องเรียนวิธีคิดใหม่ CircleCI, Azure Pipelines, Travis และอื่น ๆ ก็เข้าแม่พิมพ์เดียวกันนี้

### 14.2 หลักปฏิบัติที่ดี — รวมทั้งเล่ม

- **เก็บ pipeline ไว้กับโค้ด** (pipeline-as-code) เวอร์ชันคู่กัน รีวิวคู่กัน
- **เร็วและล้มเร็ว** — ด่านถูกอยู่หน้า ขนานงานให้มาก cache ให้พอ
- **บังคับด้วยระบบ ไม่ใช่วินัย** — branch protection ทำให้ "CI ไม่เขียว = merge ไม่ได้"
- **เริ่มที่ Delivery** คงปุ่มมนุษย์ไว้ก่อน แล้วค่อยขยับสู่ Deployment เมื่อความเชื่อมั่นพิสูจน์แล้ว
- **ถอยได้เสมอ** — ไม่ deploy สิ่งที่ rollback ไม่ได้ migration เข้ากันได้สองทาง
- **ความปลอดภัยไม่ใช่ของเสริม** — pin SHA, least privilege, OIDC, กันโค้ด fork แตะ secret

### 14.3 บทสรุปทั้งเล่ม — แก่นที่ถือกลับไป

ถ้าจำได้แค่ไม่กี่อย่างจากเล่มนี้ ขอให้เป็นสิ่งเหล่านี้ เพราะทุกเทคนิคงอกออกมาจากมัน:

- CI/CD มีค่าเพราะมัน **ย่นวงจรป้อนกลับ** — จับปัญหายิ่งเร็ว ยิ่งถูก
- ทุก pipeline คือ **event → workflow → job (ขนาน) → step (เรียง) บน runner** — โครงเดียวข้ามทุกเครื่องมือ
- CI/CD คือ **สามชั้นซ้อนกัน** Integration ⊂ Delivery ⊂ Deployment เส้นแบ่งคือ "มีคนกดปุ่มไหม"
- ความปลอดภัยและ **ความสามารถถอยกลับ** คือสิ่งที่ทำให้ "ปล่อยบ่อย" เป็นเรื่องกล้าทำ ไม่ใช่เรื่องเสี่ยง
- pipeline คือ **โค้ด** — เวอร์ชัน รีวิว และดูแลมันด้วยมาตรฐานเดียวกับโค้ด production

> 🧭 **เส้นทางต่อจากนี้** — วิธีเก่งขึ้นจริงคือลงมือ: เอา repo ทดลองใส่ `ci.yml` ง่าย ๆ จากบทที่ 3 แล้วค่อย ๆ เติมทีละชั้น — เพิ่ม matrix, cache, แล้ว deploy ขึ้น environment ฟรีสักที่ จากนั้นลองพังมันดู (ทำเทสต์ให้ตก, ทำ deploy ให้ล้ม) เพื่อเห็นว่า fail loud กับ rollback ทำงานยังไง — pipeline ที่คุณเคยทำพังและกู้คืนเอง สอนได้ลึกกว่าทุกคู่มือ

> ✅ **สรุปบทที่ 14** — ทุกแพลตฟอร์มใช้ลำดับชั้นเดียวกัน ต่างแค่คำศัพท์/ไฟล์ — เรียนแนวคิดครั้งเดียวย้ายได้หมด · หลักปฏิบัติ: pipeline-as-code, เร็ว+ล้มเร็ว, บังคับด้วยระบบ, เริ่มที่ Delivery, ถอยได้เสมอ, ความปลอดภัยมาก่อน · แก่น: ย่นวงจรป้อนกลับ · โครง event→job→step · สามชั้น CI/CD · ถอยได้+ปลอดภัย · pipeline คือโค้ด — เท่านี้คุณก็จาก 0 ถึง Hero ของ CI/CD แล้ว

*— จบหลักสูตร —*

## รายการอ้างอิง

เรียงตามลำดับที่ปรากฏครั้งแรกในเล่ม เอกสารของแพลตฟอร์ม (GitHub · GitLab · Jenkins · Kubernetes) เปลี่ยนตามรุ่นและไม่ปักฉบับ ทุกหน้าอ่านจากฉบับที่เปิดอยู่ตอนตรวจ คือ 4 พฤศจิกายน 2026 — โดยเฉพาะเรื่องราคาและขีดจำกัดของ runner ให้ถือวันที่นี้เป็นขอบเขตของข้อมูล · ทุกรายการเปิดอ่านได้ฟรีทั้งหน้า

1. Fowler M. **Continuous Integration.** martinfowler.com 2000 (เขียนใหม่ 2006 · ปรับปรุง 18 มกราคม 2024) · [martinfowler.com](https://martinfowler.com/articles/continuousIntegration.html) — บทที่ 1 · integration hell · ทุกคน commit เข้าสายหลักทุกวัน · self-testing build
2. Fowler M. **Frequency Reduces Difficulty.** martinfowler.com 28 กรกฎาคม 2011 · [martinfowler.com/bliki](https://martinfowler.com/bliki/FrequencyReducesDifficulty.html) — บทที่ 1 · ที่มาของหลัก "ถ้าเจ็บ ก็ทำให้บ่อยขึ้น"
3. Fowler M. **Continuous Delivery.** martinfowler.com 30 พฤษภาคม 2013 (ปรับปรุง 12 สิงหาคม 2014) · [martinfowler.com/bliki](https://martinfowler.com/bliki/ContinuousDelivery.html) — บทที่ 1, 2, 9 · เส้นแบ่ง Continuous Delivery กับ Continuous Deployment
4. GitHub. **Understanding GitHub Actions.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/get-started/understand-github-actions) — บทที่ 2, 3, 4 · workflow คือไฟล์ YAML ใน `.github/workflows` · job ไม่มี dependency จึงรันขนานโดยปริยาย · step รันบน runner เดียวกันจึงส่งข้อมูลกันได้
5. GitHub. **Billing and usage** (GitHub Actions). GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/concepts/billing-and-usage) — บทที่ 3, 13 · ณ วันที่ตรวจ ใช้ฟรีสำหรับ GitHub-hosted runner มาตรฐานใน public repo และสำหรับ self-hosted runner ส่วน private repo ได้โควตารายเดือนตามแผนของบัญชี
6. GitHub. **Workflow syntax for GitHub Actions.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax) — บทที่ 3, 4, 7, 10, 12, 13 · `on` · `runs-on` · `steps` · `needs` (job ที่พึ่งตัวที่ล้มจะถูกข้าม) · `strategy.fail-fast` ค่าเริ่มต้น `true` · `permissions` · `environment` · ตัวกรอง `paths`
7. GitHub. **GitHub-hosted runners reference.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/reference/runners/github-hosted-runners) — บทที่ 3, 4, 13 · runner แต่ละตัวคือ VM ใหม่ · ณ วันที่ตรวจ `ubuntu-latest` ชี้ Ubuntu 24.04 และ `windows-latest` ชี้ Windows Server 2025 · runner มาตรฐานใช้ฟรีไม่จำกัดใน public repo
8. GitHub. **actions/checkout.** README ของ action · [github.com/actions/checkout](https://github.com/actions/checkout) — บทที่ 3, 13 · ค่าเริ่มต้น `fetch-depth: 1` (ดึง commit เดียว) · ตัวอย่างใน README ใช้ `@v7` ณ วันที่ตรวจ
9. OpenJS Foundation. **Node.js Releases.** nodejs.org · [nodejs.org](https://nodejs.org/en/about/previous-releases) — บทที่ 3, 7 · Node.js 18 และ 20 อยู่สถานะ EOL แล้ว ณ วันที่ตรวจ
10. GitHub. **Deprecation of Node 20 on GitHub Actions runners.** GitHub Changelog (ฉบับ 23 กันยายน 2026) · [github.blog/changelog](https://github.blog/changelog/2026-09-23-deprecation-of-node-20-on-github-actions-runners/) — บทที่ 3, 6, 7 · runner เริ่มรัน action ด้วย Node 24 โดยปริยายตั้งแต่ 16 มิถุนายน 2026 และกำหนดถอด Node 20 วันที่ 23 กันยายน 2026
11. GitHub. **Ubuntu 24.04.** README ของ image ใน actions/runner-images · [github.com/actions/runner-images](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md) — บทที่ 3 · image ของ `ubuntu-latest` ติดตั้ง Node.js มาให้แล้ว `setup-node` มีไว้เลือกรุ่นที่ต้องการ
12. GitHub. **Self-hosted runners.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/concepts/runners/self-hosted-runners) — บทที่ 4, 13 · คุมฮาร์ดแวร์ ระบบปฏิบัติการ และเครื่องมือได้เอง แต่ต้องดูแลอัปเดตเอง
13. GitHub. **Workflow artifacts.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/concepts/workflows-and-actions/workflow-artifacts) — บทที่ 4, 6 · artifact ส่งข้อมูลข้าม job และเก็บไว้ใช้หลังการรันจบ · artifact กับ cache "cannot be used interchangeably"
14. Fowler M. **Test Pyramid.** martinfowler.com 1 พฤษภาคม 2012 · [martinfowler.com/bliki](https://martinfowler.com/bliki/TestPyramid.html) — บทที่ 5 · แนวคิดมาจาก Test Automation Pyramid ของ Mike Cohn (*Succeeding with Agile* 2009)
15. GitHub. **About protected branches.** GitHub Docs · [docs.github.com](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches) — บทที่ 5, 14 · required status checks และ required pull request reviews
16. GitHub. **Dependency caching reference.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching) — บทที่ 6 · key จาก `hashFiles('package-lock.json')` · ณ วันที่ตรวจ cache ที่ไม่ถูกใช้เกิน 7 วันถูกลบ และเพดานรวมเริ่มต้น 10 GB ต่อ repo
17. GitHub. **Variables.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/concepts/workflows-and-actions/variables) — บทที่ 8 · ตัวแปรแสดงในล็อกแบบไม่ปิดบัง · ตั้งได้ระดับ organization / repository / environment
18. GitHub. **Secrets.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/concepts/security/secrets) — บทที่ 8, 10 · secret สามระดับ · ปิดบังในล็อกอัตโนมัติ แต่หน้าเดียวกันเตือนว่าค่าที่ถูกแปลงรูปอาจหลุดการปิดบัง
19. GitHub. **Using secrets in GitHub Actions.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets) — บทที่ 8 · ไวยากรณ์ context `secrets` · workflow ที่ทริกเกอร์จาก fork ไม่ได้รับ secret (ยกเว้น `GITHUB_TOKEN`)
20. Lobačevski J. **Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests.** GitHub Security Lab 3 สิงหาคม 2021 · [securitylab.github.com](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/) — บทที่ 8, 12 · `pull_request_target` คู่กับการ checkout โค้ด PR ที่ไม่น่าเชื่อถือ
21. Sato D. **Canary Release.** martinfowler.com 25 มิถุนายน 2014 · [martinfowler.com/bliki](https://martinfowler.com/bliki/CanaryRelease.html) — บทที่ 9, 11
22. GitHub. **Deployments and environments.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments) — บทที่ 10 · required reviewers · wait timer (1 ถึง 43,200 นาที) · deployment branches and tags · environment secret ที่อ่านได้หลังผ่านกฎป้องกันแล้วเท่านั้น
23. The Kubernetes Authors. **Deployments** (หัวข้อ Strategy). kubernetes.io · [kubernetes.io/docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) — บทที่ 11 · `Recreate` กับ `RollingUpdate` (ค่าเริ่มต้น)
24. Fowler M. **Blue Green Deployment.** martinfowler.com 1 มีนาคม 2010 (ปรับปรุง 5 มิถุนายน 2015) · [martinfowler.com/bliki](https://martinfowler.com/bliki/BlueGreenDeployment.html) — บทที่ 11 · สลับ router · rollback เร็ว · แยกการเปลี่ยนสคีมาให้รองรับทั้งสองเวอร์ชัน
25. Sato D. **Parallel Change.** martinfowler.com 13 พฤษภาคม 2014 · [martinfowler.com/bliki](https://martinfowler.com/bliki/ParallelChange.html) — บทที่ 11 · expand / migrate / contract ที่อยู่เบื้องหลัง migration แบบเข้ากันได้สองทาง
26. GitHub. **Secure use reference.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/reference/security/secure-use) — บทที่ 12, 13 · tag ถูกย้ายหรือลบได้ · ปักหมุดด้วย full-length commit SHA · ให้ `GITHUB_TOKEN` สิทธิ์น้อยที่สุด · self-hosted runner "should almost never be used for public repositories" · ephemeral / just-in-time runner
27. GitHub. **GitHub Actions workflow lockfiles in public preview.** GitHub Changelog 14 ตุลาคม 2026 · [github.blog/changelog](https://github.blog/changelog/2026-10-14-github-actions-workflow-lockfiles-in-public-preview/) — บทที่ 12 · ออกหลังเล่มปรับปรุงล่าสุด · lockfile บันทึก commit ของทุก action รวมทอดต่อ และหน้า Secure use ระบุว่ามันแทนการปักหมุด SHA สำหรับ repo ที่ใช้
28. GitHub. **GitHub Actions – Updating the default GITHUB_TOKEN permissions to read-only.** GitHub Changelog 2 กุมภาพันธ์ 2023 · [github.blog/changelog](https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/) — บทที่ 12 · บัญชี องค์กร และ repo ที่สร้างใหม่ได้ token แบบอ่านอย่างเดียวเป็นค่าเริ่มต้น ของที่มีอยู่ก่อนไม่ถูกเปลี่ยน
29. GitHub. **OpenID Connect.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/concepts/security/openid-connect) — บทที่ 12 · ไม่ต้องเก็บ credential cloud ระยะยาวเป็น secret · token ชั่วคราวใช้ได้เฉพาะ job เดียวแล้วหมดอายุเอง
30. Git project. **git-clone — Clone a repository into a new directory.** เอกสารทางการ Git · [git-scm.com/docs/git-clone](https://git-scm.com/docs/git-clone) — บทที่ 13 · `--depth` (shallow clone)
31. GitHub. **Reusing workflow configurations.** GitHub Docs · [docs.github.com](https://docs.github.com/en/actions/concepts/workflows-and-actions/reusing-workflow-configurations) — บทที่ 13 · reusable workflow กับ composite action
32. GitLab. **CI/CD YAML syntax reference.** GitLab Docs · [docs.gitlab.com](https://docs.gitlab.com/ci/yaml/) — บทที่ 14 · `.gitlab-ci.yml` · `stages` · `include`
33. Jenkins project. **Pipeline Syntax.** Jenkins User Documentation · [jenkins.io](https://www.jenkins.io/doc/book/pipeline/syntax/) — บทที่ 14 · `Jenkinsfile` · `agent` · `stages` / `stage` / `steps`
34. Jenkins project. **Extending with Shared Libraries.** Jenkins User Documentation · [jenkins.io](https://www.jenkins.io/doc/book/pipeline/shared-libraries/) — บทที่ 14

---

**CI/CD 0 → Hero** — จาก commit สู่ production อัตโนมัติ · เล่มต่อจาก [Git 0 → Hero](/handbooks/git) · เขียนเป็นภาษาไทย พร้อมไดอะแกรมทุกหัวข้อ

วิธีใช้ให้คุ้ม: อ่านไล่ระดับ Level 0–1 ก่อนเพื่อจับแบบจำลองความคิด แล้วลงมือสร้าง pipeline จริงควบคู่ไปทีละบท · ตัวอย่างยึด GitHub Actions แต่ทุกแนวคิดย้ายไป GitLab CI / Jenkins / CircleCI ได้ (บทที่ 14)