diff --git a/jenkins/Dockerfile b/jenkins/Dockerfile index e89a75c..ab7c7a6 100644 --- a/jenkins/Dockerfile +++ b/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 diff --git a/jenkins/configuration/credentials.groovy b/jenkins/configuration/credentials.groovy index 25f7500..1ca5c6e 100644 --- a/jenkins/configuration/credentials.groovy +++ b/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) ] diff --git a/jenkins/groovy/java.groovy b/jenkins/groovy/java.groovy deleted file mode 100644 index 5c546bf..0000000 --- a/jenkins/groovy/java.groovy +++ /dev/null @@ -1,29 +0,0 @@ -import hudson.model.JDK - -import hudson.tools.InstallSourceProperty - -import hudson.tools.ZipExtractionInstaller - -def descriptor = new JDK.DescriptorImpl(); - -def List 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() \ No newline at end of file diff --git a/jenkins/groovy/nodejs.groovy b/jenkins/groovy/nodejs.groovy new file mode 100644 index 0000000..f7258a6 --- /dev/null +++ b/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[] +} \ No newline at end of file diff --git a/jenkins/plugins.txt b/jenkins/plugins.txt index fbfb223..ad4f886 100644 --- a/jenkins/plugins.txt +++ b/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