Skip to content

Commit d516f71

Browse files
authored
Merge pull request #2497 from port-labs/PORTN-2975-edit-automations-docs-to-fit-new-ui
Add the UI explanations for the automations docs
2 parents c377176 + 99e6d1d commit d516f71

File tree

11 files changed

+307
-150
lines changed

11 files changed

+307
-150
lines changed

docs/actions-and-automations/create-self-service-experiences/create-self-service-experiences.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Port's action model is designed to be flexible and can be used to cover a wide r
2626

2727
## 💡 Common self-service actions
2828

29-
- **Scaffold** a new service.
30-
- **Create** a cloud resource.
29+
- [**Scaffold** a new service](https://docs.port.io/guides/all/scaffold-a-new-service/).
30+
- [**Create** a cloud resource](https://docs.port.io/guides/all/create-cloud-resource-using-iac).
3131
- **Provision** a temporary developer environment.
3232
- **Redeploy** an image tag.
3333
- **Rollback** a running service.
@@ -53,29 +53,29 @@ Port gives you no-code components to create the experience you want for your use
5353

5454
Self-service actions are created and managed in the [Self-service](https://app.getport.io/self-serve) page of your portal.
5555

56-
To begin, click on the `+ New Action` button in the top right corner, then follow the steps below.
56+
To begin, click on the `+ Action` button in the top right corner, then follow the steps below.
5757

5858
:::tip Other supported methods
5959
Besides Port's UI, you can also create and manage self-service actions using [Port's API](/api-reference/create-an-action-automation), or [Terraform](https://registry.terraform.io/providers/port-labs/port-labs/latest/docs/resources/port_action).
6060
:::
6161

62-
### Step 1 - setup the action's frontend
62+
### Set up the action's frontend
6363

6464
Choose the name of the action, its icon, and the inputs you would like the user to fill out when executing it.
6565
Port supports a wide variety of input types, including more advanced conditions to best fit the experience you want for your users.
6666

67-
See [Setup frontend](/actions-and-automations/create-self-service-experiences/setup-ui-for-action/) for instructions and examples.
67+
See [Set up frontend](/actions-and-automations/create-self-service-experiences/setup-ui-for-action/) for instructions and examples.
6868

69-
### Step 2 - setup backend
69+
### Set up backend
7070

71-
Setup the logic responsible to handle the action after it is executed.
71+
Set up the logic responsible to handle the action after it is executed.
7272
In this step you can also define the payload that will be sent to your handler upon execution.
7373

7474
The backend logic is yours, so it can do whatever you need it to do. Port supports many different backends for actions, offering a secure and compliant architecture.
7575

7676
As part of your backend and its logic implementation, you can keep your software catalog up to date by sending API requests or ingesting new data that is tied to the performed action (for example, adding a new service entity in Port once the scaffold process has finished).
7777

78-
See [Setup backend](/actions-and-automations/create-self-service-experiences/setup-the-backend/) for instructions and examples.
78+
See [Set up backend](/actions-and-automations/create-self-service-experiences/setup-the-backend/) for instructions and examples.
7979

8080
<center>
8181

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"label": "Setup action RBAC",
2+
"label": "Set up action RBAC",
33
"position": 3
44
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"label": "Setup backend",
2+
"label": "Set up backend",
33
"position": 2
44
}

docs/actions-and-automations/create-self-service-experiences/setup-the-backend/setup-the-backend.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Setup backend
2+
title: Set up backend
33
---
44

55
import DocCardList from '@theme/DocCardList';
66
import Tabs from "@theme/Tabs"
77
import TabItem from "@theme/TabItem"
8-
import PayloadAdvancedFunctions from '/docs/actions-and-automations/templates/_payload_advanced_functions.mdx'
98
import BackendTypesJson from '/docs/actions-and-automations/templates/_backend-types-json.md'
109
import ExecuteActionLocations from '/docs/actions-and-automations/create-self-service-experiences/templates/_execute_action_locations.mdx'
10+
import PayloadAdvancedFunctions from '/docs/actions-and-automations/templates/_payload_advanced_functions.mdx'
1111

12-
# Setup backend
12+
# Set up backend
1313

1414
<center>
1515

@@ -36,16 +36,11 @@ In this section we provide information about the backend logic and its location,
3636
Port uses the same backend types for both self-service actions and [automations](/actions-and-automations/define-automations/).
3737
For more information and examples for the available backend types, check out the [Backend types](/actions-and-automations/setup-backend/) page.
3838

39-
Here is an example of a Github workflow backend configuration:
40-
41-
<img src='/img/self-service-actions/setup-backend/action-form-setup-backend.png' width='55%' border='1px' />
42-
<br/><br/>
43-
4439
Depending on the backend type you choose, you will need to provide different configuration parameters.
4540

46-
### Define the action's payload
41+
### Define the payload
4742

48-
When creating a self-service action or automation, you can construct a JSON payload that will be sent to your backend upon every execution. You can use this to send data about the action that you want your backend to have.
43+
When creating an automation, you can construct a JSON payload that will be sent to your backend upon every execution. You can use this to send data about the action that you want your backend to have.
4944

5045
Still in the `Backend` tab, scroll down to the `Configure the invocation payload` section. This is where we define the action's payload.
5146

@@ -129,7 +124,7 @@ You can access any value in this structure and add it to the payload. For exampl
129124

130125
Use the `Test JQ` button in the bottom-left corner to test your expressions against your action and ensure you are sending the correct data.
131126

132-
:::tip Pro tip
127+
:::tip Inspect the Full Object in `jq`
133128
You can use the `jq` expression `{{ . }}` when testing to see the entire available object, and then drill down to the specific data you need.
134129
:::
135130

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"label": "Setup frontend",
2+
"label": "Set up frontend",
33
"position": 1
44
}

docs/actions-and-automations/define-automations/define-automations.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Automations in Port are triggered by events in your infrastructure, such as a ne
1111

1212
Port uses the same backend types for both automations and [self-service actions](/actions-and-automations/create-self-service-experiences/).
1313

14-
## Common automations
14+
## 💡 Common automations
1515

1616
- Create a new incident in PagerDuty when CPU usage is greater than X%.
1717
- Destroy an ephemeral environment when its TTL expires.
@@ -28,13 +28,31 @@ Automations are comprised of two parts:
2828
<img src="/img/automations/architecture.jpg" width="80%" border='1px' />
2929
</center><br/>
3030

31-
When an event occurs in your software catalog, Port will automatically trigger the associated backend, given that the automation is enabled.
31+
When an event occurs in your software catalog, Port will automatically trigger the associated backend, given that the automation is enabled.
3232

33-
By default, automations are disabled and can be used as drafts until ready to be activated. You can enable them by setting the `publish` field to `true` in their JSON definition.
33+
## Define an automation
34+
35+
Automations are defined in the [Automations page](https://app.getport.io/settings/automations) of your portal.
36+
Here you can create, edit, and delete automations, as well as enable or disable them.
37+
38+
Click on the `+ Automation` button in the top-right corner, then follow the steps below:
39+
40+
1. In the first tab (`Basic Details`) of the automation creation form in Port's UI:
41+
Specify your automation’s basic details:
42+
43+
- `title` - The automation's title.
44+
- `identifier` - The automation's unique identifier.
45+
- `description`- A description that can be used to explain the automation.
46+
- `icon` - The automation's icon.
47+
- `active` - A toggle button indicating whether the automation is enabled or disabled. (`true` by default).
48+
49+
2. In the second tab (`Trigger`), set up the [trigger](/actions-and-automations/define-automations/setup-trigger).
50+
51+
3. In the third tab (`Backend`), define the [backend](/actions-and-automations/define-automations/setup-action) that will be executed when the trigger event occurs, then click `Save`.
3452

3553
## Automation JSON structure
3654

37-
Automations are defined in JSON format. The JSON structure looks like this:
55+
The basic structure of an automation looks like this:
3856

3957
```json showLineNumbers
4058
{
@@ -58,10 +76,12 @@ Automations are defined in JSON format. The JSON structure looks like this:
5876
"type": "WEBHOOK",
5977
"url": "https://example.com"
6078
},
61-
"publish": false
79+
"publish": true
6280
}
6381
```
6482
<br/>
83+
Make sure the `publish` field is set to `true` if you want to enable the automation.
84+
6585
The table below describes the fields in the JSON structure (fields in **bold** are required):
6686
| Field | Description |
6787
| --- | --- |
@@ -71,19 +91,7 @@ The table below describes the fields in the JSON structure (fields in **bold** a
7191
| `description` | A description that can be used to explain the automation. |
7292
| **`trigger`** | An object containing data about the automation's trigger. See [Setup trigger](/actions-and-automations/define-automations/setup-trigger) for more information. |
7393
| **`invocationMethod`** | An object containing data about the automation's invocation method. See [Setup action](/actions-and-automations/define-automations/setup-action) for more information. |
74-
| `publish` | A boolean value indicating whether the automation is enabled or disabled (`false` by default). |
75-
76-
## Define an automation
77-
78-
Automations are defined in the [Automations page](https://app.getport.io/settings/automations) of your portal. Here you can create, edit, and delete automations, as well as enable or disable them.
79-
80-
1. Click on the `+ New automation` button in the top-right corner. This will open a JSON form where you can define the automation's configuration.
81-
82-
2. Change the JSON configuration to match your desired automation:
83-
* Setup the [trigger](/actions-and-automations/define-automations/setup-trigger).
84-
* Define the [backend](/actions-and-automations/define-automations/setup-action) that will be executed when the trigger event occurs.
85-
86-
3. Make sure to set the `publish` field to `true` if you want to enable the automation. When finished, click `Save`.
94+
| `publish` | A boolean value indicating whether the automation is enabled or disabled (`true` by default). |
8795

8896
## Examples
8997

docs/actions-and-automations/define-automations/setup-action.md

Lines changed: 79 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,55 @@
11
---
22
sidebar_position: 2
3-
title: Setup backend
3+
title: Set up backend
44
---
55

66
import BackendTypesJson from '/docs/actions-and-automations/templates/_backend-types-json.md'
77
import PayloadAdvancedFunctions from '/docs/actions-and-automations/templates/_payload_advanced_functions.mdx'
88
import Tabs from "@theme/Tabs"
99
import TabItem from "@theme/TabItem"
1010

11-
# Setup backend
11+
# Set up backend
1212

1313
The automation's backend is the logic that you want to execute when a trigger event occurs. It will run on all entities tied to the blueprint specified in the automation's definition, whenever the trigger event occurs.
1414

1515
Port uses the same backend types for automations and for [self-service actions](/actions-and-automations/create-self-service-experiences/).
1616

17-
## Backend JSON structure
17+
## Define the backend
1818

19-
The backend is defined under the `invocationMethod` key in the automation's JSON structure:
19+
The automation's backend is defined under the `Backend` tab of the automation creation form in Port's UI.
20+
Let's break the definition down to two parts:
2021

21-
```json showLineNumbers
22-
{
23-
"identifier": "unique_id",
24-
"title": "Title",
25-
"icon": "icon_identifier",
26-
"description": "automation description",
27-
"trigger": {
28-
"type": "automation",
29-
"event": {
30-
"type": "event_type",
31-
"blueprintIdentifier": "blueprint_id"
32-
},
33-
"condition": {
34-
"type": "JQ",
35-
"expressions": ["expression1", "expression2"],
36-
"combinator": "and"
37-
}
38-
},
39-
# highlight-start
40-
"invocationMethod": {
41-
"type": "WEBHOOK",
42-
"url": "https://example.com",
43-
"headers": {
44-
"RUN_ID": "{{ .run.id }}"
45-
},
46-
"body": {
47-
"payload_key": "{{ some-jq-value }}"
48-
}
49-
},
50-
# highlight-end
51-
"publish": false
52-
}
53-
```
22+
### Define your backend's type and metadata
5423

55-
## Supported backends
24+
In this section we provide information about the backend logic and its location, so that Port can access and run it.
5625

57-
<BackendTypesJson />
26+
Port uses the same backend types for both automations and [self-service actions](https://docs.port.io/actions-and-automations/create-self-service-experiences/).
27+
For more information and examples for the available backend types, check out the [backend types](/actions-and-automations/setup-backend/) page.
5828

59-
To read more about each backend type, see the [backend types](/actions-and-automations/setup-backend/) page.
29+
Depending on the backend type you choose, you will need to provide different configuration parameters.
6030

6131
### Define the payload
6232

63-
When creating a self-service action or automation, you can construct a JSON payload that will be sent to your backend upon every execution. You can use this to send data about the automation that you want your backend to have.
33+
When creating an automation, you can construct a JSON payload that will be sent to your backend upon every execution. You can use this to send data about the automation that you want your backend to have.
6434

65-
The payload is defined under the `invocationMethod` object in the automation's JSON structure. The key under which the payload is defined depends on the backend you are using (see the table above).
35+
Still in the `Backend` tab, scroll down to the `Configure the invocation payload` section. This is where we define the automation's payload.
6636

6737
The payload is defined using JSON, and accessing your data is done using `jq`, wrapping each expression with `{{ }}`.
6838

69-
For example, the following payload definition will send a timestamp of when the execution was triggered:
39+
Here is an example for an automation payload:
7040

7141
```json showLineNumbers
7242
{
73-
"execution_time": "{{ .trigger.at }}",
7443
"port_context": {
75-
"run_id": "{{ .run.id }}"
44+
"runId": "{{ .run.id }}"
7645
}
7746
}
7847
```
7948

80-
You may have noticed that the example above also sends `{{ .run.id }}`. This is a unique identifier for each execution of the action, and can be used to [interact with the action run](/actions-and-automations/reflect-action-progress/) in Port from your backend.
49+
You may have noticed that the example above also sends `{{ .run.id }}`. This is a unique identifier for each execution of the automation, and can be used to interact with the autmation run in Port from your backend.
8150

82-
The data that is available to you when constructing the payload is detailed in the `Trigger data` section below.
51+
Now you might be thinking - *how do I know what data is available to me when constructing the payload?*
52+
Enter `trigger data`.
8353

8454
#### Trigger data
8555

@@ -391,4 +361,66 @@ The other trigger events have the same structure, with the following differences
391361
</TabItem>
392362
</Tabs>
393363

364+
You can access any value in this structure and add it to the payload. For example, to add the executing user's name to the payload, you can use the following expression:
365+
366+
```json
367+
{
368+
"executing_user_email": "{{.trigger.by.user.email}}"
369+
}
370+
```
371+
372+
Use the `Test JQ` button in the bottom-left corner to test your expressions against your automation and ensure you are sending the correct data.
373+
374+
:::tip Inspect the Full Object in `jq`
375+
You can use the `jq` expression `{{ . }}` when testing to see the entire available object, and then drill down to the specific data you need.
376+
:::
377+
394378
<PayloadAdvancedFunctions />
379+
380+
## Backend JSON structure
381+
382+
In some cases, you may prefer to define the backend configuration using a JSON object.
383+
The backend is defined under the `invocationMethod` object in the automation's JSON structure.
384+
385+
```json showLineNumbers
386+
{
387+
"identifier": "unique_id",
388+
"title": "Title",
389+
"icon": "icon_identifier",
390+
"description": "automation description",
391+
"trigger": {
392+
"type": "automation",
393+
"event": {
394+
"type": "event_type",
395+
"blueprintIdentifier": "blueprint_id"
396+
},
397+
"condition": {
398+
"type": "JQ",
399+
"expressions": ["expression1", "expression2"],
400+
"combinator": "and"
401+
}
402+
},
403+
# highlight-start
404+
"invocationMethod": {
405+
"type": "WEBHOOK",
406+
"url": "https://example.com",
407+
"headers": {
408+
"RUN_ID": "{{ .run.id }}"
409+
},
410+
"body": {
411+
"payload_key": "{{ some-jq-value }}"
412+
}
413+
},
414+
# highlight-end
415+
"publish": false
416+
}
417+
```
418+
419+
## Supported backends
420+
421+
<BackendTypesJson />
422+
423+
To read more about each backend type, see the [backend types](/actions-and-automations/setup-backend/) page.
424+
425+
426+

0 commit comments

Comments
 (0)