Options list empty when using Rundeck plugin for Nexus

106 views
Skip to first unread message

Pål Bøckmann

unread,
Aug 15, 2019, 8:21:34 AM8/15/19
to rundeck-discuss
I am using the following plugin for nexus: https://github.com/nongfenqi/nexus3-rundeck-plugin. This should providesa HTTP endpoint to browse artifacts in my repository from Rundeck. I provide the URL as an options model provider in Rundeck like so:


Capture.PNG


But when I go to my job it tells me that there are no values to choose from:



Capture.PNG


If I go to the URL in my browser I do get a list of the artifacts:


Capture.PNG


I have discovered that I have to be signed in to Nexus to be able to hit the endpoint in my browser. If I log off my user, even though the nexus instance is still running on my server, the JSON list is empty which makes me think my problem has something to do with user access. Is there a way to perhaps provide user credentials through the options model provider so I can access my Nexus repo from Rundeck?







MegaDrive 68k

unread,
Aug 15, 2019, 2:09:49 PM8/15/19
to rundeck-discuss
Hey Pål,

I think that the best way to do that is to use HTTP step plugin, check it: https://github.com/rundeck-plugins/http-step

And you can download the jar file from here: https://github.com/rundeck-plugins/http-step/releases

Then, save the file on your libext directory (usually at /var/lib/rundeck/libext, no need to restart Rundeck service).

Now, at the moment of creating the job you can see a  new step named "HTTP Request Step" (in the Workflow tab) and configure your step like this:

Screenshot_1.png



And don't forget to check "Print Response?" checkbox:

Screenshot_2.png



In your case, that step needs data capture filter to get the JSON values using REGEX. I did a little example using httpbin.org service (a great tool to test!) please play with it:

<joblist>
<job>
<context>
<options preserveOrder='true'>
<option enforcedvalues='true' name='opt1' valuesUrl='http://httpbin.org/headers' />
</options>
</context>
<defaultTab>summary</defaultTab>
<description></description>
<executionEnabled>true</executionEnabled>
<id>ba9a98ec-27ae-40d5-842c-dbeb2a293621</id>
<loglevel>INFO</loglevel>
<name>MyJob</name>
<nodeFilterEditable>false</nodeFilterEditable>
<scheduleEnabled>true</scheduleEnabled>
<sequence keepgoing='false' strategy='node-first'>
<command>
<plugins>
<LogFilter type='key-value-data'>
<config>
<logData>true</logData>
<regex>(.*):\s(.*)</regex>
</config>
</LogFilter>
</plugins>
<step-plugin type='edu.ohio.ais.rundeck.HttpWorkflowStepPlugin'>
<configuration>
<entry key='authentication' value='None' />
<entry key='checkResponseCode' value='false' />
<entry key='headers' value='accept: application/json' />
<entry key='method' value='GET' />
<entry key='printResponse' value='true' />
<entry key='printResponseToFile' value='false' />
<entry key='proxySettings' value='false' />
<entry key='remoteUrl' value='http://httpbin.org/headers' />
<entry key='sslVerify' value='false' />
<entry key='timeout' value='30000' />
</configuration>
</step-plugin>
</command>
</sequence>
<uuid>ba9a98ec-27ae-40d5-842c-dbeb2a293621</uuid>
</job>
</joblist>

So, here you have a very good explanation about how ti works "data capture" filter: https://www.youtube.com/watch?v=ao2SvpspWl4

And here a good place to test your REGEX: https://www.freeformatter.com/java-regex-tester.html#ad-output

Now, after execute you can see the values in data variables:

Screenshot_3.png


Later maybe you need to "format" the data, and maybe this interest you:


Hope it helps!
Message has been deleted

Pål Bøckmann

unread,
Aug 16, 2019, 2:23:09 AM8/16/19
to rundeck-discuss
Thank you for the detailed reply, MegaDrive! I am not sure that this way will achieve what I am trying to do though. Essentially, my goal is to use Rundeck in connection with Nexus to do rollbacks and deploys. So I want to use the options provider in Rundeck to choose a build/jar version from my Nexus repo and then run the deploy job on that version. I could be mistaken here, but the way you described will only get me a list of text that I cannot actually choose anything from, correct?

Pål Bøckmann

unread,
Aug 16, 2019, 7:18:40 AM8/16/19
to rundeck-discuss
Also, as you can see in the readme of the plugin: https://github.com/nongfenqi/nexus3-rundeck-plugin, it is clear that they provide the URL in exactly the same manner as I do and are then able to choose different versions from Nexus. Is it possible that the plugin only works with an older version of Nexus?

Reiner Acuña

unread,
Aug 16, 2019, 9:52:07 AM8/16/19
to rundeck-discuss
Hi Pål,

It's possible that the plugin needs an update, seems that have a couple of years since the last version.

An option that you have is getting the output of HTTP step plugin and put on a JSON file readable by another job using remote options file:/path/to/your/file.json like this:

https://groups.google.com/d/msg/rundeck-discuss/NrVzI9Kx8zw/Yg2yP8MpDwAJ (check the second part).

Regards!

Reiner Acuña

unread,
Aug 16, 2019, 10:56:11 AM8/16/19
to rundeck-discuss
Hey Pål,

Check this plugin, more easy using some step that captures JSON data. Maybe interest you.

https://github.com/rundeck-plugins/jq-json-logfilter

Regards!
Reply all
Reply to author
Forward
0 new messages