Created
August 7, 2019 21:17
-
-
Save sboardwell/54444f6d4efe2c5d3a9e4111443034c4 to your computer and use it in GitHub Desktop.
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
jenkins: | |
Master: | |
Image: my-company/my-project/jenkins-x-image | |
ImageTag: 0.0.70-2 | |
Persistence: | |
mounts: | |
- name: jenkins-security-secrets | |
mountPath: /etc/jenkins-secrets | |
readOnly: true | |
volumes: | |
- name: jenkins-security-secrets | |
secret: | |
secretName: jenkins-security-secrets | |
AdditionalConfig: | |
jenkins.yaml: |- | |
jobs: | |
- script: > | |
import groovy.transform.Field | |
@Field String jobName = 'seed-job' | |
@Field String repoOwnerStr = 'my-company' | |
@Field String repositoryStr = 'jenkins-jobs-dsl' | |
@Field String branchSourceId = "${repoOwnerStr}-${repositoryStr}-${jobName}" | |
multibranchPipelineJob(jobName) { | |
orphanedItemStrategy { | |
discardOldItems { | |
daysToKeep(4) | |
numToKeep(-1) | |
} | |
} | |
branchSources { | |
branchSource { | |
source { | |
github { | |
id(branchSourceId) // IMPORTANT: use a constant and jenkins-wide unique identifier | |
repoOwner(repoOwnerStr) | |
repository(repositoryStr) | |
credentialsId('jx-pipeline-git-github-github') | |
traits { | |
gitHubBranchDiscovery { | |
strategyId(1) | |
} | |
headRegexFilter { | |
regex '^(master|PR-.*)$' | |
} | |
cleanAfterCheckoutTrait() | |
cleanBeforeCheckoutTrait() | |
localBranchTrait() | |
authorInChangelogTrait() | |
} | |
} | |
} | |
buildStrategies { | |
buildNamedBranches { | |
filters { | |
regex { | |
regex '^master$' | |
caseSensitive false | |
} | |
} | |
} | |
buildChangeRequests { | |
ignoreTargetOnlyChanges(false) | |
ignoreUntrustedChanges(false) | |
} | |
} | |
} | |
} | |
factory { | |
workflowBranchProjectFactory { | |
scriptPath('Jenkinsfile') | |
} | |
} | |
configure { | |
def traits = it / sources / data / 'jenkins.branch.BranchSource' / source / traits | |
traits << 'org.jenkinsci.plugins.github__branch__source.OriginPullRequestDiscoveryTrait' { | |
strategyId '1' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment