jenkinsci / nomad-plugin

Nomad cloud plugin for Jenkins
https://plugins.jenkins.io/nomad/
MIT License
56 stars 41 forks source link

Issue migrating worker template from 0.6.10 to 0.9.1 #111

Closed seanennis closed 2 years ago

seanennis commented 2 years ago

Hey I'm sorry if opening an issue wasn't the best was to go about asking this, but I wasn't sure where else to ask.

So the upgrade from 0.6.10 to 0.9.1 lost my config and I've been trying to translate the old config into the new format by hand. I have a working template using the default docker task driver config, though when I try to use the java driver I'm having some issues. It seems in the old templates it was as simple as declaring <driver>java</driver> which also seemed to be the default driver config.

Taking a look at the source code from version 0.6.10 it seems like the rest of the java driver config was was defined as follows (written as I've defined it in the new job template variable)

      ```{
        "Name": "jenkins-worker",
        "Driver": "java",
        "Config": {
        "jar_path": "/local/slave.jar",
        "args": ["-jnlpUrl", "https://<jenkins-host>/computer/%WORKER_NAME%/slave-agent.jnlp", "-secret", "%WORKER_SECRET%"]
      },```

If I check the allocation logs I get the following error Error: Unable to access jarfile /local/slave.jar

Any ideas why that may be or any tips on porting over old driver configs? Also if there is a better place to ask this I'd be more than happy to close this issue and ask there.

multani commented 2 years ago

@seanennis Can you share the whole task configuration?

There should be a Artifact definition somewhere, that downloads the slave.jar file from Jenkins and put it in /local/slave.jar.

multani commented 2 years ago

Something like this:

            "Artifacts": [
              {
                "GetterSource": "http://jenkins:8080/jnlpJars/slave.jar",
                "RelativeDest": "/local/"
              }
            ],

At the same level as Config. You will need to adjust the GetterSource value to point to your Jenkins URL.

seanennis commented 2 years ago

@multani That was a very quick reply, thank you. That seems to have fixed it!