Browse Source

Update plugins list, Add groovy script for nodejs tool installation, Remove groovy script for java tool installation

master
Apostolos Fanakis 5 years ago
parent
commit
542ed4266f
  1. 6
      jenkins/Dockerfile
  2. 3
      jenkins/configuration/credentials.groovy
  3. 29
      jenkins/groovy/java.groovy
  4. 25
      jenkins/groovy/nodejs.groovy
  5. 4
      jenkins/plugins.txt

6
jenkins/Dockerfile

@ -24,11 +24,11 @@ USER jenkins
COPY configuration/* /var/jenkins_home/init.groovy.d/
# Automatically installs plugins
# COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
# RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
# Adds scripts for tool installation
# COPY groovy/* /usr/share/jenkins/ref/init.groovy.d/
COPY groovy/* /usr/share/jenkins/ref/init.groovy.d/
# Sets defaults
# Gets rid of admin password setup

3
jenkins/configuration/credentials.groovy

@ -2,7 +2,6 @@
// https://gist.github.com/hayderimran7/d6ab8a6a770cb970349e
// https://gist.github.com/ivan-pinatti/de063b610d1bdf2da229c7874968f4d9
// https://support.cloudbees.com/hc/en-us/articles/217708168-create-credentials-from-groovy
import jenkins.model.Jenkins
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import com.cloudbees.plugins.credentials.*
@ -22,7 +21,7 @@ def gitlabSSHKeyParameters = [
description: 'Gitlab SSH Key',
id: 'gitlab-ssh-key',
secret: '',
userName: 'jenkins',
userName: 'git',
key: new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(privateKeyString)
]

29
jenkins/groovy/java.groovy

@ -1,29 +0,0 @@
import hudson.model.JDK
import hudson.tools.InstallSourceProperty
import hudson.tools.ZipExtractionInstaller
def descriptor = new JDK.DescriptorImpl();
def List<JDK> installations = []
javaTools=[['name':'jdk8', 'url':'file:/var/jenkins_home/downloads/jdk-8u131-linux-x64.tar.gz', 'subdir':'jdk1.8.0_131'],
['name':'jdk7', 'url':'file:/var/jenkins_home/downloads/jdk-7u76-linux-x64.tar.gz', 'subdir':'jdk1.7.0_76']]
javaTools.each { javaTool ->
println("Setting up tool: ${javaTool.name}")
def installer = new ZipExtractionInstaller(javaTool.label as String, javaTool.url as String, javaTool.subdir as String);
def jdk = new JDK(javaTool.name as String, null, [new InstallSourceProperty([installer])])
installations.add(jdk)
}
descriptor.setInstallations(installations.toArray(new JDK[installations.size()]))
descriptor.save()

25
jenkins/groovy/nodejs.groovy

@ -0,0 +1,25 @@
#!/usr/bin/env groovy
import hudson.tools.InstallSourceProperty
import jenkins.model.Jenkins
import jenkins.plugins.nodejs.tools.NodeJSInstallation
import jenkins.plugins.nodejs.tools.NodeJSInstaller
import static jenkins.plugins.nodejs.tools.NodeJSInstaller.DEFAULT_NPM_PACKAGES_REFRESH_HOURS
final versions = [
'NodeJS 13.x': '13.10.1'
]
final globalPackages = "eslint@~6.8.0"
Jenkins.instance.getDescriptor(NodeJSInstallation).with {
installations = versions.collect {
new NodeJSInstallation(it.key, null, [
new InstallSourceProperty([
new NodeJSInstaller(
it.value,
globalPackages,
DEFAULT_NPM_PACKAGES_REFRESH_HOURS)
])
])
} as NodeJSInstallation[]
}

4
jenkins/plugins.txt

@ -30,12 +30,15 @@ cloudbees-bitbucket-branch-source
cloudbees-folder
command-launcher
command-launcher.bak
config-file-provider
credentials
credentials-binding
display-url-api
docker-commons
docker-workflow
durable-task
envinject
envinject-api
favorite
git
git-client
@ -58,6 +61,7 @@ mailer
matrix-auth
matrix-project
mercurial
nodejs
pipeline-build-step
pipeline-graph-analysis
pipeline-input-step

Loading…
Cancel
Save