You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/manual/jobs/job-options.md
+73-25Lines changed: 73 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,15 +43,6 @@ level of procedure formalization.
43
43
value be somewhat open ended consider how you can create
44
44
safeguards to control their choice.
45
45
46
-
## Input Types
47
-
48
-
Option Input Types define how the option is presented in the GUI, and how it is used when the Job executes.
49
-
50
-
Input types:
51
-
52
-
- "Plain" - a normal option which is shown in clear text
53
-
- "Secure" - a secure option which is obscured at user input time, and the value of which is not stored in the database. See [secure-options](#secure-options).
54
-
- "Secure Remote Authentication" - a secure option which is used only for remote authentication and is not exposed in scripts or commands. See [secure-remote-authentication-options](#secure-remote-authentication-options).
55
46
56
47
## Options editor
57
48
@@ -87,37 +78,54 @@ loaded to the Rundeck server. See [job-xml](/manual/document-format-reference/jo
87
78
88
79
## Defining an option
89
80
90
-
**Text Options**
91
-
92
81
New options can be defined by pressing the "Add an option" link while
93
82
existing ones can be changed by pressing their "edit" link.
94
83
84
+
### Option Types
85
+
86
+
Options can be one of these types:
87
+
88
+
*[Text](#text-option-type) - a single line of text, or multiple values
89
+
*[File](#file-option-type) - a File upload option
90
+
*[Multiline Text](#multiline-text-option-type) - multiple lines of text
91
+
92
+
Depending on the Option Type selected, different configuration options are available.
93
+
94
+
### Text Option Type
95
+
96
+
95
97
Choose "Text" from the Option Type:
96
98
97
99

98
100
99
101
The option definition form is organized into several areas:
100
102
101
-
Identification
103
+
Option Name
102
104
103
-
: Here you provide the option's name and description. The name
104
-
becomes part of acceptable arguments to the Job while the
105
-
description will be provided as help text to users running the Job.
105
+
: Here you provide the option's name. This value
106
+
will be used to reference the option variable within steps of the Job.
106
107
107
-
The Default Value will be pre-selected in the GUI when the option is presented.
108
+
Option Label
109
+
110
+
: An optional display label shown in place of the Option Name when viewed in the GUI.
111
+
112
+
Description
113
+
114
+
: This will be provided as help text to users running the Job.
115
+
116
+
Default Value
117
+
118
+
: A Default Value will automatically be set for the option if it is not otherwise specified by the user, even if not specified among the arguments when executing a job via the command-line or API. Note that a blank value can be specified via the command-line or API, which will override the use of the Default Value.
108
119
109
120
Input Type
110
121
111
-
: Choose between "Plain", "Date", "Secure" and "Secure Remote Authentication". For input types other than "Plain", the multi-valued option will be disabled.
122
+
: Choose between "Plain", "Date", "Plain Text with Password Input" and "Secure Remote Authentication". For input types other than "Plain", the multi-valued option will be disabled.
112
123
113
124
Date Format
114
125
115
126
: If "Date" Input Type is chosen, you can enter a date format to use when selecting the date
116
127
in the user interface. Using the [momentjs format](https://momentjs.com/docs/#/displaying/format/).
117
128
118
-
Default Value
119
-
120
-
: A Default Value will automatically be set for the option if it is not otherwise specified by the user, even if not specified among the arguments when executing a job via the command-line or API. Note that a blank value can be specified via the command-line or API, which will override the use of the Default Value.
121
129
122
130
Allowed values
123
131
@@ -136,7 +144,7 @@ popup menu. If set "false", a text field will also be presented.
136
144
Enter a regular expression in the "Match Regular Expression"
137
145
field the Job will evaluate when run.
138
146
139
-
Requirement
147
+
Required
140
148
141
149
: Indicates if the Job can only run if a non-blank value is provided for
142
150
that Option. Choose "No" to indicate that a blank value is allowed, and
@@ -166,7 +174,20 @@ Usage (see below)
166
174
167
175

168
176
169
-
### Option timestamp variable
177
+
178
+
#### Input Types
179
+
180
+
For Text Option types, the Input Type defines how the text option is presented in the GUI, and how it is used when the Job executes.
181
+
182
+
Input types:
183
+
184
+
- "Plain" - a normal option which is shown in clear text
185
+
186
+
- "Date" - A Date input which can produce a date string in a user-defined format.
187
+
- "Plain Text with Password Input" - an option which is obscured at user input time, and the value of which is not stored in the database, but is exposed in scripts and commands. See [secure-options](#secure-options).
188
+
- "Secure Remote Authentication" - a secure option which is used only for remote authentication and is not exposed in scripts or commands. See [secure-remote-authentication-options](#secure-remote-authentication-options).
189
+
190
+
#### Option timestamp variable
170
191
171
192
You can use the string `${DATE:format}` as a job option value (either as a default value or as input by the user), which will be converted when the job/command is executed.
172
193
This variable also allows you to add or remove days as you can see below.
@@ -199,6 +220,31 @@ The `option.NAME` variable will contain a unique ID identifying the uploaded fil
199
220
200
221
`file.NAME.sha` will be the SHA256 hash of the file.
201
222
223
+
### Multiline Text Option Type
224
+
225
+
:::betafeature Beta Feature (Since v5.17.0)
226
+
227
+
**This is a Beta feature.** To enable this feature, add the config `rundeck.feature.multilineJobOptions.enabled=true`
228
+
:::
229
+
230
+
::: danger Important
231
+
If you disable the `multilineJobOptions` feature flag after creating jobs with multiline options, **those options may become unusable**. The enforced setting and other configurations may not persist correctly when the feature is re-enabled. If this occurs, the only solution is to delete the affected options and recreate them completely. It is recommended to leave the feature enabled once you have jobs using multiline options.
232
+
:::
233
+
234
+
Choose "Multiline Text" from the Option Type dropdown:
235
+
236
+

237
+
238
+
Default Value
239
+
240
+
: Enter a multi-line string to use as a default value.
241
+
242
+
Restrictions
243
+
244
+
: Choose None, or "Match Regular Expression". If a Regular expression is used, be aware that for multiline input, the default behavior of the Java Pattern match will not match across multiple lines. You must use the "s" flag, which can be done by including `(?s)` in the regular expression.
245
+
246
+
247
+
202
248
## Script usage
203
249
204
250
Option values can be passed to scripts as an argument or referenced
@@ -221,9 +267,9 @@ forms to access the value of the "message" option.
221
267
222
268
```bash .numberLines
223
269
#!/bin/sh
224
-
echo envvar=$RD_OPTION_MESSAGE;# access message as environment variable.
225
-
echo args=$1;# read value passed into argument vector
226
-
echo[email protected]@ ;# access message via replacement token syntax
270
+
echo envvar="$RD_OPTION_MESSAGE";# access message as environment variable.
271
+
echo args="$1";# read value passed into argument vector
272
+
echo message="@option.message@";# access message via replacement token syntax
227
273
```
228
274
229
275
When the user runs the "hello" job they will be prompted for the
@@ -347,6 +393,8 @@ echo "$1"
347
393
348
394
Which allows the shell will correctly handle the input value by quoting it.
349
395
396
+
Note: for Multiline Text options, some shells like Bash will not expand a variable with multiple lines exactly as it was entered, *unless* the variable is quoted.
397
+
350
398
::: tip
351
399
When running a command, the value of `${option.name}` will be escaped with single quotes by default.
352
400
You can change this behavior when using cmd commands by setting the node attribute `shell-escaping-interpreter` to `cmd`
0 commit comments