Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
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 $JENKIN...
# Assuming "anonymous read access" has been enabled on
your Jenkins instance.
# JENKINS_URL=[root URL of Jenkins master]
#...
(^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,
col...
•
• git pre-commit hook
• Declarative Pipeline linter
• jflint
Próxima SlideShare
Cargando en…5
×

Jenkinsfileのlintで救える命がある

4.845 visualizaciones

Publicado el

https://www.meetup.com/ja-JP/Tokyo-Jenkins-Area-Meetup/events/240833004/
『第10回 Jenkins勉強会』の発表資料です。
Jenkinsfileのlintと自作npmパッケージ "jflint" について話しました。
https://www.npmjs.com/package/jflint

Publicado en: Tecnología
  • Inicia sesión para ver los comentarios

Jenkinsfileのlintで救える命がある

  1. 1. Jenkinsfile lint 
 Miyata Jumpei (@miyajan) Jul 07, 2017 10 Jenkins
  2. 2. ⾃⼰紹介 • 宮⽥ 淳平 (@miyajan) • Cybozu • ⽣産性向上チーム(⼀⼈) • 社内で12のJenkinsを管理してます
  3. 3. Declarative Pipeline 😆
  4. 4. pipeline { agent any stage("Test") { steps { echo "test" } } } よーし、試すぞー
  5. 5. Y^Y^Y^Y^Y
  6. 6. 構⽂間違えた…
  7. 7. Jenkinsfile • • Groovy … • push
  8. 8. Linter • https://jenkins.io/doc/book/pipeline/ development/#linter • SSH curl
  9. 9. # JENKINS_SSHD_PORT=[sshd port on master] # JENKINS_HOSTNAME=[Jenkins master hostname] $ ssh -p $JENKINS_SSHD_PORT $JENKINS_HOSTNAME declarative-linter < Jenkinsfile SSH
  10. 10. # 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
  11. 11. (^o^)
  12. 12. jflint • npm • https://www.npmjs.com/package/jflint • curl REST API
  13. 13. $ npm install jflint -g Install
  14. 14. {   "jenkinsUrl": “http://your-jenkins.example.com” } .jflintrc
  15. 15. $ 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
  16. 16. • • git pre-commit hook
  17. 17. • Declarative Pipeline linter • jflint

×