Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
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
51 changes: 36 additions & 15 deletions docs/references/deploy.yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,44 @@

## Env

Field |Type |Tag |Description
--- |---- |--- |---
`name` |*string* | |This parameter is the runtime environment such as `production`, `staging`, and `qa`.
`task` |*string* |`github` |This parameter is used by the deployment system to distinguish the kind of deployment. The default values is `deploy`, but for rollback, the value is always `rollback`.
`description` |*string* |`github` |This parameter is the short description of the deployment. The default value is `Gitploy starts to deploy.`
`auto_merge` |*boolean* |`github` |This parameter is used to ensure that the requested ref is not behind the repository's default branch. If you deploy with the commit or the tag you need to set `false`. The default values is `true`, but for rollback, the value is always `false`.
`required_contexts` |*[]string* |`github` |This parameter allows you to specify a subset of contexts that must be success. The default value is `nil`, it means every submitted context must be in a success state.
`production_environment` |*boolean* |`github` |This parameter specifies whether this runtime environment is production or not.
`approval` |*[Approval](#approval)* | |This parameter configures approval.

Field |Type |Required |Description
--- |---- |--- |---
`name` |*string* |`true` |This field is the runtime environment such as `production`, `staging`, and `qa`.
`task` |*string* |`false` |This field is used by the deployment system to distinguish the kind of deployment.
`description` |*string* |`false` |This field is the short description of the deployment.
`auto_merge` |*boolean* |`false` |This field is used to ensure that the requested ref is not behind the repository's default branch. If you deploy with the commit or the tag you need to set `false`. For rollback, Gitploy set the field `false`.
`required_contexts` |*[]string* |`false` |This field allows you to specify a subset of contexts that must be success.
`production_environment` |*boolean* |`false` |This field specifies whether this runtime environment is production or not.
`approval` |*[Approval](#approval)* |`false` |This field configures approval.

## Approval

Field |Type |Tag |Description
--- |--- |--- |---
`enabled` |*boolean* | |This parameter make to enable the approval feature. The default value is `false`.
`required_count` |*integer* | |This parameter determine how many the required approving approvals is needs to deploy. The default value is `0`.
Field |Type |Tag |Description
--- |--- |--- |---
`enabled` |*boolean* |`true` |This field make to enable the approval feature. The default value is `false`.
`required_count` |*integer* |`false` |This field determine how many the required approving approvals is needs to deploy. The default value is `0`.

## Variables

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

* `GITPLOY_DEPLOY_TASK`: Returns `deploy` for deploy, but rollback, it returns the empty string.
* `GITPLOY_ROLLBACK_TASK`: Returns `rollback` for rollback, but deploy, it returns the empty string.
* `GITPLOY_IS_ROLLBACK`: Returns `true` for rollback, but deploy, it returns `false`.

An example usage of this:

```yaml
envs:
- name: prod
task: "${GITPLOY_DEPLOY_TASK}${GITPLOY_ROLLBACK_TASK}:kubernetes" # It returns "deploy:kubernetes" or "rollback:kubernetes"
```

## Tags
And Gitploy provides the string operation to facilitate customized values. You can check supported functions at [here](https://github.com/drone/envsubst).

* `github`: Github specific field.
```yaml
envs:
- name: prod
task: "${GITPLOY_DEPLOY_TASK=rollback}:kubernetes" # It returns "deploy:kubernetes" or "rollback:kubernetes"
```
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ require (
entgo.io/ent v0.9.0
github.com/AlekSi/pointer v1.1.0
github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef
github.com/creasty/defaults v1.5.1
github.com/davecgh/go-spew v1.1.1
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 // indirect
github.com/drone/envsubst v1.0.3
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6
github.com/gin-contrib/cors v1.3.1
github.com/gin-contrib/sse v0.1.0
github.com/gin-gonic/gin v1.7.2
Expand All @@ -33,6 +33,6 @@ require (
go.uber.org/zap v1.13.0
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
gopkg.in/h2non/gock.v1 v1.1.2 // indirect
gopkg.in/h2non/gock.v1 v1.1.2
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
)
Loading