Skip to content

Instantly share code, notes, and snippets.

@jjtroberts
Created November 30, 2016 14:37
Show Gist options
  • Save jjtroberts/2e3482040f6dce72d8decaa8ce1abeb5 to your computer and use it in GitHub Desktop.
Save jjtroberts/2e3482040f6dce72d8decaa8ce1abeb5 to your computer and use it in GitHub Desktop.
Groovy Pipeline Script
def myFolderName = "xxxxxxxxxxxxxx"
def mySlug = "xxxxxxxxxxxxxx"
def myDisplayName = "xxxxxxxxxxxxxx"
// Ensure plugin directory exists so the job dsls succeed
folder("platform/themes/${myFolderName}") {
displayName("${myDisplayName}")
}
pipelineJob("platform/themes/${myFolderName}/branch-builder") {
definition {
quietPeriod(0)
logRotator {
daysToKeep(-1)
numToKeep(5)
}
parameters {
stringParam('parentBranch', '', 'Parent Branch')
stringParam('childSlug', "${mySlug}", 'Child Repo Slug')
stringParam('childBranch', '', 'Child Branch')
choiceParam('gulpBuild', ['Yes', 'No'], 'Gulp Build Required')
}
cpsScm {
scm {
git{
remote {
name('origin')
url('xxxxxxxxxxxx.git')
}
branch('master')
}
scriptPath('platform/themes/common/branchBuilder.groovy')
}
}
publishers {
slackNotifier {
room('jenkins')
notifyAborted(true)
notifyFailure(true)
notifyNotBuilt(true)
notifyUnstable(true)
notifyBackToNormal(true)
notifySuccess(false)
notifyRepeatedFailure(false)
startNotification(false)
includeTestSummary(false)
includeCustomMessage(false)
customMessage(null)
buildServerUrl(null)
sendAs(null)
commitInfoChoice('NONE')
teamDomain(null)
authToken(null)
}
}
}
}
pipelineJob("platform/themes/${myFolderName}/tag-builder") {
definition {
quietPeriod(0)
logRotator {
daysToKeep(-1)
numToKeep(5)
}
parameters {
stringParam('parentTag', '', 'Parent Tag')
stringParam('childSlug', "${mySlug}", 'Child Repo Slug')
stringParam('childTag', '', 'Child Tag')
choiceParam('gulpBuild', ['Yes', 'No'], 'Gulp Build Required')
}
cpsScm {
scm {
git{
remote {
name('origin')
url('xxxxxxxxxxxxxxxx.git')
}
branch('master')
}
scriptPath('platform/themes/common/tagBuilder.groovy')
}
}
publishers {
slackNotifier {
room('jenkins')
notifyAborted(true)
notifyFailure(true)
notifyNotBuilt(true)
notifyUnstable(true)
notifyBackToNormal(true)
notifySuccess(false)
notifyRepeatedFailure(false)
startNotification(false)
includeTestSummary(false)
includeCustomMessage(false)
customMessage(null)
buildServerUrl(null)
sendAs(null)
commitInfoChoice('NONE')
teamDomain(null)
authToken(null)
}
}
}
}
multibranchPipelineJob("platform/themes/${myFolderName}/multidev") {
branchSources {
branchSource {
source {
bitbucketSCMSource {
id(mySlug)
repoOwner("xxxxxxxxxxxxxxx")
repository(mySlug)
autoRegisterHook(true)
credentialsId(scanCredentials)
checkoutCredentialsId(checkoutCredentials)
includes("*")
sshPort(-1)
}
}
}
}
orphanedItemStrategy {
discardOldItems {
numToKeep(0)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment