This is a Jenkins plugin that takes advantage of a Jenkins feature where it runs any groovy scripts located in $JENKINS_HOME/init.groovy.d on startup. These scripts have full access to any classes defined in any installed plugins which is how the System DSL plugin is hooked in. The plugin follows a similar pattern to the Job DSL Plugin and exposes a Groovy based DSL to configure the Jenkins System Configuration and all of the plugins.
com.rei.jenkins.systemdsl.JenkinsSystemConfigDsl.configure { global { url("https://jenkins.rei.com/") environmentVariables([TZ: 'America/Los_Angeles']) quietPeriod(5) } masterNode { numExecutors(4) mode(Node.Mode.NORMAL) } git { author("Jenkins", "jenkins@rei.com") } ... }
The typical way to use this plugin is with a custom docker image that includes the configuration script and this plugin.
FROM jenkins/jenkins:2.107.2-alpine COPY --chown=1000:1000 plugins.txt /usr/share/jenkins/ref/plugins.txt COPY --chown=1000:1000 init.groovy /usr/share/jenkins/ref/init.groovy.d/init.groovy.override # suppresses the new install wizard RUN echo "2.107.2" > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state && \ echo "2.107.2" > /usr/share/jenkins/ref/jenkins.install.InstallUtil.lastExecVersion # installs the plugins, the file contains <pluginid>:<version> one per line RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt ... ADD --chown=1000:1000 "$nexus/releases/com/rei/jenkins/systemdsl/jenkins-system-config-dsl/$dslversion/jenkins-system-config-dsl-$dslversion.hpi" "$refplugins_dir/jenkins-system-config-dsl.hpi.override"
ec2('some value') { ... }
architecture('some value')
description('some value')
executableUsers(null)
filter('some value', 'some value')
imageType(machine)
name('some value')
nameRegex('some value')
ownerAlias(amazon)
owners(null)
platform(windows)
scheduledUpdate(4, TimeUnit.NANOSECONDS)
tag('some value', 'some value')
availabilityZone('some value')
blockDeviceMapping('some value')
connectionStrategy(ConnectionStrategy.PUBLIC_DNS)
description('some value')
hostKeyVerificationStrategy('some value')
hostKeyVerificationStrategy(HostKeyVerificationStrategyEnum.CHECK_NEW_HARD)
iamInstanceProfile('some value')
idleTerminationMinutes(9)
initScript('some value')
instanceCap(1)
instanceType(InstanceType.a1.medium)
instanceType('some value')
jvmopts('some value')
labels(null)
launchTimeout(1)
minInstances(2)
minSpareInstances(9)
mode('NORMAL')
mode(Mode.NORMAL)
numExecutors(6)
remoteFSRoot('some value')
remoteUser('some value')
securityGroups(null)
subnetId('some value')
tag('some value', 'some value')
tenancy(Tenancy.default)
tmpDir('some value')
bootDelay('some value')
rootCommandPrefix('some value')
slaveCommandPrefix('some value')
slaveCommandSuffix('some value')
sshPort(5)
userData('some value')
adminPassword('some value')
bootDelay(7)
credentialsId('some value')
instanceCap(1)
privateKey('some value', 'some value')
privateKey('some value')
region('some value')
roleArn('some value')
roleSessionName('some value')
sshUserName('some value')
awsCredentials('some value', 'some value', 'some value', 'some value')
certificate('some value', 'some value', 'some value', 'some value')
gitlabApiToken('some value', 'some value', 'some value')
secretFile('some value', 'some value', 'some value')
secretFile('some value', 'some value', 'some value', 'some value')
secretText('some value', 'some value', 'some value')
ssh('some value', 'some value', 'some value', 'some value', 'some value')
ssh('some value', 'some value', 'some value', 'some value')
usernamePassword('some value', 'some value', 'some value', 'some value')
awsCredentials('some value', 'some value', 'some value', 'some value')
certificate('some value', 'some value', 'some value', 'some value')
gitlabApiToken('some value', 'some value', 'some value')
secretFile('some value', 'some value', 'some value')
secretFile('some value', 'some value', 'some value', 'some value')
secretText('some value', 'some value', 'some value')
ssh('some value', 'some value', 'some value', 'some value', 'some value')
ssh('some value', 'some value', 'some value', 'some value')
usernamePassword('some value', 'some value', 'some value', 'some value')
adminRequiredForTemplateTesting(true)
allowUnregistered(false)
authentication(jdoe, t0ps3cret)
defaultBody('some value')
defaultContentType('some value')
defaultPostsendScript('some value')
defaultPresendScript('some value')
defaultRecipients(jdoe@example.com)
defaultRecipients(["jdoe@example.com", "jdoe2@example.com"])
defaultReplyTo(jdoe@example.com)
defaultSubject('some value')
defaultSuffix(@example.com)
enableWatching(false)
excludedCommitters('some value')
listId('Build Notifications')
maxAttachmentSize(2)
precedenceBulk(false)
replyToAddress(jdoe@example.com)
scriptClasspath(null)
smtpPort(6)
smtpServer('somehost.example.com')
useSsl(true)
author('John Doe', 'jdoe@example.com')
hostKeyVerificationStrategy('NONE')
hostKeyVerificationStrategy(GitHostKeyVerificationStrategy.NONE)
notifyCommitAccessControlMode(NotifyCommitAccessControlMode.ENABLED)
notifyCommitAccessControlMode('some value')
apiTokenId('some value')
hostUrl('http://localhost/')
name('some value')
adminEmail('jdoe@example.com')
configUrl(https://git.company.com/jenkins/config.groovy)
environmentVariables([SOME_GLOBAL_VAR: 'some value'])
password('API_KEY', 't0ps3cret')
quietPeriod(5)
scmCheckoutRetryCount(5)
systemMessage('some system wide banner message')
authentication(jdoe, t0ps3cret)
defaultSuffix(@example.com)
replyToAddress(jdoe@example.com)
smtpPort(8)
smtpServer('somehost.example.com')
useSsl(true)
labels(['linux', 'build'])
mode('NORMAL')
mode(Mode.NORMAL)
rememberPasswords(true)
addPermission('some value', 'some value')
addPermission('some value', 'some value')
allowBlankRootDN(true)
displayNameAttributeName('some value')
emailAddressAttributeName('some value')
groupSearch('some value')
userSearch('some value')
groupSearchBase('some value')
groupSearchFilter('some value')
managerDN('some value')
managerPasswordSecret('some value')
rootDN('some value')
server('somehost.example.com')
userSearchBase('some value')
userSearchFilter('some value')
buildAfterCreation(false)
configXml('some value', 'some value')
jobDsl('some value')
credentialsId('some value')
stashRootUrl('http://localhost/')
cssUrl('http://localhost/')
faviconUrl('http://localhost/')
jsUrl('http://localhost/')
batchCommand('some value', 'some value')
batchCommand('some value', 'some value', 'some value')
downloadArchive('some value', 'some value')
downloadArchive('some value', 'some value', 'some value')
name('some value')
shellCommand('some value', 'some value')
shellCommand('some value', 'some value', 'some value')
version('some value')
batchCommand('some value', 'some value')
batchCommand('some value', 'some value', 'some value')
downloadArchive('some value', 'some value')
downloadArchive('some value', 'some value', 'some value')
name('some value')
shellCommand('some value', 'some value')
shellCommand('some value', 'some value', 'some value')
version('some value')
batchCommand('some value', 'some value')
batchCommand('some value', 'some value', 'some value')
downloadArchive('some value', 'some value')
downloadArchive('some value', 'some value', 'some value')
name('some value')
oraclePassword('some value')
oracleUsername('some value')
shellCommand('some value', 'some value')
shellCommand('some value', 'some value', 'some value')
version('some value')
batchCommand('some value', 'some value')
batchCommand('some value', 'some value', 'some value')
downloadArchive('some value', 'some value')
downloadArchive('some value', 'some value', 'some value')
name('some value')
shellCommand('some value', 'some value')
shellCommand('some value', 'some value', 'some value')
version('some value')
batchCommand('some value', 'some value')
batchCommand('some value', 'some value', 'some value')
downloadArchive('some value', 'some value')
downloadArchive('some value', 'some value', 'some value')
globalNpmPackageRefreshHours(8)
globalNpmPackages(null)
name('some value')
shellCommand('some value', 'some value')
shellCommand('some value', 'some value', 'some value')
version('some value')