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
@@ -159,7 +159,7 @@ You can create and use embedded workflows as needed to not only change parts of
159
159
160
160
Workflows must be authored in Amazon State Languages (ASL) format. As part of authoring a workflow, you (or your users) can build container images that are able to perform any tasks that are required in any language that you like. You can use these images during Task states in your workflows.
161
161
162
-
1. Define the code for the workflow. If your workflow requires the use of any credentials or parameters to be specified, ensure that they are passed in the code.
162
+
* Define the code for the workflow. If your workflow requires the use of any credentials or parameters to be specified, ensure that they are passed in the code.
163
163
164
164
Within the workflow code, you need to specify the states that your workflow requires, including any next steps. For `Task` type steps in the workflow, a docker container is called. The container defines what happens for that Task state. For example, a docker container can run to clone a template. If your states require parameters or credentials, you can specify them in your state definitions.
165
165
@@ -174,12 +174,90 @@ Workflows must be authored in Amazon State Languages (ASL) format. As part of au
174
174
- ItemReader
175
175
- ResultWriter
176
176
177
-
2. Build the docker containers that are required for the workflow.
177
+
* Build the docker containers that are required for the workflow.
178
178
179
179
When you have the code for your task resource written, you need to bundle it into a docker image. You can bundle the code by creating a standard [Dockerfile](https://docs.docker.com/engine/reference/builder/) and building the image (https://docs.docker.com/engine/reference/commandline/build/). Then, you can push the image to a [registry](https://docs.docker.com/engine/reference/commandline/push/), which makes the image available to be used by {{ site.data.product.title_short }}. When you have pushed your images to an image registry, you can add the registry to {{ site.data.product.title_short }}.
180
180
181
181
Pull secrets for containers are used differently between appliances and the OpenShift Container Platform (OCP). These differences are outlined in the following sections.
182
182
183
+
* Use "builtin" runner methods from the ManageIQ Task Runner
184
+
185
+
In addition to the `docker://` runner which can run any container you want, there are also builtin runner methods for some common tasks like executing an http call or sending an email.
*`CredentialId` - Integer - Database ID of an ansible credential
252
+
*`CloudCredentialId` - Integer - Database ID of an ansible cloud credential
253
+
*`NetworkCredentialId` - Integer - Database ID of an ansible network credential
254
+
*`VaultCredentialId` - Integer - Database ID of an ansible vault credential
255
+
256
+
*`manageiq://provision_execute` - Execute an MiqProvision task
257
+
258
+
This can be used for a VM Provision Service Catalog item in place of automate. No explicit parameters are required, as state input is used as the provision options.
259
+
260
+
183
261
#### Running an Embedded Workflow on Appliances
184
262
185
263
* On appliances, `podman` is used to execute the container so use [podman login](https://docs.podman.io/en/stable/markdown/podman-login.1.html) as the `manageiq` user.
@@ -322,7 +400,7 @@ If the user is running an embedded workflow on OCP, and is using a docker reposi
322
400
323
401
Long lived credentials like usernames and passwords should be defined as Mapped Credentials as described in `Adding Credentials`.
324
402
325
-
Short lived credentials such as bearer tokens which are obtained while the workflow is running can be set as state output and stored securely in the Credentials field for further states. This can be accomplished by using `ResultPath` with a path starting with `$.Credentials`. This will set the output of the state in the `Credentials` payload.
403
+
Short lived credentials such as bearer tokens which are obtained while the workflow is running can be set as state output and stored securely in the Credentials field for further states. This can be accomplished by using `ResultPath` with a path starting with `$$.Credentials`. This will set the output of the state in the `Credentials` payload.
326
404
327
405
For an example lets say we have a State which takes a username and password and outputs a bearer token to be used later on:
328
406
@@ -331,10 +409,10 @@ For an example lets say we have a State which takes a username and password and
331
409
"Type": "Task",
332
410
"Resource": "docker://login:latest",
333
411
"Credentials": {
334
-
"username.$": "$.username",
335
-
"password.$": "$.password"
412
+
"username.$": "$$.Credentials.username",
413
+
"password.$": "$$.Credentials.password"
336
414
},
337
-
"ResultPath": "$.Credentials",
415
+
"ResultPath": "$$.Credentials",
338
416
"Next": "NextState"
339
417
}
340
418
```
@@ -346,7 +424,7 @@ If the output of the docker image is `{"bearer_token":"abcd"}` then we will be a
346
424
"Type": "Task",
347
425
"Resource": "docker://do-something:latest",
348
426
"Credentials": {
349
-
"token.$": "$.bearer_token"
427
+
"token.$": "$$.Credentials.bearer_token"
350
428
}
351
429
}
352
430
```
@@ -358,13 +436,13 @@ All of the normal Input/Output processing still applies so if you need to manipu
358
436
"Type": "Task",
359
437
"Resource": "docker://login:latest",
360
438
"Credentials": {
361
-
"username.$": "$.username",
362
-
"password.$": "$.password"
439
+
"username.$": "$$.Credentials.username",
440
+
"password.$": "$$.Credentials.password"
363
441
},
364
442
"ResultSelector": {
365
443
"bearer_token.$": "$.result"
366
444
},
367
-
"ResultPath": "$.Credentials",
445
+
"ResultPath": "$$.Credentials",
368
446
"Next": "NextState"
369
447
}
370
448
```
@@ -376,10 +454,10 @@ We can also store the result in a parent node for organization:
376
454
"Type": "Task",
377
455
"Resource": "docker://login:latest",
378
456
"Credentials": {
379
-
"username.$": "$.username",
380
-
"password.$": "$.password"
457
+
"username.$": "$$.Credentials.username",
458
+
"password.$": "$$.Credentials.password"
381
459
},
382
-
"ResultPath": "$.Credentials.VMware",
460
+
"ResultPath": "$$.Credentials.VMware",
383
461
"Next": "NextState"
384
462
}
385
463
```
@@ -391,7 +469,7 @@ And then access it like:
391
469
"Type": "Task",
392
470
"Resource": "docker://do-something:latest",
393
471
"Credentials": {
394
-
"token.$": "$.VMware.bearer_token"
472
+
"token.$": "$$.VMware.bearer_token"
395
473
}
396
474
}
397
475
```
@@ -467,3 +545,49 @@ You can create a generic service catalog item that uses an embedded workflow. To
467
545
The list of services and requests is shown when the catalog item is submitted. Clicking the request shows the execution status, including any embedded workflows.
If you wrote a workflow with floe prior to `v0.17.0` you might have to update your workflow content. You can check your floe version by using `bundle info floe`
552
+
553
+
1. The Credentials Task property has changed to use `$$.Credentials` to access the credentials payload, `$.` will use state input which is consistent with the rest of Input/Output processing. `ResultPath` also has to be updated to set credentials to `$$.Credentials`.
0 commit comments