Skip to content

Commit

Permalink
apps: Support depoly on push to DOCR. (#883)
Browse files Browse the repository at this point in the history
* Bump godo to v1.86.0

* apps: Support depoly on push to DOCR.
  • Loading branch information
andrewsomething committed Sep 27, 2022
1 parent 98d94d0 commit 6014764
Show file tree
Hide file tree
Showing 183 changed files with 15,863 additions and 3,169 deletions.
43 changes: 37 additions & 6 deletions digitalocean/app_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,21 @@ func appSpecImageSourceSchema() map[string]*schema.Schema {
Optional: true,
Description: "The repository tag. Defaults to latest if not provided.",
},
"deploy_on_push": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: "Configures automatically deploying images pushed to DOCR.",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
Optional: true,
Description: "Whether to automatically deploy images pushed to DOCR.",
},
},
},
},
}
}

Expand Down Expand Up @@ -1229,18 +1244,34 @@ func expandAppImageSourceSpec(config []interface{}) *godo.ImageSourceSpec {
Tag: imageSourceConfig["tag"].(string),
}

docrPush := imageSourceConfig["deploy_on_push"].([]interface{})
if len(docrPush) > 0 {
docrPushConfig := docrPush[0].(map[string]interface{})
imageSource.DeployOnPush = &godo.ImageSourceSpecDeployOnPush{
Enabled: (docrPushConfig["enabled"].(bool)),
}
}

return imageSource
}

func flattenAppImageSourceSpec(spec *godo.ImageSourceSpec) []interface{} {
func flattenAppImageSourceSpec(i *godo.ImageSourceSpec) []interface{} {
result := make([]interface{}, 0)

if spec != nil {
if i != nil {
r := make(map[string]interface{})
r["registry_type"] = string((*spec).RegistryType)
r["registry"] = (*spec).Registry
r["repository"] = (*spec).Repository
r["tag"] = (*spec).Tag
r["registry_type"] = string((*i).RegistryType)
r["registry"] = (*i).Registry
r["repository"] = (*i).Repository
r["tag"] = (*i).Tag

if i.DeployOnPush != nil {
docrPush := make([]interface{}, 1)
docrPush[0] = map[string]interface{}{
"enabled": i.DeployOnPush.Enabled,
}
r["deploy_on_push"] = docrPush
}

result = append(result, r)
}
Expand Down
6 changes: 6 additions & 0 deletions docs/data-sources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ A `service` can contain:
- `registry` - The registry name. Must be left empty for the `DOCR` registry type. Required for the `DOCKER_HUB` registry type.
- `repository` - The repository name.
- `tag` - The repository tag. Defaults to `latest` if not provided.
- `deploy_on_push` - Configures automatically deploying images pushed to DOCR.
- `enabled` - Whether to automatically deploy images pushed to DOCR.
* `env` - Describes an environment variable made available to an app competent.
- `key` - The name of the environment variable.
- `value` - The value of the environment variable.
Expand Down Expand Up @@ -139,6 +141,8 @@ A `worker` can contain:
- `registry` - The registry name. Must be left empty for the `DOCR` registry type. Required for the `DOCKER_HUB` registry type.
- `repository` - The repository name.
- `tag` - The repository tag. Defaults to `latest` if not provided.
- `deploy_on_push` - Configures automatically deploying images pushed to DOCR.
- `enabled` - Whether to automatically deploy images pushed to DOCR.
* `env` - Describes an environment variable made available to an app competent.
- `key` - The name of the environment variable.
- `value` - The value of the environment variable.
Expand Down Expand Up @@ -176,6 +180,8 @@ A `job` can contain:
- `registry` - The registry name. Must be left empty for the `DOCR` registry type. Required for the `DOCKER_HUB` registry type.
- `repository` - The repository name.
- `tag` - The repository tag. Defaults to `latest` if not provided.
- `deploy_on_push` - Configures automatically deploying images pushed to DOCR.
- `enabled` - Whether to automatically deploy images pushed to DOCR.
* `env` - Describes an environment variable made available to an app competent.
- `key` - The name of the environment variable.
- `value` - The value of the environment variable.
Expand Down
6 changes: 6 additions & 0 deletions docs/resources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ A `service` can contain:
- `registry` - The registry name. Must be left empty for the `DOCR` registry type. Required for the `DOCKER_HUB` registry type.
- `repository` - The repository name.
- `tag` - The repository tag. Defaults to `latest` if not provided.
- `deploy_on_push` - Configures automatically deploying images pushed to DOCR.
- `enabled` - Whether to automatically deploy images pushed to DOCR.
* `env` - Describes an environment variable made available to an app competent.
- `key` - The name of the environment variable.
- `value` - The value of the environment variable.
Expand Down Expand Up @@ -296,6 +298,8 @@ A `worker` can contain:
- `registry` - The registry name. Must be left empty for the `DOCR` registry type. Required for the `DOCKER_HUB` registry type.
- `repository` - The repository name.
- `tag` - The repository tag. Defaults to `latest` if not provided.
- `deploy_on_push` - Configures automatically deploying images pushed to DOCR.
- `enabled` - Whether to automatically deploy images pushed to DOCR.
* `env` - Describes an environment variable made available to an app competent.
- `key` - The name of the environment variable.
- `value` - The value of the environment variable.
Expand Down Expand Up @@ -348,6 +352,8 @@ A `job` can contain:
- `registry` - The registry name. Must be left empty for the `DOCR` registry type. Required for the `DOCKER_HUB` registry type.
- `repository` - The repository name.
- `tag` - The repository tag. Defaults to `latest` if not provided.
- `deploy_on_push` - Configures automatically deploying images pushed to DOCR.
- `enabled` - Whether to automatically deploy images pushed to DOCR.
* `env` - Describes an environment variable made available to an app competent.
- `key` - The name of the environment variable.
- `value` - The value of the environment variable.
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/digitalocean/terraform-provider-digitalocean

require (
github.com/aws/aws-sdk-go v1.42.18
github.com/digitalocean/godo v1.83.0
github.com/digitalocean/godo v1.86.0
github.com/hashicorp/awspolicyequivalence v1.5.0
github.com/hashicorp/go-uuid v1.0.2
github.com/hashicorp/go-version v1.3.0
Expand Down Expand Up @@ -54,8 +54,8 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/zclconf/go-cty v1.9.1 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
golang.org/x/net v0.0.0-20220921155015-db77216a4ee9 // indirect
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect
Expand Down
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/digitalocean/godo v1.83.0 h1:K9CveJyECNLwrQnGZG+ovgapr7l5OuvQ6xZSKKW9Nz0=
github.com/digitalocean/godo v1.83.0/go.mod h1:BPCqvwbjbGqxuUnIKB4EvS/AX7IDnNmt5fwvIkWo+ew=
github.com/digitalocean/godo v1.86.0 h1:GKB2HS+6lnYPn+9XLLsIVBWk3xk7v568EJnmdHuyhKA=
github.com/digitalocean/godo v1.86.0/go.mod h1:jELt1jkHVifd0rKaY0pt/m1QxGzbkkvoVVrDkR15/5A=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
Expand Down Expand Up @@ -417,8 +417,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220921155015-db77216a4ee9 h1:SdDGdqRuKrF2R4XGcnPzcvZ63c/55GvhoHUus0o+BNI=
golang.org/x/net v0.0.0-20220921155015-db77216a4ee9/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -470,8 +470,9 @@ golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
20 changes: 20 additions & 0 deletions vendor/github.com/digitalocean/godo/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6014764

Please sign in to comment.