Skip to content

CR-16640: Add requiredAvailableStorage #101

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 1 commit into from
Feb 1, 2023
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
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ HOSTNAME=codefresh.io
PKG_NAME=codefresh
NAMESPACE=app
BINARY=terraform-provider-${PKG_NAME}
VERSION=0.1.0
VERSION=0.2.1
OS_ARCH=darwin_amd64

default: build
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ export CODEFRESH_API_KEY='xyz'
## Testing the Provider

```bash
export TF_ACC="test"
export TF_ACC="test"
export CODEFRESH_API_KEY=[YOUR API TOKEN]
go test -v ./...
```

## License

Copyright 2022 Codefresh.
Copyright 2023 Codefresh.

The Codefresh Provider is available under [MPL2.0 license](./LICENSE).
35 changes: 18 additions & 17 deletions client/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,24 @@ func (t *Trigger) SetVariables(variables map[string]interface{}) {
}

type Spec struct {
Variables []Variable `json:"variables,omitempty"`
SpecTemplate *SpecTemplate `json:"specTemplate,omitempty"`
Triggers []Trigger `json:"triggers,omitempty"`
Priority int `json:"priority,omitempty"`
Concurrency int `json:"concurrency,omitempty"`
BranchConcurrency int `json:"branchConcurrency,omitempty"`
TriggerConcurrency int `json:"triggerConcurrency,omitempty"`
Contexts []interface{} `json:"contexts,omitempty"`
Steps *Steps `json:"steps,omitempty"`
Stages *Stages `json:"stages,omitempty"`
Mode string `json:"mode,omitempty"`
FailFast *bool `json:"fail_fast,omitempty"`
RuntimeEnvironment RuntimeEnvironment `json:"runtimeEnvironment,omitempty"`
TerminationPolicy []map[string]interface{} `json:"terminationPolicy,omitempty"`
PackId string `json:"packId,omitempty"`
Hooks *Hooks `json:"hooks,omitempty"`
Options map[string]bool `json:"options,omitempty"`
Variables []Variable `json:"variables,omitempty"`
SpecTemplate *SpecTemplate `json:"specTemplate,omitempty"`
Triggers []Trigger `json:"triggers,omitempty"`
Priority int `json:"priority,omitempty"`
Concurrency int `json:"concurrency,omitempty"`
BranchConcurrency int `json:"branchConcurrency,omitempty"`
TriggerConcurrency int `json:"triggerConcurrency,omitempty"`
Contexts []interface{} `json:"contexts,omitempty"`
Steps *Steps `json:"steps,omitempty"`
Stages *Stages `json:"stages,omitempty"`
Mode string `json:"mode,omitempty"`
FailFast *bool `json:"fail_fast,omitempty"`
RuntimeEnvironment RuntimeEnvironment `json:"runtimeEnvironment,omitempty"`
TerminationPolicy []map[string]interface{} `json:"terminationPolicy,omitempty"`
PackId string `json:"packId,omitempty"`
RequiredAvailableStorage string `json:"requiredAvailableStorage,omitempty"`
Hooks *Hooks `json:"hooks,omitempty"`
Options map[string]bool `json:"options,omitempty"`
}

type Steps struct {
Expand Down
17 changes: 12 additions & 5 deletions codefresh/resource_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ func resourcePipeline() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"required_available_storage": {
Type: schema.TypeString,
Optional: true,
},
"runtime_environment": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -510,6 +514,8 @@ func flattenSpec(spec cfClient.Spec) []interface{} {
}

m["pack_id"] = spec.PackId
m["required_available_storage"] = spec.RequiredAvailableStorage

m["concurrency"] = spec.Concurrency
m["branch_concurrency"] = spec.BranchConcurrency
m["trigger_concurrency"] = spec.TriggerConcurrency
Expand Down Expand Up @@ -638,11 +644,12 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline {
OriginalYamlString: originalYamlString,
},
Spec: cfClient.Spec{
PackId: d.Get("spec.0.pack_id").(string),
Priority: d.Get("spec.0.priority").(int),
Concurrency: d.Get("spec.0.concurrency").(int),
BranchConcurrency: d.Get("spec.0.branch_concurrency").(int),
TriggerConcurrency: d.Get("spec.0.trigger_concurrency").(int),
PackId: d.Get("spec.0.pack_id").(string),
RequiredAvailableStorage: d.Get("spec.0.required_available_storage").(string),
Priority: d.Get("spec.0.priority").(int),
Concurrency: d.Get("spec.0.concurrency").(int),
BranchConcurrency: d.Get("spec.0.branch_concurrency").(int),
TriggerConcurrency: d.Get("spec.0.trigger_concurrency").(int),
},
}

Expand Down
7 changes: 1 addition & 6 deletions docs/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ run pluging with set env CODEFRESH_PLUGIN_DEBUG=true in delve
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"version": "0.2.1",
"configurations": [
{
"name": "terraform-provider-codefresh",
Expand All @@ -36,8 +36,3 @@ export TF_REATTACH_PROVIDERS='{"registry.terraform.io/-/codefresh":{"Protocol":"

terraform apply
```





1 change: 1 addition & 0 deletions docs/resources/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ resource "codefresh_pipeline" "test" {
- `spec_template` - (Optional) A collection of `spec_template` blocks as documented below.
- `runtime_environment` - (Optional) A collection of `runtime_environment` blocks as documented below.
- `pack_id` - (Optional) SAAS pack (`5cd1746617313f468d669013` for Small; `5cd1746717313f468d669014` for Medium; `5cd1746817313f468d669015` for Large; `5cd1746817313f468d669017` for XL; `5cd1746817313f468d669018` for XXL)
- `required_available_storage` - (Optional) Minimum disk space required for build filesystem ( unit Gi is required)
- `contexts` - (Optional) A list of strings representing the contexts ([shared_configuration](https://codefresh.io/docs/docs/configure-ci-cd-pipeline/shared-configuration/)) to be configured for the pipeline
- `termination_policy` - (Optional) A `termination_policy` block as documented below.
- `options` - (Optional) A `options` block as documented below.
Expand Down