More advanced options type for jobs

74 views
Skip to first unread message

Ben Kaplan

unread,
Feb 14, 2023, 7:08:55 AM2/14/23
to rundeck-discuss
Hello,

We're searching for a way to have more advanced options/inputs to a job.
for example, 
- let's say we have "multi choose options" called "uid"
- each uid can have attributes related to it. let's call one of them "force_update" which is a boolean in this case.

So the options object should be more advanced than what Rundeck is offering at the moment and looks similar to the following structure:

[
  {"name": "uid", "value": "111", "attributes": {"name": "force_update", "value": true} }
  {"name": "uid", "value": "222", "attributes": {"name": "force_update", "value": false} }
  {"name": "uid", "value": "333", "attributes": {"name": "force_update", "value": true} }
]

And the UI should have a corresponding element for each attribute (in the case of a boolean probably a checkbox element) similar to the attached image.

1. We considering writing a plugin for this but is this even possible to add via a plugin? Maybe this is a UI plugin AND an Options plugin?
2. Any other way or ideas to achieve a similar outcome would be much appreciated

Thanks!


Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

Xnip2023-02-14_12-44-22.jpg

rac...@rundeck.com

unread,
Feb 14, 2023, 7:29:27 AM2/14/23
to rundeck-discuss
Hi Ben,

The best approach for that is to create a own option plugin (based on this).

Currently Rundeck only admits this kind of format in the cascade or remote options JSON format.

Regards.

Ben Kaplan

unread,
Feb 14, 2023, 8:35:48 AM2/14/23
to rundeck...@googlegroups.com
Hey, thanks for the prompt reply!

But if Rundeck supports only this format for option, doesn't this means that any plugin we can write will always be required to adhere to this format?
If that is the case then we can't really change the default Option input without adding a more robust Option handling to the Rundeck core no?

We're trying to figure out if this use case is possible to do via plugins at all. Since the added attributes should appear in the UI as well probably this will require at least two plugins
1. extend option value
2. add UI elements to reflect the option's new structure.

Do you think this is possible to achieve only by adding external plugins?

Thanks!

--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rundeck-discuss/2a896ae8-d0a8-4276-a3b3-e4ee1a66b992n%40googlegroups.com.

Ben Kaplan

unread,
May 21, 2023, 3:19:45 PM5/21/23
to rundeck-discuss
Hey!

Reviving this thread to see if anyone can shed some light on the questions above regarding developing plugins to extend the Rundeck Job Options.
1. Can a plugin do what is described here? or is this a more low-level Rundeck Core code that needs to be changed?
2. If this is possible (to extend the option handling of a Rundek Job) and to also present the extended fields in the UI - is this a single plugin or two different plugins (options + UI)?

Thanks!

rac...@rundeck.com

unread,
May 22, 2023, 12:55:58 PM5/22/23
to rundeck-discuss
Hi Ben,

1. That would be possible using the custom plugin but...
2. Regarding the UI plugin it is possible but consider that Rundeck only understands the Name and Value format interface, take a look at this.

Getting the JSON values in an inline script through JQ to extract the desired values based on initial options values in your job is probably the best approach. 

Regards.

Roger McCarrick

unread,
Mar 12, 2024, 3:28:47 PMMar 12
to rundeck-discuss
" Getting the JSON values in an inline script through JQ to extract the desired values based on initial options values in your job is probably the best approach."

I think this is what I am looking for, but I don't know how to do it.

Say I have an option called 'Code" with a drop-down with a list of unique codes. I choose the code "ABC"
I want the next option, call "Country"  to be populated based on that previous option value.

I want the Country option to be calculated by running a bash script.
There is a file on the Rundeck server, codes.json, with all codes in json format, plus another value:

[
{"name":"Always Be Closing", "value":"ABC", "value2":"US"},
{"name":"XrayZebra", "value":"XYZ", "value2":"UK"},
etc
etc
]

I would extract the value2 with

cat /home/rundeck/files/codes.json  | /usr/bin/jq -r '.[''].value2' | grep ABC

I just don't know how to make the value of option "Country" = `cat /home/rundeck/files/codes.json  | /usr/bin/jq -r '.[''].value2' | grep ${option.Code.value}`
Reply all
Reply to author
Forward
0 new messages