LEVEL 4 · ระดับเทพ
เทียบแพลตฟอร์ม & บทสรุป
ตลอดเล่มเราใช้ 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 ที่คุณเคยทำพังและกู้คืนเอง สอนได้ลึกกว่าทุกคู่มือ
— จบหลักสูตร —
รายการอ้างอิง#
เรียงตามลำดับที่ปรากฏครั้งแรกในเล่ม เอกสารของแพลตฟอร์ม (GitHub · GitLab · Jenkins · Kubernetes) เปลี่ยนตามรุ่นและไม่ปักฉบับ ทุกหน้าอ่านจากฉบับที่เปิดอยู่ตอนตรวจ คือ 4 พฤศจิกายน 2026 — โดยเฉพาะเรื่องราคาและขีดจำกัดของ runner ให้ถือวันที่นี้เป็นขอบเขตของข้อมูล · ทุกรายการเปิดอ่านได้ฟรีทั้งหน้า
- Fowler M. Continuous Integration. martinfowler.com 2000 (เขียนใหม่ 2006 · ปรับปรุง 18 มกราคม 2024) · martinfowler.com — บทที่ 1 · integration hell · ทุกคน commit เข้าสายหลักทุกวัน · self-testing build
- Fowler M. Frequency Reduces Difficulty. martinfowler.com 28 กรกฎาคม 2011 · martinfowler.com/bliki — บทที่ 1 · ที่มาของหลัก "ถ้าเจ็บ ก็ทำให้บ่อยขึ้น"
- Fowler M. Continuous Delivery. martinfowler.com 30 พฤษภาคม 2013 (ปรับปรุง 12 สิงหาคม 2014) · martinfowler.com/bliki — บทที่ 1, 2, 9 · เส้นแบ่ง Continuous Delivery กับ Continuous Deployment
- GitHub. Understanding GitHub Actions. GitHub Docs · docs.github.com — บทที่ 2, 3, 4 · workflow คือไฟล์ YAML ใน
.github/workflows· job ไม่มี dependency จึงรันขนานโดยปริยาย · step รันบน runner เดียวกันจึงส่งข้อมูลกันได้ - GitHub. Billing and usage (GitHub Actions). GitHub Docs · docs.github.com — บทที่ 3, 13 · ณ วันที่ตรวจ ใช้ฟรีสำหรับ GitHub-hosted runner มาตรฐานใน public repo และสำหรับ self-hosted runner ส่วน private repo ได้โควตารายเดือนตามแผนของบัญชี
- GitHub. Workflow syntax for GitHub Actions. GitHub Docs · docs.github.com — บทที่ 3, 4, 7, 10, 12, 13 ·
on·runs-on·steps·needs(job ที่พึ่งตัวที่ล้มจะถูกข้าม) ·strategy.fail-fastค่าเริ่มต้นtrue·permissions·environment· ตัวกรองpaths - GitHub. GitHub-hosted runners reference. GitHub Docs · docs.github.com — บทที่ 3, 4, 13 · runner แต่ละตัวคือ VM ใหม่ · ณ วันที่ตรวจ
ubuntu-latestชี้ Ubuntu 24.04 และwindows-latestชี้ Windows Server 2025 · runner มาตรฐานใช้ฟรีไม่จำกัดใน public repo - GitHub. actions/checkout. README ของ action · github.com/actions/checkout — บทที่ 3, 13 · ค่าเริ่มต้น
fetch-depth: 1(ดึง commit เดียว) · ตัวอย่างใน README ใช้@v7ณ วันที่ตรวจ - OpenJS Foundation. Node.js Releases. nodejs.org · nodejs.org — บทที่ 3, 7 · Node.js 18 และ 20 อยู่สถานะ EOL แล้ว ณ วันที่ตรวจ
- GitHub. Deprecation of Node 20 on GitHub Actions runners. GitHub Changelog (ฉบับ 23 กันยายน 2026) · github.blog/changelog — บทที่ 3, 6, 7 · runner เริ่มรัน action ด้วย Node 24 โดยปริยายตั้งแต่ 16 มิถุนายน 2026 และกำหนดถอด Node 20 วันที่ 23 กันยายน 2026
- GitHub. Ubuntu 24.04. README ของ image ใน actions/runner-images · github.com/actions/runner-images — บทที่ 3 · image ของ
ubuntu-latestติดตั้ง Node.js มาให้แล้วsetup-nodeมีไว้เลือกรุ่นที่ต้องการ - GitHub. Self-hosted runners. GitHub Docs · docs.github.com — บทที่ 4, 13 · คุมฮาร์ดแวร์ ระบบปฏิบัติการ และเครื่องมือได้เอง แต่ต้องดูแลอัปเดตเอง
- GitHub. Workflow artifacts. GitHub Docs · docs.github.com — บทที่ 4, 6 · artifact ส่งข้อมูลข้าม job และเก็บไว้ใช้หลังการรันจบ · artifact กับ cache "cannot be used interchangeably"
- Fowler M. Test Pyramid. martinfowler.com 1 พฤษภาคม 2012 · martinfowler.com/bliki — บทที่ 5 · แนวคิดมาจาก Test Automation Pyramid ของ Mike Cohn (Succeeding with Agile 2009)
- GitHub. About protected branches. GitHub Docs · docs.github.com — บทที่ 5, 14 · required status checks และ required pull request reviews
- GitHub. Dependency caching reference. GitHub Docs · docs.github.com — บทที่ 6 · key จาก
hashFiles('package-lock.json')· ณ วันที่ตรวจ cache ที่ไม่ถูกใช้เกิน 7 วันถูกลบ และเพดานรวมเริ่มต้น 10 GB ต่อ repo - GitHub. Variables. GitHub Docs · docs.github.com — บทที่ 8 · ตัวแปรแสดงในล็อกแบบไม่ปิดบัง · ตั้งได้ระดับ organization / repository / environment
- GitHub. Secrets. GitHub Docs · docs.github.com — บทที่ 8, 10 · secret สามระดับ · ปิดบังในล็อกอัตโนมัติ แต่หน้าเดียวกันเตือนว่าค่าที่ถูกแปลงรูปอาจหลุดการปิดบัง
- GitHub. Using secrets in GitHub Actions. GitHub Docs · docs.github.com — บทที่ 8 · ไวยากรณ์ context
secrets· workflow ที่ทริกเกอร์จาก fork ไม่ได้รับ secret (ยกเว้นGITHUB_TOKEN) - Lobačevski J. Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests. GitHub Security Lab 3 สิงหาคม 2021 · securitylab.github.com — บทที่ 8, 12 ·
pull_request_targetคู่กับการ checkout โค้ด PR ที่ไม่น่าเชื่อถือ - Sato D. Canary Release. martinfowler.com 25 มิถุนายน 2014 · martinfowler.com/bliki — บทที่ 9, 11
- GitHub. Deployments and environments. GitHub Docs · docs.github.com — บทที่ 10 · required reviewers · wait timer (1 ถึง 43,200 นาที) · deployment branches and tags · environment secret ที่อ่านได้หลังผ่านกฎป้องกันแล้วเท่านั้น
- The Kubernetes Authors. Deployments (หัวข้อ Strategy). kubernetes.io · kubernetes.io/docs — บทที่ 11 ·
RecreateกับRollingUpdate(ค่าเริ่มต้น) - Fowler M. Blue Green Deployment. martinfowler.com 1 มีนาคม 2010 (ปรับปรุง 5 มิถุนายน 2015) · martinfowler.com/bliki — บทที่ 11 · สลับ router · rollback เร็ว · แยกการเปลี่ยนสคีมาให้รองรับทั้งสองเวอร์ชัน
- Sato D. Parallel Change. martinfowler.com 13 พฤษภาคม 2014 · martinfowler.com/bliki — บทที่ 11 · expand / migrate / contract ที่อยู่เบื้องหลัง migration แบบเข้ากันได้สองทาง
- GitHub. Secure use reference. GitHub Docs · docs.github.com — บทที่ 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 - GitHub. GitHub Actions workflow lockfiles in public preview. GitHub Changelog 14 ตุลาคม 2026 · github.blog/changelog — บทที่ 12 · ออกหลังเล่มปรับปรุงล่าสุด · lockfile บันทึก commit ของทุก action รวมทอดต่อ และหน้า Secure use ระบุว่ามันแทนการปักหมุด SHA สำหรับ repo ที่ใช้
- GitHub. GitHub Actions – Updating the default GITHUB_TOKEN permissions to read-only. GitHub Changelog 2 กุมภาพันธ์ 2023 · github.blog/changelog — บทที่ 12 · บัญชี องค์กร และ repo ที่สร้างใหม่ได้ token แบบอ่านอย่างเดียวเป็นค่าเริ่มต้น ของที่มีอยู่ก่อนไม่ถูกเปลี่ยน
- GitHub. OpenID Connect. GitHub Docs · docs.github.com — บทที่ 12 · ไม่ต้องเก็บ credential cloud ระยะยาวเป็น secret · token ชั่วคราวใช้ได้เฉพาะ job เดียวแล้วหมดอายุเอง
- Git project. git-clone — Clone a repository into a new directory. เอกสารทางการ Git · git-scm.com/docs/git-clone — บทที่ 13 ·
--depth(shallow clone) - GitHub. Reusing workflow configurations. GitHub Docs · docs.github.com — บทที่ 13 · reusable workflow กับ composite action
- GitLab. CI/CD YAML syntax reference. GitLab Docs · docs.gitlab.com — บทที่ 14 ·
.gitlab-ci.yml·stages·include - Jenkins project. Pipeline Syntax. Jenkins User Documentation · jenkins.io — บทที่ 14 ·
Jenkinsfile·agent·stages/stage/steps - Jenkins project. Extending with Shared Libraries. Jenkins User Documentation · jenkins.io — บทที่ 14
CI/CD 0 → Hero — จาก commit สู่ production อัตโนมัติ · เล่มต่อจาก Git 0 → Hero · เขียนเป็นภาษาไทย พร้อมไดอะแกรมทุกหัวข้อ
วิธีใช้ให้คุ้ม: อ่านไล่ระดับ Level 0–1 ก่อนเพื่อจับแบบจำลองความคิด แล้วลงมือสร้าง pipeline จริงควบคู่ไปทีละบท · ตัวอย่างยึด GitHub Actions แต่ทุกแนวคิดย้ายไป GitLab CI / Jenkins / CircleCI ได้ (บทที่ 14)
If this was useful —buy me a coffeeor PromptPay · Lightning