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: managing_providers/_topics/embedded_workflows.md
+86-4Lines changed: 86 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,7 +173,7 @@ Workflows must be authored in Amazon State Languages (ASL) format. As part of au
173
173
174
174
#### Running an Embedded Workflow on Appliances
175
175
176
-
* 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.
176
+
* 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.
177
177
178
178
```text
179
179
# su manageiq
@@ -183,12 +183,12 @@ Workflows must be authored in Amazon State Languages (ASL) format. As part of au
183
183
Login Succeeded!
184
184
```
185
185
186
-
If you use the --root flag in the podman pull, images are pulled to a local directory '/var/www/miq/vmdb/data/containers/storage' as in the example
187
-
186
+
If you use the --root flag in the podman pull, images are pulled to a local directory '/var/www/miq/vmdb/data/containers/storage' as in the example
It is worth noting that the default /home/manageiq partition has insufficient space to store large images.
193
193
194
194
You can use any repository to store your images, for example you can use docker.io [access token](https://docs.docker.com/security/for-developers/access-tokens/) so that the token does not expire.
@@ -307,6 +307,88 @@ If the user is running an embedded workflow on OCP, and is using a docker reposi
307
307
}
308
308
```
309
309
310
+
#### Credentials
311
+
312
+
{{ site.data.product.title_short }} provides a mechanism for securely passing credentials to your running workflows. Credentials should never be set statically in your workflow definition.
313
+
314
+
Long lived credentials like usernames and passwords should be defined as Mapped Credentials as described in `Adding Credentials`.
315
+
316
+
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.
317
+
318
+
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:
319
+
320
+
```asl
321
+
"Login": {
322
+
"Type": "Task",
323
+
"Resource": "docker://login:latest",
324
+
"Credentials": {
325
+
"username.$": "$.username",
326
+
"password.$": "$.password"
327
+
},
328
+
"ResultPath": "$.Credentials",
329
+
"Next": "NextState"
330
+
}
331
+
```
332
+
333
+
If the output of the docker image is `{"bearer_token":"abcd"}` then we will be able to use this in the next state like so:
334
+
335
+
```asl
336
+
"NextState": {
337
+
"Type": "Task",
338
+
"Resource": "docker://do-something:latest",
339
+
"Credentials": {
340
+
"token.$": "$.bearer_token"
341
+
}
342
+
}
343
+
```
344
+
345
+
All of the normal Input/Output processing still applies so if you need to manipulate the output you can use `ResultSelector`. Say for example our login docker image outputs the token as `{"result":"abcd"}` but we want to store it as `"bearer_token"`. We can use `ResultSelector` to change this:
346
+
347
+
```asl
348
+
"Login": {
349
+
"Type": "Task",
350
+
"Resource": "docker://login:latest",
351
+
"Credentials": {
352
+
"username.$": "$.username",
353
+
"password.$": "$.password"
354
+
},
355
+
"ResultSelector": {
356
+
"bearer_token.$": "$.result"
357
+
},
358
+
"ResultPath": "$.Credentials",
359
+
"Next": "NextState"
360
+
}
361
+
```
362
+
363
+
We can also store the result in a parent node for organization:
364
+
365
+
```asl
366
+
"Login": {
367
+
"Type": "Task",
368
+
"Resource": "docker://login:latest",
369
+
"Credentials": {
370
+
"username.$": "$.username",
371
+
"password.$": "$.password"
372
+
},
373
+
"ResultPath": "$.Credentials.VMware",
374
+
"Next": "NextState"
375
+
}
376
+
```
377
+
378
+
And then access it like:
379
+
380
+
```asl
381
+
"NextState": {
382
+
"Type": "Task",
383
+
"Resource": "docker://do-something:latest",
384
+
"Credentials": {
385
+
"token.$": "$.VMware.bearer_token"
386
+
}
387
+
}
388
+
```
389
+
390
+
If you have a mapped credential and your state overwrites its, a new non-mapped entry will be created and the original mapped credential will be left intact.
391
+
310
392
### Viewing workflow details
311
393
312
394
Once a workflow is imported, you can view the details, such as to verify the payload. To view the details for a workflow:
0 commit comments