Skip to content

Commit 7685251

Browse files
author
Noah Lee
authored
Add the document for the dynamic_payload field (#48)
1 parent c239191 commit 7685251

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

docs/concepts/deploy.yml.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ envs:
8080
## Deploy 🚀
8181

8282
### Parameters of GitHub deployment API
83-
As the 'How it works' documentation mentioned, Gitploy sends a request by deployment API. You can configure all the parameters in a configuration file.
83+
As the 'How it works' documentation mentioned, Gitploy sends a request by [deployment API](https://docs.github.com/en/rest/reference/deployments#deployments). You can configure all the parameters in a configuration file.
8484

8585
```yaml title="deploy.yml"
8686
envs:
@@ -94,3 +94,28 @@ envs:
9494
production_environment: true
9595
```
9696

97+
### Dynamic Payload
98+
**This `dynamic_payload` field dynamically generates payload and passes it to the Github deployment API.** This configuration makes deployment systems flexible and powerful. For example, it allows the canary deployment system to set the weight of traffic to shift when triggered.
99+
100+
When setting the dynamic payload, when the user presses the deploy button, an input form appears so that the user can enter the payload.
101+
102+
```yaml title="deploy.yml"
103+
envs:
104+
- name: production
105+
dynamic_payload:
106+
enabled: true
107+
inputs:
108+
canaryEnabled:
109+
required: true
110+
type: select
111+
description: Deploy strategy
112+
options:
113+
- "true"
114+
- "false"
115+
default: "true"
116+
canaryWeight:
117+
required: true
118+
type: number
119+
description: The weight of traffic to shift.
120+
default: 5
121+
```

docs/references/deploy.yml.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Field |Type |Required |Description
2020
`auto_merge` |*boolean* |`false` |This field is used to ensure that the requested ref is not behind the repository's default branch. If the ref is behind the default branch for the repository, we will attempt to merge it for you. Default is `true`, but Gitploy set `false` for rollback. (*Only for GitHub*)
2121
`required_contexts` |*[]string* |`false` |This field allows you to specify a subset of contexts that must be success. Defaults to all unique contexts. (*Only for GitHub*)
2222
`payload` |*object* or *string* |`false` |This field is JSON payload with extra information about the deployment. Default is `null`. (*Only for GitHub*)
23+
`dyanmic_payload` |*[Dynamic Payload](#dynamic-payload)* |`false` |This field dynamically generates JSON payload about the deployment.(*Only for `GitHub`*)
2324
`production_environment` |*boolean* |`false` |This field specifies whether this runtime environment is production or not. Default is `true`.
2425
`deployable_ref` |*string* |`false` |This field specifies which the ref(branch, SHA, tag) is deployable or not. It supports the regular expression `re2`.
2526
`auto_deploy_on` |*string* |`false` |This field controls auto-deployment behaviour given a ref(branch, SHA, tag). If any new push events are detected on this event, the deployment will be triggered. It supports the regular expression ([re2](https://github.com/google/re2/wiki/Syntax)). E.g. `refs/heads/main` or `refs/tags/v.*`
@@ -41,6 +42,19 @@ Field |Type |Required |Description
4142
`duration` |*string* |`true` |This field configures how long the window is frozen from the starting. The duration string is a possibly signed sequence of decimal numbers and a unit suffix such as `5m`, or `1h30m`. Valid time units are `ns`, `us`, `ms`, `s`, `m`, `h`.
4243
`location` |*string* |`false` |This field configures the location of the `start` time. The value is taken to be a location name corresponding to a file in the IANA Time Zone database, such as `America/New_York`. Default is `UTC`. You can check the [document](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) for the Time Zone database name.
4344

45+
## Dynamic Payload
46+
47+
Field |Type |Required |Description
48+
--- |--- |--- |---
49+
`enabled` |*boolean* |`true` |This field enables the dynamic payload feature. The default value is `false`.
50+
`inputs` |*boolean* |`true` |This field set the attributes for the input value.
51+
`inputs.*.required` |*boolean* |`true` |This field forces a user to input a mandatory value.
52+
`inputs.*.type` |*string* |`true` |This field specifies the type of the input value. Choose one of the following: `select`, `number`, `string`, and `boolean`.
53+
`inputs.*.default` |*any* |`false` |This field specifies the default value of the input.
54+
`inputs.*.description`|*string* |`false` |This field describes the input.
55+
`inputs.*.options` |*[]string* |`false` |This field specifies options for when the `select` type input.
56+
57+
4458
## Variables
4559

4660
The following variables are available in `${ }` syntax when evaluating `deploy.yml` before deploy or rollback:

0 commit comments

Comments
 (0)