SlideShare a Scribd company logo
1 of 13
Mastering the Jenkins Script Console
Sam Gleske – Integral Ad Science
About me
https://integralads.com/
GitHub user: @samrocketman
Jenkins community account: sag47
Twitter: @sag47
What to expect?
• Introduction to Jenkins Community Infrastructure
• What is the Script Console?
• Quick tips on Groovy
• DEMO: Security implications
• Operationalize Jenkins
• DEMO: The Script Console and Jenkins Configuration
• Links to help you grow
Keep in mind
Be curious and not shy away from source diving.
In the Script Console:
• List methods on a class instance.
– thing.metaClass.methods*.name.sort().unique()
• Determine a class from an instance.
– thing.class or thing.getClass()
Also keep in mind
• How do I configure reliably?
• How do I guarantee bootstrapping Jenkins works the
same way if done a year from now?
• How can I start effectively writing my own scripts?
Jenkins Community Infrastructure
• Artifactory Maven repo for WAR and plugins:
https://repo.jenkins-ci.org/
• Jenkins Update Center lists Maven GAV coordinates
http://updates.jenkins-ci.org/update-center.json
• Source on GitHub:
https://github.com/jenkinsci/jenkins - Jenkins core
https://github.com/jenkinsci/ - most plugins and infra configs
• Example bootstrap:
https://github.com/samrocketman/demo-jenkins-world-2017
https://github.com/jenkinsci/docker
What is the Script Console?
TL;DR Groovy… if you know Java
• Parenthesis on methods optional; Same goes for
semicolons at the end of lines.
• Setters and getters are automatically generated if
they don't already exist.
• Private methods are accessible. Private final
variables can be modified via reflection API.
• instance.getMyMethod() == instance.myMethod
• The last executed statement is the return value.
DEMO: Security Implications
Read passwd and credentials.
Operationalize Jenkins
• Enable CSRF protection.
• Use TLS and secure Jenkins with AuthN/AuthZ.
• Disable Jenkins CLI and any other services which are
not used.
• Do not allow anybody create job permissions.
• Bootstrap Jenkins by pinning the war and plugins to
specific versions. Refer to Jenkins Community
Infrastructure slide.
DEMO: The Script Console
and how it relates to Jenkins configuration.
Links to help you grow
• Learning Groovy - http://groovy-lang.org/learn.html
• Jenkins Community Scripts
https://github.com/jenkinsci/jenkins-scripts
• Script Console in Jenkins Wiki
https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console
• Examples in GitHub OAuth Plugin Wiki
https://wiki.jenkins.io/display/JENKINS/GitHub+OAuth+Plugin
• Configuration via Script Console is growing
https://issues.jenkins-ci.org/browse/JENKINS-31094
https://github.com/sandscape
https://github.com/samrocketman
Jenkins World 2017: Mastering the Jenkins Script Console

More Related Content

Recently uploaded

Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Recently uploaded (20)

Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
Simplilearn
 

Featured (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Jenkins World 2017: Mastering the Jenkins Script Console

  • 1. Mastering the Jenkins Script Console Sam Gleske – Integral Ad Science
  • 2. About me https://integralads.com/ GitHub user: @samrocketman Jenkins community account: sag47 Twitter: @sag47
  • 3. What to expect? • Introduction to Jenkins Community Infrastructure • What is the Script Console? • Quick tips on Groovy • DEMO: Security implications • Operationalize Jenkins • DEMO: The Script Console and Jenkins Configuration • Links to help you grow
  • 4. Keep in mind Be curious and not shy away from source diving. In the Script Console: • List methods on a class instance. – thing.metaClass.methods*.name.sort().unique() • Determine a class from an instance. – thing.class or thing.getClass()
  • 5. Also keep in mind • How do I configure reliably? • How do I guarantee bootstrapping Jenkins works the same way if done a year from now? • How can I start effectively writing my own scripts?
  • 6. Jenkins Community Infrastructure • Artifactory Maven repo for WAR and plugins: https://repo.jenkins-ci.org/ • Jenkins Update Center lists Maven GAV coordinates http://updates.jenkins-ci.org/update-center.json • Source on GitHub: https://github.com/jenkinsci/jenkins - Jenkins core https://github.com/jenkinsci/ - most plugins and infra configs • Example bootstrap: https://github.com/samrocketman/demo-jenkins-world-2017 https://github.com/jenkinsci/docker
  • 7. What is the Script Console?
  • 8. TL;DR Groovy… if you know Java • Parenthesis on methods optional; Same goes for semicolons at the end of lines. • Setters and getters are automatically generated if they don't already exist. • Private methods are accessible. Private final variables can be modified via reflection API. • instance.getMyMethod() == instance.myMethod • The last executed statement is the return value.
  • 9. DEMO: Security Implications Read passwd and credentials.
  • 10. Operationalize Jenkins • Enable CSRF protection. • Use TLS and secure Jenkins with AuthN/AuthZ. • Disable Jenkins CLI and any other services which are not used. • Do not allow anybody create job permissions. • Bootstrap Jenkins by pinning the war and plugins to specific versions. Refer to Jenkins Community Infrastructure slide.
  • 11. DEMO: The Script Console and how it relates to Jenkins configuration.
  • 12. Links to help you grow • Learning Groovy - http://groovy-lang.org/learn.html • Jenkins Community Scripts https://github.com/jenkinsci/jenkins-scripts • Script Console in Jenkins Wiki https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console • Examples in GitHub OAuth Plugin Wiki https://wiki.jenkins.io/display/JENKINS/GitHub+OAuth+Plugin • Configuration via Script Console is growing https://issues.jenkins-ci.org/browse/JENKINS-31094 https://github.com/sandscape https://github.com/samrocketman