Skip to content

Jenkins

Andres Olarte edited this page Aug 1, 2019 · 2 revisions

CLI

Install plugin

java -jar jenkins-cli.jar -auth user:pass -s http://localhost:8080/ install-plugin kubernetes-pipeline-steps

Run script

java -jar jenkins-cli.jar -auth user:pass -s http://localhost:8080/ groovy = < script.groovy

Scripts

Set up global JDK and Maven

import jenkins.model.*

def inst = Jenkins.getInstance()    

def mavenDesc = inst.getDescriptor("hudson.tasks.Maven")
def mavenInst =  new hudson.tasks.Maven.MavenInstallation("default_maven", "/path/to/maven");
mavenDesc.setInstallations(mavenInst)
mavenDesc.save()

def jdkDesc = inst.getDescriptor("hudson.model.JDK")
def jdkInst = new hudson.model.JDK("jdk8", "/path/to/jdk")
jdkDesc.setInstallations( jdkInst )
jdkDesc.save()

Kubernetes slaves

  • JENKINS_URL should point to UI URL: http://jenkins.operations:8080
  • JENKINS_TUNNEL should point to the JNLP host/port: jenkins-agent.operations:50000 (Ensure JNLP is using a fixed port).
Clone this wiki locally