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: README.md
+24-22Lines changed: 24 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,24 +14,26 @@ The directory structure of a step package project is shown below:
14
14
*`\`
15
15
*`steps` - A directory containing the step definitions.
16
16
*`<step-name>` - A directory containing the definition of a step. There may be many of these directories to define many steps within a single step package.
17
-
*`__tests__` - The directory containing step tests.
18
-
*`executor.spec.ts` - Tests validating the logic in the `executor.ts` file.
19
-
*`executor.ts` - The code to be executed when a step is run by Octopus.
20
-
*`inputs.ts` - The definition of the inputs required by the step.
21
-
*`logo.svg` - The image to be displayed in the Octopus web UI for the step.
22
-
*`metadata.json` - The step metadata.
23
-
*`ui.ts` - The step UI definition.
24
-
*`validation.ts` - The step validation rules.
17
+
*`src` - The parent directory containing the step code and assets.
18
+
*`__tests__` - The directory containing step tests.
19
+
*`executor.spec.ts` - Tests validating the logic in the `executor.ts` file.
20
+
*`executor.ts` - The code to be executed when a step is run by Octopus.
21
+
*`inputs.ts` - The definition of the inputs required by the step.
22
+
*`logo.svg` - The image to be displayed in the Octopus web UI for the step.
23
+
*`metadata.json` - The step metadata.
24
+
*`ui.ts` - The step UI definition.
25
+
*`validation.ts` - The step validation rules.
25
26
*`targets`
26
27
*`<target-name>`
27
-
*`__tests__` - The directory containing step tests.
28
-
*`executor.spec.ts` - Tests validating the logic in the `executor.ts` file.
29
-
*`executor.ts` - The code to be executed when a target healthcheck is run by Octopus.
30
-
*`inputs.ts` - The definition of the inputs required by the target.
31
-
*`logo.svg` - The image to be displayed in the Octopus web UI for the target.
32
-
*`metadata.json` - The target metadata.
33
-
*`ui.ts` - The target UI definition.
34
-
*`validation.ts` - The target validation rules.
28
+
*`src` - The parent directory containing the step code and assets.
29
+
*`__tests__` - The directory containing step tests.
30
+
*`executor.spec.ts` - Tests validating the logic in the `executor.ts` file.
31
+
*`executor.ts` - The code to be executed when a target healthcheck is run by Octopus.
32
+
*`inputs.ts` - The definition of the inputs required by the target.
33
+
*`logo.svg` - The image to be displayed in the Octopus web UI for the target.
34
+
*`metadata.json` - The target metadata.
35
+
*`ui.ts` - The target UI definition.
36
+
*`validation.ts` - The target validation rules.
35
37
*`.eslintignore` - The [ESLint ignore file](https://eslint.org/docs/user-guide/configuring/ignoring-code#the-eslintignore-file).
36
38
*`.eslintrc.js` - The [ESLint configuration file](https://eslint.org/docs/user-guide/configuring/).
37
39
*`.gitignore` - The [git ignore file](https://git-scm.com/docs/gitignore).
@@ -81,7 +83,7 @@ The `metadata.json` provides details about the target. A sample is shown below:
81
83
82
84
### `inputs.ts`
83
85
84
-
The `inputs.ts` file exports an interface defining the input fields required by the target. This interface is consumed by both `executor.ts` to read the values when performing the target's health check, and `ui.ts` to build up the form exposed in the Octopus web UI.
86
+
The `inputs.ts` file exports an interface defining the input fields required by the target. This interface is consumed by `executor.ts` to read the values when performing the target's health check, `ui.ts` to build up the form exposed in the Octopus web UI, and `validate.ts` to verify new values.
85
87
86
88
An example is shown below exposing a single string field:
Targets perform a health check to validate their inputs and check the state of the system they represent. This health check is performed by the function exposed by the `executor.ts` file.
98
+
Targets perform a health check to validate their inputs and check the state of the system they represent. This health check is performed by the function exported by the `executor.ts` file.
97
99
98
100
The example below prints some text to the log during a health check, and will always pass, meaning the target is always healthy:
The form to be exposed by the Octopus web UI is defined in the `ui.ts` file. The form is defined as an instance of the `DeploymentTargetUI` interface, which has two functions: `createInitialInputs` and `editInputsForm`.
115
+
The form to be exposed by the Octopus web UI is defined by the function exported by the `ui.ts` file. The form is defined as an instance of the `DeploymentTargetUI` interface, which has two functions: `createInitialInputs` and `editInputsForm`.
114
116
115
117
The `createInitialInputs` function allows the initial default field values to be defined.
Form validation is defined in the `validate.ts` file. This file exports a function the returns an array of `ValueValidator` objects, and takes two parameters:
152
+
Form validation is performed by the function exported by the `validate.ts` file. This function the returns an array of `ValueValidator` objects, and takes two parameters:
151
153
1. The step inputs as [input paths](https://github.com/OctopusDeploy/Architecture/blob/main/Steps/Concepts/InputsAndOutputs.md#input-paths).
152
154
2. A validation function that returns a `ValueValidator` and takes two parameters:
153
155
1. An input path.
154
-
2. A function the returns a string containing the error code (or returns nothing if there is no validation error) and provides the input value as the first parameter.
156
+
2. A function the returns a string containing the error code (or returns nothing if there is no validation error) and takes the input value (retrieved from the input path) as the first parameter.
The step form to be displayed by the Octopus web UI is defined the same was it was with the target. There is one small difference though, where the first parameter to the `createInitialInputs` function can be an instance of `InitialInputFactories`, which provides the ability to create blank package references.
254
+
The step form to be displayed by the Octopus web UI is defined much the same was it was with the target. There are some subtle differences though: it implements the`StepUI` type, and first parameter to the `createInitialInputs` function can be an instance of `InitialInputFactories`, which provides the ability to create blank package references.
253
255
254
256
Here we define the initial value of the `name` input to be a blank string, and build the form with a single `text` input:
0 commit comments