-
-
Save wilsonmar/b183a7c5eb4d34e4e6d82c4ec1a11dee to your computer and use it in GitHub Desktop.
CodingWithMe Learn JobDSL for Jenkins in 90 minutes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
freeStyleJob("Hello3") { | |
logRotator(2, 30) | |
scm { | |
git('https://github.com/larrycai/docker-images.git') | |
} | |
triggers { | |
scm('H/15 * * * *') | |
} | |
wrappers { | |
preBuildCleanup() | |
} | |
steps { | |
shell('echo "build success" >> status.txt') | |
} | |
publishers { | |
archiveArtifacts("status.txt") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
freeStyleJob("Hello5") { | |
logRotator(2, 30) | |
scm { | |
git('https://github.com/larrycai/docker-images.git') | |
} | |
triggers { | |
scm('H/15 * * * *') | |
} | |
wrappers { | |
preBuildCleanup() | |
} | |
steps { | |
shell('echo "build success" >> status.txt') | |
} | |
publishers { | |
archiveArtifacts("status.txt") | |
configure { project -> | |
project / publishers << "hudson.plugins.testng.Publisher" { | |
reportFilenamePattern("**/testng-results.xml") | |
escapeTestDescp(true) | |
escapeExceptionMsg(true) | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def giturl = "https://github.com/larrycai/docker-images.git" | |
json = readFileFromWorkspace("HelloWorld","views.json") | |
views = new groovy.json.JsonSlurper().parseText(json)["views"] | |
views.each { view -> | |
(0..9).each { i -> | |
job("${view}-DSL-Tutorial-${i}") { | |
scm { | |
git(giturl) | |
} | |
steps { | |
shell('echo "this is job${i}"') | |
} | |
} | |
} | |
listView(view) { | |
jobs { | |
regex("${view}-.*") | |
} | |
columns { | |
status() | |
weather() | |
name() | |
lastSuccess() | |
lastFailure() | |
lastDuration() | |
buildButton() | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"views" : ["Compile","Package","Release"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment