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
Note that there is a similar API for getting and setting [Resources](../3_resources_and_types/index.md)
44
+
which are simply Variables that can contain any JSON values, not just a string
45
+
and that are labeled with a [Resource Type](../3_resources_and_types/index.md#create-a-resource-type) to be automatically
46
+
discriminated in the auto-generated form to be of the proper type (e.g a
47
+
parameter in TypeScript of type `pg: wmill.Resource<'postgres'>` is only going to
48
+
offer a selection over the resources of type postgres in the auto-generated UI)
49
+
50
+
There is also a concept of [state](../../reference/index.md#state-and-internal-state) to share values
51
+
across script executions.
52
+
53
+
54
+
## Contextual variables
55
+
56
+
Contextual Variables are variables whose values are contextual to the Script
57
+
execution. They are are automatically set by Windmill. This is how the Deno and Python clients get their implicit
58
+
credentials to interact with the platform.
59
+
60
+
See the `Contextual` tab on the <ahref="https://app.windmill.dev/variables"rel="nofollow">Variable page</a> for the list of reserved variables and what they are used for.
61
+
62
+
You can use them in a Script by clicking on "+Context Var":
|`WM_WORKSPACE`| Workspace id of the current script |
69
+
|`WM_TOKEN`| Token ephemeral to the current script with equal permission to the permission of the run (Usable as a bearer token) |
70
+
|`WM_EMAIL`| Email of the user that executed the current script |
71
+
|`WM_USERNAME`| Username of the user that executed the current script |
72
+
|`WM_BASE_URL`| Base URL of this instance |
73
+
|`WM_JOB_ID`| Job id of the current script |
74
+
|`WM_JOB_PATH`| Path of the script or flow being run if any |
75
+
|`WM_FLOW_JOB_ID`| Job id of the encapsulating flow if the job is a flow step |
76
+
|`WM_FLOW_PATH`| Path of the encapsulating flow if the job is a flow step |
77
+
|`WM_SCHEDULE_PATH`| Path of the schedule if the job of the step or encapsulating step has been triggered by a schedule |
78
+
|`WM_PERMISSIONED_AS`| Fully Qualified (u/g) owner name of executor of the job |
79
+
|`WM_STATE_PATH`| State resource path unique to a script and its trigger |
80
+
81
+
82
+
## Secrets
8
83
9
84
Secrets are encrypted when stored on Windmill. From a usage standpoint, secrets
10
85
are kept safe in three different ways:
@@ -15,19 +90,11 @@ are kept safe in three different ways:
15
90
unless explicitly shared. A secret in `f/devops/secret` will be accessible by anyone with read access to `f/devops`.
16
91
- Secrets **cannot be viewed outside of scripts**. Note that a user could still
17
92
`print` a secret if they have access to it from a script.
18
-
- Accessing secrets generates `variables.decrypt_secret` event that ends up in
19
-
the [Audit Logs](https://app.windmill.dev/audit_logs). It means that **you can audit who accesses secrets**. Additionally you can audit results, logs and
93
+
- Accessing secrets generates `variables.decrypt_secret` event that ends up in
94
+
the <ahref="https://app.windmill.dev/audit_logs"rel="nofollow">Audit Logs</a>. It means that **you can audit who accesses secrets**. Additionally you can audit results, logs and
20
95
script code for every script run.
21
96
22
-
:::
23
-
24
-
## Contextual variables
25
-
26
-
Contextual variables are automatically set by Windmill. See the `Contextual` tab
27
-
on the [Variables page](https://app.windmill.dev/variables) for the list of
28
-
reserved variables and what they are used for.
29
-
30
-
## Add a variable or secret
97
+
## Add a Variable or Secret
31
98
32
99
You can define variables from the **Variables** page. Like all objects in
33
100
Windmill, variable ownership is defined by the **path** - see
The last example is in bash and showcase well how it works under the hood: It fetches the secret from the API using the job's permissions through the ephemeral token passed as environment variable to the job.
154
+
The last example is in bash and showcase well how it works under the hood: It fetches the secret from the API using the job's permissions through the ephemeral token passed as environment variable to the job.
Copy file name to clipboardExpand all lines: docs/getting_started/8_trigger_scripts/index.md
+28-20Lines changed: 28 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,16 @@
1
1
# Triggering Scripts
2
2
3
-
Scripts can be triggered in 6 ways:
3
+
Scripts can be triggered in 6 ways.
4
+
5
+
On-demand triggers:
4
6
-[Auto-generated UIs](#auto-generated-uis)
5
7
-[Customized UIs with the App Editor](#customized-uis-with-the-app-editor)
6
-
-[Trigger Scripts from Flows](#trigger-scripts-from-flows)
8
+
-[Trigger Scripts from Flows](#trigger-scripts-from-flows) that have their [own ways of triggering](../9_trigger_flows/index.md)
9
+
-[Trigger Scripts from CLI (Command Line Interface)](#trigger-scripts-from-cli-command-line-interface)
7
10
-[Schedule the Execution of a Script](#schedule-the-execution-of-a-script)
11
+
12
+
Triggers from external events:
8
13
-[Trigger Scripts from Webhooks](#trigger-scripts-from-webhooks)
9
-
-[Trigger Scripts from CLI (Command Line Interface)](#trigger-scripts-from-cli-command-line-interface)
10
14
11
15
12
16
:::info Scripts in Windmill
@@ -15,7 +19,9 @@ Scripts can be triggered in 6 ways:
15
19
16
20
:::
17
21
18
-
## Auto-generated UIs
22
+
## On-demand triggers
23
+
24
+
### Auto-generated UIs
19
25
20
26
Windmill automatically generates user interfaces (UIs) for scripts and flows based on their parameters.
21
27
@@ -49,7 +55,7 @@ More details on our page dedicated to [Auto-generated UIs](../../core_concepts/6
49
55
50
56
:::
51
57
52
-
## Customized UIs with the App Editor
58
+
###Customized UIs with the App Editor
53
59
54
60
Windmill embeds a WYSIWYG app editor. It allows you to build your own UI with drag-and-drop components and to connect your data to scripts and flows in minutes.
55
61
@@ -69,7 +75,7 @@ More details on our page dedicated to [Windmill App Editor](../../getting_starte
69
75
70
76
:::
71
77
72
-
## Trigger Scripts from Flows
78
+
###Trigger Scripts from Flows
73
79
74
80
Flows are basically sequences of scripts that execute on after each other or [in parallel](../../flows/13_flow_branches.md#branch-all).
75
81
@@ -89,7 +95,7 @@ More details on our page dedicated to [Triggering flows](../9_trigger_flows/inde
89
95
90
96
:::
91
97
92
-
## Schedule the Execution of a Script
98
+
###Schedule the Execution of a Script
93
99
94
100
Windmill allows you to schedule scripts using a user-friendly interface and control panels, **similar to [cron](https://crontab.guru/)** but with more features.
95
101
@@ -111,7 +117,21 @@ More details on our page dedicated to [Scheduling jobs](../../core_concepts/1_sc
111
117
112
118
:::
113
119
114
-
## Trigger Scripts from Webhooks
120
+
### Trigger Scripts from CLI (Command Line Interface)
121
+
122
+
The `wmill` cli allows you to interact with Windmill instances right from your terminal.
123
+
124
+

125
+
126
+
:::info
127
+
128
+
More details on our pages dedicated to [CLI](../../advanced/3_cli/index.md).
129
+
130
+
:::
131
+
132
+
## Triggers from external events
133
+
134
+
### Trigger Scripts from Webhooks
115
135
116
136
In Windmill, webhooks are autogenerated for each Script and Flow, providing either asynchronous or synchronous execution modes.
117
137
@@ -139,16 +159,4 @@ Each script (and flow) has its own webhooks on Windmill ...
139
159
140
160
More details on our page dedicated to [Webhooks](../../core_concepts/4_webhooks/index.md).
141
161
142
-
:::
143
-
144
-
## Trigger Scripts from CLI (Command Line Interface)
145
-
146
-
The `wmill` cli allows you to interact with Windmill instances right from your terminal.
147
-
148
-

149
-
150
-
:::info
151
-
152
-
More details on our pages dedicated to [CLI](../../advanced/3_cli/index.md).
-[Trigger Flows from Webhooks](#trigger-flows-from-webhooks)
11
14
15
+
## On-demand Triggers
12
16
13
-
## Auto-generated UIs
17
+
###Auto-generated UIs
14
18
15
19
Windmill automatically generates user interfaces (UIs) for scripts and flows based on their parameters.
16
20
@@ -44,7 +48,7 @@ More details on our page dedicated to [Auto-generated UIs](../../core_concepts/6
44
48
45
49
:::
46
50
47
-
## Customized UIs with the App Editor
51
+
###Customized UIs with the App Editor
48
52
49
53
Windmill embeds a WYSIWYG app editor. It allows you to build your own UI with drag-and-drop components and to connect your data to scripts and flows in minutes.
50
54
@@ -64,7 +68,7 @@ More details on our page dedicated to [Windmill App Editor](../../getting_starte
64
68
65
69
:::
66
70
67
-
## Schedule the Execution of a Flow
71
+
###Schedule the Execution of a Flow
68
72
69
73
Windmill allows you to schedule scripts using a user-friendly interface and control panels, **similar to [cron](https://crontab.guru/)** but with more features.
70
74
@@ -86,7 +90,21 @@ More details on our page dedicated to [Scheduling jobs](../../core_concepts/1_sc
86
90
87
91
:::
88
92
89
-
## Scheduling + Trigger Scripts
93
+
### Trigger Flows from CLI (Command Line Interface)
94
+
95
+
The `wmill` cli allows you to interact with Windmill instances right from your terminal.
96
+
97
+

98
+
99
+
:::info
100
+
101
+
More details on our pages dedicated to [CLI](../../advanced/3_cli/index.md).
102
+
103
+
:::
104
+
105
+
## Triggers from External Events
106
+
107
+
### Scheduling + Trigger Scripts
90
108
91
109
92
110
A particular use case of schedules are Trigger Scripts. Their purpose is to pull data from an external source and return all of the new items since the last run.
@@ -99,7 +117,7 @@ More details on our page dedicated to [Trigger Scripts](../../flows/10_flow_trig
99
117
100
118
:::
101
119
102
-
## Trigger Flows from Webhooks
120
+
###Trigger Flows from Webhooks
103
121
104
122
In Windmill, webhooks are autogenerated for each Script and Flow, providing either asynchronous or synchronous execution modes.
105
123
@@ -130,18 +148,6 @@ More details on our page dedicated to [Webhooks](../../core_concepts/4_webhooks/
130
148
131
149
:::
132
150
133
-
## Trigger Flows from CLI (Command Line Interface)
134
-
135
-
The `wmill` cli allows you to interact with Windmill instances right from your terminal.
136
-
137
-

138
-
139
-
:::info
140
-
141
-
More details on our pages dedicated to [CLI](../../advanced/3_cli/index.md).
0 commit comments