Slide 1

Slide 1 text

High cost performance CI Android Testing Bootcamp #6 Yuta Tetsuka 2017/05/10

Slide 2

Slide 2 text

Yuta Tetsuka - JustSystems corporation joined in 2012 - Team smilezemi (smile-zemi.jp) - Android engineer - Qiita: @tetsukay 1 About me 2

Slide 3

Slide 3 text

What do you use the CI ? 3

Slide 4

Slide 4 text

Github Enterprise  + CI as a Service? 4

Slide 5

Slide 5 text

Github Enterprise  + Jenkins? 5

Slide 6

Slide 6 text

Cost calculation - Github Enterprise - $2,500 / 10 users / year - JustSystems - About 300 users - $75,000(≓8,000,000 JPY) - CI as a Service - Restrictions are severe - Concurrent builds - Machine power - Build Environments 6

Slide 7

Slide 7 text

Recommend solution 7

Slide 8

Slide 8 text

Gitlab Best solution 8

Slide 9

Slide 9 text

Gitlab...? Best solution…? 9

Slide 10

Slide 10 text

(I’m thinking) Everyone's imagination against Gitlab 10

Slide 11

Slide 11 text

2013.1 Via https://www.slideshare.net/takafumionaka/is-there-anynecessityofusinggithubenterprise 11

Slide 12

Slide 12 text

Eerie raccoon dog ※ たぬきです 12

Slide 13

Slide 13 text

Destroy Database ※ リカバリ作業がYoutubeでストリーミング配信されました 13

Slide 14

Slide 14 text

etc… slightly negative impression might be strong 14

Slide 15

Slide 15 text

突然ですが,少し昔話いいですか? ※ ここの英訳は伝わる気がしないので日本語で失礼します 15

Slide 16

Slide 16 text

2013 spring SVN to Git - SVNが嫌すぎて会社にGit導入要請 - 入れても良いけど選択肢とコスト計算して - Github Enterprise or Gitlab - 当時,GitlabはGithubの劣化コピー感満載 - 最低限の欲しい機能は付いてた - GithubコストとGitlab運用コスト比較検討 - なんとか自社で運用できるのでは? - と情シスが言い出す 16

Slide 17

Slide 17 text

(当時の心境)正直なところ Github Enterpriseが良い... 17

Slide 18

Slide 18 text

いま Gitlabでよかった! 18

Slide 19

Slide 19 text

驚異的な進化速度 - 細かい使い勝手がどんどん改善 - 月1のアップデートでChangelog300行とか - 早いアップデートで新機能がどんどん使える のは楽しい! 19

Slide 20

Slide 20 text

e.g. Issue Board - いわゆるカンバン - 実はGithubより一足早くリリース - 2016.8 20

Slide 21

Slide 21 text

e.g. Burndown Chart - Burndown Chart - ただしこれは有料 21

Slide 22

Slide 22 text

閑話休題: Gitlab CI 22

Slide 23

Slide 23 text

CI with Gitlab 23

Slide 24

Slide 24 text

Machine - Hardware - Cloud 24

Slide 25

Slide 25 text

CI Runner - CI Engine - Multi Platform - Win, Mac, Linux - N:N link to Gitlab 25

Slide 26

Slide 26 text

Executor - Docker - Docker based CI - Shell - CI on Runner Server Shell - Use iOS, Windows CI - Virtual Box - CI in Virtual Box - e.g. CI on Windows - SSH - Kick other machine 26

Slide 27

Slide 27 text

prices - Gitlab - Community Edition $0 - Gitlab Runner - $0 (+ Hardware, Cloud) 27

Slide 28

Slide 28 text

Setup Runner Use gitlab.com + My Runner 28

Slide 29

Slide 29 text

Install Runner https://docs.gitlab.com/runner/install/linux-repository.html curl -sSL https://get.docker.com/ | sh # For Debian/Ubuntu curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-mu lti-runner/script.deb.sh | sudo bash # For RHEL/CentOS curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-mu lti-runner/script.rpm.sh | sudo bash # For Debian/Ubuntu sudo apt-get install gitlab-ci-multi-runner # For RHEL/CentOS sudo yum install gitlab-ci-multi-runner 29

Slide 30

Slide 30 text

Register Runner https://docs.gitlab.com/runner/install/linux-repository.html $ sudo gitlab-ci-multi-runner register Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com ) > https://gitlab.com Please enter the gitlab-ci token for this runner > [ci token xxx] (Project Settings -> CI/CD Pipeline) Please enter the gitlab-ci description for this runner > my-runner INFO[0034] fcf5c619 Registering runner... succeeded Please enter the executor: shell, docker, docker-ssh, ssh? > docker Please enter the Docker image (eg. ruby:2.1): > ubuntu:latest INFO[0037] Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded! 30

Slide 31

Slide 31 text

Registered! 31

Slide 32

Slide 32 text

Runner Test image: openjdk:8-jdk build: script: - echo ok - Create .gitlab-ci.yml - To project root directory $ echo ok ok Job succeeded 32

Slide 33

Slide 33 text

Build Docker Image For Android build 33

Slide 34

Slide 34 text

Create new project for image build Fork: https://github.com/gfx/docker-android-project/blob/master/Dockerfile - Files - Dockerfile - android-sdk-license - .gitlab-ci.yml - Default template for docker build - Start build, When you commit Sample: https://gitlab.com/tetsukay/android-container 34

Slide 35

Slide 35 text

Build Success Fork: https://github.com/gfx/docker-android-project/blob/master/Dockerfile Sample: https://gitlab.com/tetsukay/android-container 35

Slide 36

Slide 36 text

Build Android App 36

Slide 37

Slide 37 text

Clone Droid Kaigi 2017 project Fork: https://github.com/DroidKaigi/conference-app-2017 - Add file - .gitlab-ci.yml Sample: https://gitlab.com/tetsukay/droidkaigi2017 37

Slide 38

Slide 38 text

.gitlab-ci.yml Fork: https://github.com/DroidKaigi/conference-app-2017 Sample: https://gitlab.com/tetsukay/droidkaigi2017 image: registry.gitlab.com/tetsukay/android-container:master before_script: - chmod +x ./gradlew stages: - build - test build: stage: build script: - ./gradlew assembleDebug artifacts: paths: - app/build/outputs/ unitTests: stage: test script: - ./gradlew test 38

Slide 39

Slide 39 text

Build Success Fork: https://github.com/DroidKaigi/conference-app-2017 Sample: https://gitlab.com/tetsukay/droidkaigi2017 39

Slide 40

Slide 40 text

CI Feedback 40

Slide 41

Slide 41 text

Merge Request (Pull Request) - CI pass is required to accept MR 41

Slide 42

Slide 42 text

Issue - Display CI progress, and results 42

Slide 43

Slide 43 text

Badge 43

Slide 44

Slide 44 text

gitlab.com 44

Slide 45

Slide 45 text

Gitlab.com git hosting service - Private Repo is FREE - Unlimited Users 45

Slide 46

Slide 46 text

Gitlab.com Gitlab CI - Shared Runner is FREE - Unlimited builds - Unlimited concurrent builds - 4GB RAM - Docker CI only - By Digital Ocean 46

Slide 47

Slide 47 text

Gitlab.com Container Registry - Private Image Repo is FREE - Unlimited private docker images 47

Slide 48

Slide 48 text

Gitlab is best solution! Gitlabはいいぞ! 48

Slide 49

Slide 49 text

Gitlab JP Community - Slack - https://gitlab-jp.herokuapp.com/ - Connpass - https://gitlab-jp.connpass.com/ 49

Slide 50

Slide 50 text

https://www.justsystems.com/jp/employ/ 50