[FOLIO-2718] Add option to Jenkinsfile to select agent (for Java 11 update) Created: 10/Aug/20  Updated: 19/Aug/20  Resolved: 17/Aug/20

Status: Closed
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: New Feature Priority: TBD
Reporter: Ian Hardy Assignee: Ian Hardy
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Blocks
is blocked by FOLIO-2637 SPIKE: Add Java 11 support to Jenkin... Closed
Relates
relates to CIRC-883 Upgrade to JDK 11 Closed
Sprint: DevOps: Sprint 95
Development Team: FOLIO DevOps

 Description   

Need an option to specify a build should be executed with the new Java 11 build agent (see FOLIO-2637 Closed ). Should be controlled by switch in repo's Jenkinsfile.



 Comments   
Comment by Ian Hardy [ 12/Aug/20 ]

to pick the other agent, just set the buildNode config option to 'jenkins-agent-java11' for buildMvn and buildNPM. Need to find out if there are specific references to java 8 things in the Jenkins libraries.

yes, here: https://github.com/folio-org/jenkins-pipeline-libs/blob/master/vars/buildMvn.groovy#L107

These can be configured in Jenkins > Global Tool Configuration > Maven/JDK. Probably add a new one for j11 and use the setEnv script to pick the right one. Or if there's a common alias for the jdk we could use that and only have one config tbd.

Comment by Ian Hardy [ 13/Aug/20 ]

I added a java 11 config in the Jenkins global tools config for jdk for use by a java 11 build agent. Now setEnvMvn.groovy checks this and sets the appropriate jdk config based on which agent is running the build. https://github.com/folio-org/jenkins-pipeline-libs/pull/95

To run with the new image, set buildNode config like so

buildMvn {
  publishModDescriptor = 'yes'
  runLintRamlCop = 'yes'
  publishAPI = 'yes'
  mvnDeploy = 'yes'
  buildNode = 'jenkins-agent-java11'

  doDocker = {
    buildJavaDocker {
      publishMaster = 'yes'
      healthChk = 'yes'
      healthChkCmd = 'curl -sS --fail -o /dev/null  http://localhost:8081/apidocs/ || exit 1'
    }
  }
}

Builds that do not use the buildMvn or buildNPM pipeline should set the agent:

  agent {
    node {
      label 'jenkins-agent-java11'
    }
  }
Comment by Ian Hardy [ 17/Aug/20 ]

I added this agent template with a max capacity of 1 to each build node in Jenkins. the java 8 image has a max capacity of 2 being more popular for now. In time, we'll want to swap these.

Comment by David Crossley [ 19/Aug/20 ]

Added FAQ https://dev.folio.org/faqs/how-to-specify-backend-java-ci/

Generated at Thu Feb 08 23:22:44 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.