@jeanneboyarsky Jeanne Boyarsky Tuesday May 21, 2018 Oracle Code New York DevSecOps: The Java Developer’s Guide to Automating with Groovy speakerdeck.com/boyarsky
@jeanneboyarsky Multiline string 10 def name = 'Jeanne' def text = """ Name ______ $name """ Name ______ Jeanne Coming in Java 13 (raw string literals) 14? (text blocks) with new syntax
@jeanneboyarsky ArrayList++ 17 def list = ['cookie', 'chocolate’] list << 'candy' println list.getClass() class java.util.ArrayList println list[1] chocolate ArrayList does what now?!
@jeanneboyarsky Named Params def config = new SelectorConfiguration( name: ‘selector', description: ‘packages', ) 25 Only the default constructor exists!
@jeanneboyarsky More on Groovy http://groovy-lang.org/style-guide.html http://docs.groovy-lang.org/next/html/ documentation/working-with-collections.htm http://docs.groovy-lang.org/2.4.7/html/groovy-jdk/ overview-summary.html 26
@jeanneboyarsky Script Security Plugin 38 ERROR: Build step failed with exception org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessExce ption: Scripts not permitted to use staticMethod jenkins.model.Jenkins getInstance Options: • Approve each script manually • Sandbox - whitelist APIs • Authorized Build plugin to run as admin
@jeanneboyarsky And then there is 42 container GlobalComponentLookupHelper selectorManager = container.lookup(SelectorManager.class.name) securitySystem = container.lookup(SecuritySystem.class.name) authorizationManager = securitySystem.getAuthorizationManager('default')
@jeanneboyarsky What we will cover Code Examples Walkthrough • Nexus object model • Jenkins object model • Jenkins pipeline Demo – Nexus and Jenkins 45