Skip to content

Instantly share code, notes, and snippets.

@cowlinator
Last active June 10, 2024 20:56
Show Gist options
  • Save cowlinator/852e2fc68dd0ad32b26e39323134f6e5 to your computer and use it in GitHub Desktop.
Save cowlinator/852e2fc68dd0ad32b26e39323134f6e5 to your computer and use it in GitHub Desktop.
jenkins configuration as code seed job from github enterprise
jobs:
- script: >
multibranchPipelineJob('jenkins-casc-seed') {
def repo = "https://my-github-server/..."
branchSources {
github {
// The id option in the Git and GitHub branch source contexts is now mandatory (JENKINS-43693).
id(UUID.nameUUIDFromBytes(repo.getBytes()).toString()) // IMPORTANT: use a constant and unique identifier
scanCredentialsId('github')
repoOwner('my-org')
repository('my-repository')
apiUri('https://my-github-server/api/v3') // Optional, needed for private github enterprise servers
}
}
orphanedItemStrategy {
discardOldItems {
numToKeep(1)
}
}
triggers {
periodic(5)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment