[JIRA] (JENKINS-58491) Cannot configure Nomad plugin with JCasC

0 views
Skip to first unread message

kanthak@freenet.de (JIRA)

unread,
Jul 15, 2019, 6:08:02 AM7/15/19
to jenkinsc...@googlegroups.com
Christian Kanthak created an issue
 
Jenkins / Bug JENKINS-58491
Cannot configure Nomad plugin with JCasC
Issue Type: Bug Bug
Assignee: Ivo Verberk
Components: nomad-plugin
Created: 2019-07-15 10:07
Environment: Jenkins 2.176.1 (docker container)
Nomad plugin 0.6.5
JCasC plugin 1.23
Labels: jcasc-compatibility
Priority: Blocker Blocker
Reporter: Christian Kanthak

JCasC plugin does not apply all of the 'Nomad plugin' related entries from jenkins.yaml although these entries are listed in the JSON schema (<jenkins_url>/configuration-as-code/schema).
In the result the Nomad plugin is not well configured and java.lang.NullPointerException are caused in the plugin's code when a slave is set up (e.g. at org.jenkinsci.plugins.nomad.NomadApi.buildDriverConfig(NomadApi.java:142)).

The missing entries in my case are

  • org.jenkinsci.plugins.nomad.NomadCloud.jenkinsTunnel
  • org.jenkinsci.plugins.nomad.NomadSlaveTemplate.remoteFs
  • org.jenkinsci.plugins.nomad.NomadSlaveTemplate.prefixCmd

If I add them manually to the Jenkins' config.xml the setup of a Nomad slave succeeds.

Beside that the export of the configuration causes an StackOverflowError:

FAILED TO EXPORT
org.jenkinsci.plugins.nomad.NomadSlaveTemplate#cloud: java.lang.StackOverflowError
at java.util.Collections$UnmodifiableCollection$1.<init>(Collections.java:1039)
at java.util.Collections$UnmodifiableCollection.iterator(Collections.java:1038)
...
Caused: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedConstructorAccessor133.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.describe(DataBoundConfigurator.java:265)
at io.jenkins.plugins.casc.Attribute.describe(Attribute.java:202)
at io.jenkins.plugins.casc.BaseConfigurator.compare(BaseConfigurator.java:391)
at io.jenkins.plugins.casc.impl.configurators.DataBoundConfigurator.describe(DataBoundConfigurator.java:268)
at io.jenkins.plugins.casc.Attribute.describe(Attribute.java:198)

This seems to be caused by recursive loop: The cloud definition contains an arry of node templates. Each template definition contains a cloud object which references the cloud object which this template list belongs to.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

kanthak@freenet.de (JIRA)

unread,
Jul 18, 2019, 8:17:02 AM7/18/19
to jenkinsc...@googlegroups.com
Christian Kanthak commented on Bug JENKINS-58491
 
Re: Cannot configure Nomad plugin with JCasC

It pointed out that the missing configuration of

  • org.jenkinsci.plugins.nomad.NomadCloud.jenkinsTunnel
  • org.jenkinsci.plugins.nomad.NomadSlaveTemplate.remoteFs
  • org.jenkinsci.plugins.nomad.NomadSlaveTemplate.prefixCmd

was caused by an error of our automatic setup (which led to a missing update of jenkins.yaml).
I will resolve this issue.

However, it is required to configure these values (also they are empty strings) otherwise java.lang.NullPointerException occur in the NomadAPI.java as mentioned above.

Beside that the StackOverflowError is still caused when exporting configuration of such system with casc plugin.

This recursive definition of nomad cloud (once as top level and then for every slave in templates) enforced us to repeat all values. Here it would be nice to just mention the 'name' property for a slave template to assign the corresponding cloud.
If someone arrives here looking for a definition of nomad cloud and slave via casc this worked for us:

jenkins:
  clouds:
  - nomad:
      jenkinsTunnel: ''
      jenkinsUrl: https://jenkins.url
      name: nomad_cloud
      nomadACLCredentialsId: ''
      nomadUrl: http://nomad.url
      prune: true
      slaveUrl: https://jenkins.url/jnlpJars/slave.jar
      workerTimeout: 1
      templates:
      - cloud:
          jenkinsTunnel: ''
          jenkinsUrl: https://jenkins.url
          name: nomad_cloud
          nomadACLCredentialsId: ''
          nomadUrl: http://nomad.url
          prune: true
          slaveUrl: https://jenkins.url/jnlpJars/slave.jar
          workerTimeout: 1
        cpu: 512
        datacenters: data_center
        disk: 4000
        forcePull: true
        hostVolumes: "/etc/ssl/cacerts:/usr/local/openjdk-8/jre/lib/security/cacerts,"
        idleTerminationInMinutes: 10
        image: jenkins/slave:3.29-2
        labels: nomad_slave
        memory: 1024
        mode: NORMAL
        network: bridge
        numExecutors: 1
        prefix: jenkins_
        prefixCmd: ''
        priority: 50
        privileged: false
        region: global
        remoteFs: ''
        reusable: true

kanthak@freenet.de (JIRA)

unread,
Jul 18, 2019, 8:17:02 AM7/18/19
to jenkinsc...@googlegroups.com
Change By: Christian Kanthak
Status: Open Fixed but Unreleased
Resolution: Cannot Reproduce

jballet@edgelab.ch (JIRA)

unread,
Aug 2, 2019, 12:04:02 PM8/2/19
to jenkinsc...@googlegroups.com

o.v.nenashev@gmail.com (JIRA)

unread,
Sep 16, 2019, 9:34:03 AM9/16/19
to jenkinsc...@googlegroups.com
Oleg Nenashev updated an issue
 
Change By: Oleg Nenashev
Released As: Nomad Plugin 0.6.8
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

o.v.nenashev@gmail.com (JIRA)

unread,
Sep 16, 2019, 9:35:06 AM9/16/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages