ci/cd、自動化,你還沒準備好(gcpug.tw meetup #34)
TRANSCRIPT
Cheng Wei Chen @ GCPUG Taiwan Meetup #34Photo by Vítor Santos on Unsplash
CI / CD / 自動化
你還沒準備好!?v2
2013
100 % Laravel
JetBrains
( )
PHP/Laravel http://www.laravel-dojo.com
你是老闆 / 決策者嗎?
對於實際負責現場的員工
有時候很怕遇到一種狀況
老闆:「我昨天聽見⋯⋯我覺
得我們公司應該要導入⋯⋯」
NEWWAY
Photo by Paul on Unsplash
!!!???
DevOps CI / CD
Photo by Matthew Henry on Unsplash
CI / CD
201620051930 1995 20001990
Agile 2008 conference, Andrew Clay Shafer and Patrick Debois discussed “Agile Infrastructure”
2009/06/23, O’Reilly Velocity, “10+ Deploys per Day Dev and Ops Cooperation at Flickr”
2009 - DevOpsDays Ghent in Belgium
2010 - Book Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation
2013 - Book The Phoenix Project
2010
: http://finding-marbles.com/2012/04/15/a-brief-history-of-agile-and-lean-events/ , https://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software , http://www.jianshu.com/p/f40209023006 , http://itrevolution.com/the-history-of-devops/ , http://www.tocinstitute.org/history-of-toc.html
Photo by Sweet Ice Cream Photography on Unsplash
CI / CD / Automation
軟體開發新顯學
!!!???
1930s – PDCA-Cycle
201620051992 – Crystal
1930
2002 – TDD
2007 – Kanban for Software Development
2009 – Lean Startup
1995 20001990 2010
1999 – User Stories
1999 – eXtreme Programming
1995 – Scrum
2001 – Agile Manifesto 2007 – Agile Retrospectives
1993 – Refactoring
1995 – Pair Programming
1999 – Continuous Integration
2006 – BDD
1940s – Kanban & Toyota Production Systems / Lean
2003 – Lean Software Development
2009 – Software Craftsmanship Manifesto
2008 – Clean Code2009 - DevOps
2006 – AWS
2012 – Ansible
2009 – Chef
2005 – Puppet
2007 – VirtualBox
1999 – VMware
2005 – Git
2010 - Continuous Delivery
: http://finding-marbles.com/2012/04/15/a-brief-history-of-agile-and-lean-events/ , https://en.wikipedia.org/wiki/Comparison_of_open-source_configuration_management_software , http://www.jianshu.com/p/f40209023006 , http://itrevolution.com/the-history-of-devops/ , http://www.tocinstitute.org/history-of-toc.html
1984 – TOC
工程師愛自動化 https://www.youtube.com/watch?v=WRkJn5N77jM
工程師愛自動化 LEGO https://www.youtube.com/watch?v=sUtS52lqL5w
: https://unsplash.com/photos/Fixg8KipOg8
Trigger ScriptsInterface ServiceFlow
什麼是自動化?
: https://unsplash.com/photos/Fixg8KipOg8
shell scripts (provisioning) cron + shell scripts CI Server + CI Jobs
IFTTT Event triggered
Monitoring / Alerts Self-Healing infrastructure
Trigger ScriptsInterface ServiceFlow
code build test release deploy operateplan
Continuous Integration
Continuous Delivery
Automation
CI/CD/Automation
Continuous Deployment
CIcommit dev stagingtest
testprod deploy
environment
dev
staging
prod
local
Infrastructure as
Code
自動化能夠帶來許多好處
消除重複的工作
提升軟體的交付速度(節省時間?)
降低成本、消除浪費
降低人為錯誤
消除對個體或團隊的依賴
more…
通常當我們聽見
自動化的好處時
Photo by Zachary Nelson on Unsplash
等到實際換你上場時...
https://www.offworlddesigns.com/game-over-t-shirt/
梗圖:陣亡的瑪莉歐(水管工人)
理想與現實的差距
_____萬事起頭難
Photo by Nik Shuliahin on Unsplash
會遇到的坑,比想像的多
Oooops
該從何處開始著手?
code build test release deploy operateplan
Continuous Integration
Continuous Delivery
Automation
從何處開始著手?
Continuous Deployment
CIcommit dev stagingtest
testprod deploy
environment
dev
staging
prod
local
Infrastructure as
Code
Deploy
從痛點開始
stagingdev test test production
staging test production
Project-1
Project-2
production Project-3x10
x5
x3
在非瓶頸設備省下的
每個小時都是虛幻的。
感謝 高德拉特博士
感謝 葉秉哲 前輩
應用程式所需的 environment?
Deploy
從單一環節逐步開始
如何取得 Artifacts?
是否有其他初始化的動作?
如何因應「部署失敗」?
如何連上主機? 需要額外的組態管理?
如何因應「重新部署」?
該選用哪種技術 / 工具?
技術及工具的決策?
技術及工具的決策?
技術及工具的決策?
add or delete GCP Cloud DNS
GCP Cloud SDK for Python
Ansible Module - gcdns_record
GCP Cloud SDK for PHP
技術及工具的決策?
add or delete GCP Cloud DNS
GCP Cloud SDK for Python
Ansible Module - gcdns_record
GCP Cloud SDK for PHP
• php • API • Ansible •
技術及工具的決策?
Ansible GCP SDK
梗圖:料理東西軍,你要選哪道菜?
標準與客製
應用程式所需的 environment?
Deploy
自動化前,先標準化
如何取得 Artifacts?
是否有其他初始化的動作?
如何因應「部署失敗」?
如何連上主機? 需要額外的組態管理?
如何因應「重新部署」?
x2 x2 x3
x3x2
x3 x2
大致標準化,預留客製空間
tasks: - name: download artifacts get_url: artifacts.zip - name: setup env templates: nginx.conf - name: reload nginx services: nginx reload
tasks: - name: download scripts get_url: deploy.sh - name: run scripts command: sh deploy.sh
為了自動化而自動化不要
https://xkcd.com/1205/
即是 Code 就有
需求與優先順序
看見全貌!
不過度專注局部 Ruddy Agile Tour Kaohsiung 2017
多而繁雜的細節
code build test release deploy operateplan
Continuous Integration
Continuous Delivery
Automation
以 pipeline 為例
Continuous Deployment
CIcommit dev stagingtest
testprod deploy
environment
dev
staging
prod
local
Infrastructure as
Code
Photo by Mike Wilson on Unsplash
你就是水管工人!
好書非讀不可
好書非讀不可
技術轉移及技能喪失
In their efforts to compensate for the unreliability of human performance, the designers of automated control systems have unwittingly created opportunities for new error types that can be even more serious than those they were seeking to avoid.
—James Reason
更多的文件、培訓、訓練
持續改善及持續維護
持續改善勝過追求完美
START
自動化需要人力、工時
Summary
: https://unsplash.com/photos/Fixg8KipOg8
Trigger ScriptsInterface ServiceFlow
什麼是自動化?
自動化能夠帶來許多好處
但自動化的坑,比你想像的多
Oooops
自動化需要的資源(人力、工時),
也比你想像的多
自動化需要的評估關鍵,
也同樣比你想像的多
• • • • •
思考並評估
• • • • •
思考並評估
好書非讀不可
CD
https://www.infoq.com/articles/Continuous-Delivery-Maturity-Model
• Operator-triggered manual action • Operator-written, system-specific automation • Externally maintained generic automation • Internally maintained, system-specific automation • Autonomous systems that need no human intervention
自動化的演進
https://landing.google.com/sre/book.html
《SRE》Ch7
Photo by Sweet Ice Cream Photography on Unsplash
無法被自動化的事情比人們想像中的少!
Photo by Sweet Ice Cream Photography on Unsplash
自動化是一種力量倍增器,但不是萬靈丹!
反覆評估、持續改善
Photo by Sweet Ice Cream Photography on Unsplash
迭代
工商服務
https://devopstw.club
尋求志工、贊助
: https://pixabay.com/en/building-joy-planning-plans-1080592/ , https://pixabay.com/en/baby-hand-dad-200760/
尋求講者及講題
: https://www.pexels.com/photo/man-person-suit-united-states-of-america-2281/
Photo by Clark Tibbs on Unsplash
Thank You