Skip to content

Commit ecc3180

Browse files
authored
Merge pull request #1707 from rundeck/RUN-643
RUN-643: Multiline job options beta documentation
2 parents 87f20ad + d6ac540 commit ecc3180

File tree

2 files changed

+73
-25
lines changed

2 files changed

+73
-25
lines changed
35.6 KB
Loading

docs/manual/jobs/job-options.md

Lines changed: 73 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ level of procedure formalization.
4343
value be somewhat open ended consider how you can create
4444
safeguards to control their choice.
4545

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).
5546

5647
## Options editor
5748

@@ -87,37 +78,54 @@ loaded to the Rundeck server. See [job-xml](/manual/document-format-reference/jo
8778

8879
## Defining an option
8980

90-
**Text Options**
91-
9281
New options can be defined by pressing the "Add an option" link while
9382
existing ones can be changed by pressing their "edit" link.
9483

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+
9597
Choose "Text" from the Option Type:
9698

9799
![Option edit form](/assets/img/fig0502.png)
98100

99101
The option definition form is organized into several areas:
100102

101-
Identification
103+
Option Name
102104

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.
106107

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.
108119

109120
Input Type
110121

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.
112123

113124
Date Format
114125

115126
: If "Date" Input Type is chosen, you can enter a date format to use when selecting the date
116127
in the user interface. Using the [momentjs format](https://momentjs.com/docs/#/displaying/format/).
117128

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.
121129

122130
Allowed values
123131

@@ -136,7 +144,7 @@ popup menu. If set "false", a text field will also be presented.
136144
Enter a regular expression in the "Match Regular Expression"
137145
field the Job will evaluate when run.
138146

139-
Requirement
147+
Required
140148

141149
: Indicates if the Job can only run if a non-blank value is provided for
142150
that Option. Choose "No" to indicate that a blank value is allowed, and
@@ -166,7 +174,20 @@ Usage (see below)
166174

167175
![Option Usage](/assets/img/fig-option-usage.png)
168176

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
170191

171192
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.
172193
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
199220

200221
`file.NAME.sha` will be the SHA256 hash of the file.
201222

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+
![Multiline Text Option Edit Form](/assets/img/fig-newoption-multiline.png)
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+
202248
## Script usage
203249

204250
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.
221267

222268
```bash .numberLines
223269
#!/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
227273
```
228274

229275
When the user runs the "hello" job they will be prompted for the
@@ -347,6 +393,8 @@ echo "$1"
347393

348394
Which allows the shell will correctly handle the input value by quoting it.
349395

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+
350398
::: tip
351399
When running a command, the value of `${option.name}` will be escaped with single quotes by default.
352400
You can change this behavior when using cmd commands by setting the node attribute `shell-escaping-interpreter` to `cmd`

0 commit comments

Comments
 (0)