Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Automatic Kotlin Lint with Pipeline and Danger
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Toru Furuya
December 12, 2017
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Automatic Kotlin Lint with Pipeline and Danger
Toru Furuya
December 12, 2017
More Decks by Toru Furuya
See All by Toru Furuya
How To Built Uranow Android App
torufuruya
0
70
Realm Academyのすすめ
torufuruya
0
46
iPhone XでのSafe AreaとWebコンテンツの表示制限について
torufuruya
0
100
Git subtree の導入
torufuruya
0
120
CI as Code の導入
torufuruya
0
47
Objective-Cのpropertyのこと
torufuruya
0
55
Getting Started Yeoman
torufuruya
0
45
Featured
See All Featured
BBQ
matthewcrist
89
10k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
340
GitHub's CSS Performance
jonrohan
1033
470k
Thoughts on Productivity
jonyablonski
76
5.2k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
330
Prompt Engineering for Job Search
mfonobong
0
350
Making the Leap to Tech Lead
cromwellryan
135
9.9k
RailsConf 2023
tenderlove
30
1.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Mobile First: as difficult as doing things right
swwweet
225
10k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
Transcript
Automatic Kotlin Lint with Pipeline and Danger 2017.12.12 Toru Furuya
Motivation • メンバー全員Kotlin初心者でスタンダードを知らない • KotlinはJavaに比べていろいろな書き方ができる • プロダクト立ち上げ段階でPull Requestのdiffが多い • コードの書き方までレビューしてる時間がない
• アプリができあがってから見直しても後の祭り コードの静的解析くらいロボットにお願いしよう
Technologies • ktlint https://ktlint.github.io/ • Danger http://danger.systems/ruby/ • Jenkins Pipeline
https://jenkins.io/doc/book/pipeline/
Overall Flow ① ② ③ ④
Where I stumbled • “Unsupported major.minor version 52.0” • JenkinsのGUIで設定した環境変数がPipelineに反映されない
Unsupported major.minor version 52.0 FAILURE: Build failed with an exception.
* Where: Build file '/Users/jenkins/slave/workspace/lin_lint_with_danger_sample-37UQRG6OZVNIAO KNEBT2PGCXB45NC2DGDDSAFAOEJQ2T34JOTKUA/app/build.gradle' line: 1 * What went wrong: A problem occurred evaluating project ':app'. > java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
• コンパイラのJDKのバージョンと実行環境のJVMのバージョンが異なる • Pipelineのstepにログを仕込んだら JAVA_HOME = 1.8.0 なのに javac =
1.7.0 だっ た • バージョンを合わせることで解決 Unsupported major.minor version 52.0
• JenkinsのGUIでJDKのPATHを設定 • Pipelineのtoolsディレクティブで利用するJDKを宣言 Jenkinsfile Unsupported major.minor version 52.0 pipeline
{ agent any tools { jdk 'jdk8' }
JenkinsのGUIで設定した環境変数が反映されない • 画像のように環境変数を設定してもビルドが失敗する
JenkinsのGUIで設定した環境変数が反映されない • GUIで設定してもJenkins Pipelineには影響しない • Pipelineのenvironmentディレクティブを利用することで解決 Jenkinsfile pipeline { agent
any environment { DANGER_GITHUB_HOST = 'xxxx.net' DANGER_GITHUB_API_BASE_URL = 'https://xxxx.net/api/v3' DANGER_GITHUB_API_TOKEN = credentials('DANGER_GITHUB_API_TOKEN') }
Deliverables
Fin