SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Jenkinsfile lint 

Miyata Jumpei (@miyajan)
Jul 07, 2017
10 Jenkins
⾃⼰紹介
• 宮⽥ 淳平 (@miyajan)
• Cybozu
• ⽣産性向上チーム(⼀⼈)
• 社内で12のJenkinsを管理してます
Declarative Pipeline 😆
pipeline {
agent any
stage("Test") {
steps {
echo "test"
}
}
}
よーし、試すぞー
Y^Y^Y^Y^Y
構⽂間違えた…
Jenkinsfile
•
• Groovy …
• push
Linter
• https://jenkins.io/doc/book/pipeline/
development/#linter
• SSH curl
# JENKINS_SSHD_PORT=[sshd port on master]
# JENKINS_HOSTNAME=[Jenkins master hostname]
$ ssh -p $JENKINS_SSHD_PORT $JENKINS_HOSTNAME
declarative-linter < Jenkinsfile
SSH
# Assuming "anonymous read access" has been enabled on
your Jenkins instance.
# JENKINS_URL=[root URL of Jenkins master]
# JENKINS_CRUMB is needed if your Jenkins master has CRSF
protection enabled as it should
$ JENKINS_CRUMB=`curl "$JENKINS_URL/crumbIssuer/api/xml?
xpath=concat(//crumbRequestField,":",//crumb)"`
curl -X POST -H $JENKINS_CRUMB -F
"jenkinsfile=<Jenkinsfile" $JENKINS_URL/pipeline-model-
converter/validate
curl
(^o^)
jflint
• npm
• https://www.npmjs.com/package/jflint
• curl REST API
$ npm install jflint -g
Install
{
  "jenkinsUrl": “http://your-jenkins.example.com”
}
.jflintrc
$ jflint Jenkinsfile
Errors encountered validating Jenkinsfile:
WorkflowScript: 4: Undefined section "stage" @ line 4,
column 5.
stage("Test") {
^
WorkflowScript: 1: Missing required section "stages" @
line 1, column 1.
pipeline {
^
Usage
•
• git pre-commit hook
• Declarative Pipeline linter
• jflint

Contenu connexe

Tendances

Tendances (20)

JIRA / Confluence の 必須プラグインはこれだ
JIRA / Confluence の必須プラグインはこれだJIRA / Confluence の必須プラグインはこれだ
JIRA / Confluence の 必須プラグインはこれだ
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行
 
Dockerからcontainerdへの移行
Dockerからcontainerdへの移行Dockerからcontainerdへの移行
Dockerからcontainerdへの移行
 
Mavenの真実とウソ
Mavenの真実とウソMavenの真実とウソ
Mavenの真実とウソ
 
【BS3】Visual Studio 2022 と .NET 6 での Windows アプリ開発技術の紹介
【BS3】Visual Studio 2022 と .NET 6 での Windows アプリ開発技術の紹介 【BS3】Visual Studio 2022 と .NET 6 での Windows アプリ開発技術の紹介
【BS3】Visual Studio 2022 と .NET 6 での Windows アプリ開発技術の紹介
 
Dockerfileを改善するためのBest Practice 2019年版
Dockerfileを改善するためのBest Practice 2019年版Dockerfileを改善するためのBest Practice 2019年版
Dockerfileを改善するためのBest Practice 2019年版
 
BuildKitの概要と最近の機能
BuildKitの概要と最近の機能BuildKitの概要と最近の機能
BuildKitの概要と最近の機能
 
Jenkins x Kubernetesが簡単だと思ったら大変だった話
Jenkins x Kubernetesが簡単だと思ったら大変だった話Jenkins x Kubernetesが簡単だと思ったら大変だった話
Jenkins x Kubernetesが簡単だと思ったら大変だった話
 
Building the Game Server both API and Realtime via c#
Building the Game Server both API and Realtime via c#Building the Game Server both API and Realtime via c#
Building the Game Server both API and Realtime via c#
 
MagicOnion入門
MagicOnion入門MagicOnion入門
MagicOnion入門
 
Jenkinsの構成・運用パターン
Jenkinsの構成・運用パターンJenkinsの構成・運用パターン
Jenkinsの構成・運用パターン
 
Javaのログ出力: 道具と考え方
Javaのログ出力: 道具と考え方Javaのログ出力: 道具と考え方
Javaのログ出力: 道具と考え方
 
Oracle Database (CDB) on Docker を動かしてみる
Oracle Database (CDB) on Docker を動かしてみるOracle Database (CDB) on Docker を動かしてみる
Oracle Database (CDB) on Docker を動かしてみる
 
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
 
こわくない Git
こわくない Gitこわくない Git
こわくない Git
 
基礎からのOAuth 2.0とSpring Security 5.1による実装
基礎からのOAuth 2.0とSpring Security 5.1による実装基礎からのOAuth 2.0とSpring Security 5.1による実装
基礎からのOAuth 2.0とSpring Security 5.1による実装
 
CRX: Container Runtime Executive 
CRX: Container Runtime Executive CRX: Container Runtime Executive 
CRX: Container Runtime Executive 
 
新たなgitのブランチモデル「Git Feature Flow」!Git Flow,Git Hub Flow,Git Lab Flowを超えれるか?
新たなgitのブランチモデル「Git Feature Flow」!Git Flow,Git Hub Flow,Git Lab Flowを超えれるか?新たなgitのブランチモデル「Git Feature Flow」!Git Flow,Git Hub Flow,Git Lab Flowを超えれるか?
新たなgitのブランチモデル「Git Feature Flow」!Git Flow,Git Hub Flow,Git Lab Flowを超えれるか?
 
今だからこそ知りたい Docker Compose/Swarm 入門
今だからこそ知りたい Docker Compose/Swarm 入門今だからこそ知りたい Docker Compose/Swarm 入門
今だからこそ知りたい Docker Compose/Swarm 入門
 
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
Docker入門-基礎編 いまから始めるDocker管理【2nd Edition】
 

Similaire à Jenkinsfileのlintで救える命がある

The challenge - testing the oVirt project
The challenge - testing the oVirt projectThe challenge - testing the oVirt project
The challenge - testing the oVirt project
Eyal Edri
 

Similaire à Jenkinsfileのlintで救える命がある (20)

Graduating to Jenkins CI for Ruby(-on-Rails) Teams
Graduating to Jenkins CI for Ruby(-on-Rails) TeamsGraduating to Jenkins CI for Ruby(-on-Rails) Teams
Graduating to Jenkins CI for Ruby(-on-Rails) Teams
 
JUC NY - Advanced Continuous Deployment with Jenkins
JUC NY - Advanced Continuous Deployment with JenkinsJUC NY - Advanced Continuous Deployment with Jenkins
JUC NY - Advanced Continuous Deployment with Jenkins
 
Jenkins State of union 2013
Jenkins State of union 2013Jenkins State of union 2013
Jenkins State of union 2013
 
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015
Un jenkins amélioré avec docker mesos et marathon à Devoxx 2015
 
Grooving with Jenkins
Grooving with JenkinsGrooving with Jenkins
Grooving with Jenkins
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Jenkins 1
Jenkins 1Jenkins 1
Jenkins 1
 
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015
Making Enterprise-Ready Plugins - Kaj Kandler JUC West 2015
 
Intro to Pentesting Jenkins
Intro to Pentesting JenkinsIntro to Pentesting Jenkins
Intro to Pentesting Jenkins
 
The challenge - testing the oVirt project
The challenge - testing the oVirt projectThe challenge - testing the oVirt project
The challenge - testing the oVirt project
 
Jenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And GroovyJenkins Plugin Development With Gradle And Groovy
Jenkins Plugin Development With Gradle And Groovy
 
JUC Europe 2015: Plugin Development with Gradle and Groovy
JUC Europe 2015: Plugin Development with Gradle and GroovyJUC Europe 2015: Plugin Development with Gradle and Groovy
JUC Europe 2015: Plugin Development with Gradle and Groovy
 
Jenkins Scriptler in 90mins
Jenkins Scriptler in 90minsJenkins Scriptler in 90mins
Jenkins Scriptler in 90mins
 
Seven Habits of Highly Effective Jenkins Users (2014 edition!)
Seven Habits of Highly Effective Jenkins Users (2014 edition!)Seven Habits of Highly Effective Jenkins Users (2014 edition!)
Seven Habits of Highly Effective Jenkins Users (2014 edition!)
 
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
 
Hacking Jenkins
Hacking JenkinsHacking Jenkins
Hacking Jenkins
 
Meet my CI
Meet my CIMeet my CI
Meet my CI
 
JUC NYC 2012: Yale Build and Deployment with Jenkins
JUC NYC 2012: Yale Build and Deployment with JenkinsJUC NYC 2012: Yale Build and Deployment with Jenkins
JUC NYC 2012: Yale Build and Deployment with Jenkins
 
State of the Jenkins Automation
State of the Jenkins AutomationState of the Jenkins Automation
State of the Jenkins Automation
 
Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜
Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜
Jenkins 2.0 最新事情 〜Make Jenkins Great Again〜
 

Plus de Jumpei Miyata

Plus de Jumpei Miyata (17)

開発者の生産性向上を妨げる障壁と サイボウズの生産性向上チームの取り組み
開発者の生産性向上を妨げる障壁とサイボウズの生産性向上チームの取り組み開発者の生産性向上を妨げる障壁とサイボウズの生産性向上チームの取り組み
開発者の生産性向上を妨げる障壁と サイボウズの生産性向上チームの取り組み
 
オートスケールする GitHub Actions セルフホストランナーを構築してる話
オートスケールする GitHub Actions セルフホストランナーを構築してる話オートスケールする GitHub Actions セルフホストランナーを構築してる話
オートスケールする GitHub Actions セルフホストランナーを構築してる話
 
GitHub Actions のはじめかた
GitHub Actions のはじめかたGitHub Actions のはじめかた
GitHub Actions のはじめかた
 
サイボウズの開発を支える GitHub × CircleCI
サイボウズの開発を支える GitHub × CircleCIサイボウズの開発を支える GitHub × CircleCI
サイボウズの開発を支える GitHub × CircleCI
 
サイボウズを支えるCircleCI
サイボウズを支えるCircleCIサイボウズを支えるCircleCI
サイボウズを支えるCircleCI
 
サイボウズの CI/CD 事情 〜Jenkins おじさんは CircleCI おじさんにしんかした!〜
サイボウズの CI/CD 事情 〜Jenkins おじさんは CircleCI おじさんにしんかした!〜サイボウズの CI/CD 事情 〜Jenkins おじさんは CircleCI おじさんにしんかした!〜
サイボウズの CI/CD 事情 〜Jenkins おじさんは CircleCI おじさんにしんかした!〜
 
組織横断でエンジニアを支援する生産性向上チームの役割
組織横断でエンジニアを支援する生産性向上チームの役割組織横断でエンジニアを支援する生産性向上チームの役割
組織横断でエンジニアを支援する生産性向上チームの役割
 
【PR】エンジニアがkintoneを試すべき3つの理由
【PR】エンジニアがkintoneを試すべき3つの理由【PR】エンジニアがkintoneを試すべき3つの理由
【PR】エンジニアがkintoneを試すべき3つの理由
 
すべてを自動化せよ! 〜生産性向上チームの挑戦〜
すべてを自動化せよ! 〜生産性向上チームの挑戦〜すべてを自動化せよ! 〜生産性向上チームの挑戦〜
すべてを自動化せよ! 〜生産性向上チームの挑戦〜
 
受入試験を自動化したらDevとQAのフィードバックループがまわりはじめた話
受入試験を自動化したらDevとQAのフィードバックループがまわりはじめた話受入試験を自動化したらDevとQAのフィードバックループがまわりはじめた話
受入試験を自動化したらDevとQAのフィードバックループがまわりはじめた話
 
Effective Automation 〜変化に強い開発基盤〜
Effective Automation 〜変化に強い開発基盤〜Effective Automation 〜変化に強い開発基盤〜
Effective Automation 〜変化に強い開発基盤〜
 
開発者を支える生産性向上チームの取り組み -CI, Browser Test, Tools and Infrastructure-
開発者を支える生産性向上チームの取り組み -CI, Browser Test, Tools and Infrastructure-開発者を支える生産性向上チームの取り組み -CI, Browser Test, Tools and Infrastructure-
開発者を支える生産性向上チームの取り組み -CI, Browser Test, Tools and Infrastructure-
 
テストエンジニアと組織構造 @Cybozu
テストエンジニアと組織構造 @Cybozuテストエンジニアと組織構造 @Cybozu
テストエンジニアと組織構造 @Cybozu
 
Selenium Antipatterns
Selenium AntipatternsSelenium Antipatterns
Selenium Antipatterns
 
kintoneチームを支えるSeleniumテスト
kintoneチームを支えるSeleniumテストkintoneチームを支えるSeleniumテスト
kintoneチームを支えるSeleniumテスト
 
Selenium Conference 2015 参加報告
Selenium Conference 2015 参加報告Selenium Conference 2015 参加報告
Selenium Conference 2015 参加報告
 
ハイパフォーマンスSeleniumテスト@サイボウズ
ハイパフォーマンスSeleniumテスト@サイボウズハイパフォーマンスSeleniumテスト@サイボウズ
ハイパフォーマンスSeleniumテスト@サイボウズ
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Jenkinsfileのlintで救える命がある