Skip to content

Add RequiredAvailableStorage parameter to RuntimeEnvironment #118

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
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
9 changes: 5 additions & 4 deletions client/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ type TriggerOptions struct {
}

type RuntimeEnvironment struct {
Name string `json:"name,omitempty"`
Memory string `json:"memory,omitempty"`
CPU string `json:"cpu,omitempty"`
DindStorage string `json:"dindStorage,omitempty"`
Name string `json:"name,omitempty"`
Memory string `json:"memory,omitempty"`
CPU string `json:"cpu,omitempty"`
DindStorage string `json:"dindStorage,omitempty"`
RequiredAvailableStorage string `json:"requiredAvailableStorage,omitempty"`
}

func (t *Trigger) SetVariables(variables map[string]interface{}) {
Expand Down
37 changes: 25 additions & 12 deletions codefresh/resource_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ Or: <code>original_yaml_string = file("/path/to/my/codefresh.yml")</code>
Type: schema.TypeString,
Optional: true,
},
"required_available_storage": {
Description: "Minimum disk space required for build filesystem ( unit Gi is required).",
Type: schema.TypeString,
Optional: true,
},
},
},
},
Expand Down Expand Up @@ -437,6 +442,11 @@ The following table presents how to configure this block based on the options av
Type: schema.TypeString,
Optional: true,
},
"required_available_storage": {
Description: "Minimum disk space required for build filesystem ( unit Gi is required).",
Type: schema.TypeString,
Optional: true,
},
},
},
},
Expand Down Expand Up @@ -690,10 +700,11 @@ func flattenSpecTemplate(spec cfClient.SpecTemplate) []map[string]interface{} {
func flattenSpecRuntimeEnvironment(spec cfClient.RuntimeEnvironment) []map[string]interface{} {
return []map[string]interface{}{
{
"name": spec.Name,
"memory": spec.Memory,
"cpu": spec.CPU,
"dind_storage": spec.DindStorage,
"name": spec.Name,
"memory": spec.Memory,
"cpu": spec.CPU,
"dind_storage": spec.DindStorage,
"required_available_storage": spec.RequiredAvailableStorage,
},
}
}
Expand Down Expand Up @@ -788,10 +799,11 @@ func mapResourceToPipeline(d *schema.ResourceData) (*cfClient.Pipeline, error) {

if _, ok := d.GetOk("spec.0.runtime_environment"); ok {
pipeline.Spec.RuntimeEnvironment = cfClient.RuntimeEnvironment{
Name: d.Get("spec.0.runtime_environment.0.name").(string),
Memory: d.Get("spec.0.runtime_environment.0.memory").(string),
CPU: d.Get("spec.0.runtime_environment.0.cpu").(string),
DindStorage: d.Get("spec.0.runtime_environment.0.dind_storage").(string),
Name: d.Get("spec.0.runtime_environment.0.name").(string),
Memory: d.Get("spec.0.runtime_environment.0.memory").(string),
CPU: d.Get("spec.0.runtime_environment.0.cpu").(string),
DindStorage: d.Get("spec.0.runtime_environment.0.dind_storage").(string),
RequiredAvailableStorage: d.Get("spec.0.runtime_environment.0.required_available_storage").(string),
}
}

Expand Down Expand Up @@ -836,10 +848,11 @@ func mapResourceToPipeline(d *schema.ResourceData) (*cfClient.Pipeline, error) {
}
if _, ok := d.GetOk(fmt.Sprintf("spec.0.trigger.%v.runtime_environment", idx)); ok {
triggerRuntime := cfClient.RuntimeEnvironment{
Name: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.name", idx)).(string),
Memory: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.memory", idx)).(string),
CPU: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.cpu", idx)).(string),
DindStorage: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.dind_storage", idx)).(string),
Name: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.name", idx)).(string),
Memory: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.memory", idx)).(string),
CPU: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.cpu", idx)).(string),
DindStorage: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.dind_storage", idx)).(string),
RequiredAvailableStorage: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.required_available_storage", idx)).(string),
}
codefreshTrigger.RuntimeEnvironment = &triggerRuntime
}
Expand Down
2 changes: 2 additions & 0 deletions docs/resources/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Optional:
- `dind_storage` (String) The storage allocated to the runtime environment.
- `memory` (String) The memory allocated to the runtime environment.
- `name` (String) The name of the runtime environment.
- `required_available_storage` (String) Minimum disk space required for build filesystem ( unit Gi is required).


<a id="nestedblock--spec--spec_template"></a>
Expand Down Expand Up @@ -253,6 +254,7 @@ Optional:
- `dind_storage` (String) The storage allocated to the runtime environment.
- `memory` (String) The memory allocated to the runtime environment.
- `name` (String) The name of the runtime environment.
- `required_available_storage` (String) Minimum disk space required for build filesystem ( unit Gi is required).

## Import

Expand Down