Skip to content

Add the document for the dynamic_payload field #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion docs/concepts/deploy.yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ envs:
## Deploy 🚀

### Parameters of GitHub deployment API
As the 'How it works' documentation mentioned, Gitploy sends a request by deployment API. You can configure all the parameters in a configuration file.
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.

```yaml title="deploy.yml"
envs:
Expand All @@ -94,3 +94,28 @@ envs:
production_environment: true
```

### Dynamic Payload
**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.

When setting the dynamic payload, when the user presses the deploy button, an input form appears so that the user can enter the payload.

```yaml title="deploy.yml"
envs:
- name: production
dynamic_payload:
enabled: true
inputs:
canaryEnabled:
required: true
type: select
description: Deploy strategy
options:
- "true"
- "false"
default: "true"
canaryWeight:
required: true
type: number
description: The weight of traffic to shift.
default: 5
```
14 changes: 14 additions & 0 deletions docs/references/deploy.yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Field |Type |Required |Description
`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*)
`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*)
`payload` |*object* or *string* |`false` |This field is JSON payload with extra information about the deployment. Default is `null`. (*Only for GitHub*)
`dyanmic_payload` |*[Dynamic Payload](#dynamic-payload)* |`false` |This field dynamically generates JSON payload about the deployment.(*Only for `GitHub`*)
`production_environment` |*boolean* |`false` |This field specifies whether this runtime environment is production or not. Default is `true`.
`deployable_ref` |*string* |`false` |This field specifies which the ref(branch, SHA, tag) is deployable or not. It supports the regular expression `re2`.
`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.*`
Expand All @@ -41,6 +42,19 @@ Field |Type |Required |Description
`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`.
`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.

## Dynamic Payload

Field |Type |Required |Description
--- |--- |--- |---
`enabled` |*boolean* |`true` |This field enables the dynamic payload feature. The default value is `false`.
`inputs` |*boolean* |`true` |This field set the attributes for the input value.
`inputs.*.required` |*boolean* |`true` |This field forces a user to input a mandatory value.
`inputs.*.type` |*string* |`true` |This field specifies the type of the input value. Choose one of the following: `select`, `number`, `string`, and `boolean`.
`inputs.*.default` |*any* |`false` |This field specifies the default value of the input.
`inputs.*.description`|*string* |`false` |This field describes the input.
`inputs.*.options` |*[]string* |`false` |This field specifies options for when the `select` type input.


## Variables

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