Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DevOps Taiwan 2020 Workshop - Jenkins CICD

DevOps Taiwan 2020 Workshop - Jenkins CICD

Jenkins CICD on Kubernetes workshop

Rico Chen

June 21, 2020
Tweet

More Decks by Rico Chen

Other Decks in Programming

Transcript

  1. Hello everyone, My name is JohnChen 2 I was •

    a System engineer • a DevOps I am • a Site Reliability Engineer for Grindr
  2. Who am I 3 I am Rico Chen and work

    for Bincentive Who am I is not important. Today is Anna’s birthday!!!!!! Happy Birthday yooohoooo
  3. Before We start …… • WARNING 1: If you use

    any Ad Block extension on browser. Please disable first. • WARNING 2: Please be a copycat as much as you can. No matter AWS region or config. Just be a copycat. 5
  4. Setup Cloud9 and EKS Following pictures of installation guide comes

    from: https://github.com/pahud/amazon-eks-workshop 6
  5. 9

  6. 10

  7. 11

  8. 14

  9. 15

  10. 16

  11. 17

  12. 18

  13. 19

  14. Export your credential to environment (CDK not support AWS CLI

    v2 right now, export to env is only way to feed aws credential) export AWS_ACCESS_KEY_ID={your key id} export AWS_SECRET_ACCESS_KEY={your secret key} export AWS_DEFAULT_REGION=ap-northeast-2 Make sure this IAM User has Administrator Access and run cli, you should be able to see the returned JSON output like this. aws sts get-caller-identity 20
  15. Outline • Jenkins Background • Why use Jenkins • CICD

    principle • Jenkins Workshop!!!! 23
  16. Jenkins 是一款由 Java 編寫的開源的持續整合工具,前身是 Hudson 軟體專案。 Hudson 2004 年夏天始創於 Sun

    Microsystems。 Jenkins 提供了軟體開發的持續整合服務。它執行在 Tomcat 容器中。它支援軟體組 態管理工具,可以執行基於 Apache Ant 和 Apache Maven 的專案,以及任意的 Shell 命令和 Windows 批次處理命令。 Jenkins 的主要開發者是川口耕介。 Jenkins 是在 MIT 授權條款下釋出的自由軟體。 25
  17. 川口耕介(Kohsuke Kawaguchi)是一位程式設計師,以 Jenkins 軟體專案的創建者 而聞名。在 Sun Microsystems 工作期間,他是 Hudson 專案的主要開發人員。他還

    因對 Jenkins 項目的工作而獲得了2011 年 Google-O'Reilly 開放源碼獎。 2019 DevOps World | Jenkins World 演講 26
  18. 27

  19. Outline • Jenkins Background • Why use Jenkins • CICD

    principle • Jenkins Workshop!!!! 33
  20. Outline • Jenkins Background • Why use Jenkins • CICD

    principle • Jenkins Workshop!!!! 35
  21. Outline • Jenkins Background • Why use Jenkins • CICD

    principle • Jenkins Workshop!!!! 38
  22. 44

  23. 47

  24. 49

  25. 50

  26. 57 Copy & paste me ! origin +refs/heads/*:refs/r emotes/origin/* +refs/merge-reques

    ts/*/head:refs/remo tes/origin/merge-re quests/* origin/${gitlabSourc eBranch} merge-requests/${gitlabMergeRequestIid}
  27. 58

  28. 60

  29. 61

  30. Jenkins Workshop Lessons • Lesson-1 • Lesson-2 • Lesson-2.5 •

    Lesson-3 • Lesson-4 • Lesson-5 • Lesson-6 • Lesson-7 • Uninstall 62
  31. Lesson-1 • Code review in PR (or MR) • Unit

    test in PR (or MR) • Build test in PR (or MR) • Jenkins rebuild in PR (or MR) • Dockerfile experimental cache feature[link] 64
  32. 66

  33. 67

  34. 69

  35. 70

  36. 71 Copy & paste me ! kubectl get pod bash

    get-links.sh And then click go-app url
  37. Lesson-2 • Use jenkins shared library to reduce duplication between

    project repositories • Demo jenkins-workshop-jenkins-library (click me) 73
  38. 74

  39. 75

  40. Lesson-2.5 • Store json / yaml in shared library •

    Store python / shell script in shared library 77
  41. Directory structure src: It is a regular java source directory.

    It is added to the classpath during every script compilation. vars: This directory holds all the global shared library code that can be called from a pipeline. It has all the library files with a .groovy extension. resources: All the non-groovy files required for your ur pipelines can be managed in this folder. 79
  42. 82

  43. 83

  44. 84

  45. 85

  46. 86

  47. 87

  48. 92

  49. 93

  50. 94

  51. 95

  52. 99

  53. 100

  54. 101

  55. 104

  56. 105

  57. 110

  58. 115

  59. 116

  60. 119

  61. 122

  62. 123

  63. 124

  64. 126 • jenkins service user only in EE version •

    jenkins gitlab plugin • JNLP fails to connect to master when istio envoy-proxy is present • add clusterrole for executing helm inside pipeline • Dockerfile buildkit feature
  65. 127 • Docker buildkit feature with frontend experimental syntaxes •

    Jenkins Configuration as Code Plugin • CDK ECR not support --force option • AWS CDK didn’t support AWS CLI v2 • Dynamic Jenkins Agent from Kubernetes • Jenkins artwork
  66. 128 • 精通 Jenkins Pipeline — part1 (Groovy 以及 Jenkinsfile)

    • 精通 Jenkins Pipeline — part2 (Transform, Node Step 以及 Declarative Pipeline) • 精通 Jenkins Pipeline — part3 (Declarative Pipeline and its implementation)