Skip to content

Commit 2efb8eb

Browse files
authored
Add RequiredAvailableStorage parameter to RuntimeEnvironment (#118)
## What - Add `RequiredAvailableStorage` to the `RuntimeEnvironment` spec ## Why The current provider doesn't support configuration of required available storage for hybrid runtimes.
1 parent 1b45787 commit 2efb8eb

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

client/pipeline.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ type TriggerOptions struct {
7070
}
7171

7272
type RuntimeEnvironment struct {
73-
Name string `json:"name,omitempty"`
74-
Memory string `json:"memory,omitempty"`
75-
CPU string `json:"cpu,omitempty"`
76-
DindStorage string `json:"dindStorage,omitempty"`
73+
Name string `json:"name,omitempty"`
74+
Memory string `json:"memory,omitempty"`
75+
CPU string `json:"cpu,omitempty"`
76+
DindStorage string `json:"dindStorage,omitempty"`
77+
RequiredAvailableStorage string `json:"requiredAvailableStorage,omitempty"`
7778
}
7879

7980
func (t *Trigger) SetVariables(variables map[string]interface{}) {

codefresh/resource_pipeline.go

+25-12
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ Or: <code>original_yaml_string = file("/path/to/my/codefresh.yml")</code>
322322
Type: schema.TypeString,
323323
Optional: true,
324324
},
325+
"required_available_storage": {
326+
Description: "Minimum disk space required for build filesystem ( unit Gi is required).",
327+
Type: schema.TypeString,
328+
Optional: true,
329+
},
325330
},
326331
},
327332
},
@@ -437,6 +442,11 @@ The following table presents how to configure this block based on the options av
437442
Type: schema.TypeString,
438443
Optional: true,
439444
},
445+
"required_available_storage": {
446+
Description: "Minimum disk space required for build filesystem ( unit Gi is required).",
447+
Type: schema.TypeString,
448+
Optional: true,
449+
},
440450
},
441451
},
442452
},
@@ -690,10 +700,11 @@ func flattenSpecTemplate(spec cfClient.SpecTemplate) []map[string]interface{} {
690700
func flattenSpecRuntimeEnvironment(spec cfClient.RuntimeEnvironment) []map[string]interface{} {
691701
return []map[string]interface{}{
692702
{
693-
"name": spec.Name,
694-
"memory": spec.Memory,
695-
"cpu": spec.CPU,
696-
"dind_storage": spec.DindStorage,
703+
"name": spec.Name,
704+
"memory": spec.Memory,
705+
"cpu": spec.CPU,
706+
"dind_storage": spec.DindStorage,
707+
"required_available_storage": spec.RequiredAvailableStorage,
697708
},
698709
}
699710
}
@@ -788,10 +799,11 @@ func mapResourceToPipeline(d *schema.ResourceData) (*cfClient.Pipeline, error) {
788799

789800
if _, ok := d.GetOk("spec.0.runtime_environment"); ok {
790801
pipeline.Spec.RuntimeEnvironment = cfClient.RuntimeEnvironment{
791-
Name: d.Get("spec.0.runtime_environment.0.name").(string),
792-
Memory: d.Get("spec.0.runtime_environment.0.memory").(string),
793-
CPU: d.Get("spec.0.runtime_environment.0.cpu").(string),
794-
DindStorage: d.Get("spec.0.runtime_environment.0.dind_storage").(string),
802+
Name: d.Get("spec.0.runtime_environment.0.name").(string),
803+
Memory: d.Get("spec.0.runtime_environment.0.memory").(string),
804+
CPU: d.Get("spec.0.runtime_environment.0.cpu").(string),
805+
DindStorage: d.Get("spec.0.runtime_environment.0.dind_storage").(string),
806+
RequiredAvailableStorage: d.Get("spec.0.runtime_environment.0.required_available_storage").(string),
795807
}
796808
}
797809

@@ -836,10 +848,11 @@ func mapResourceToPipeline(d *schema.ResourceData) (*cfClient.Pipeline, error) {
836848
}
837849
if _, ok := d.GetOk(fmt.Sprintf("spec.0.trigger.%v.runtime_environment", idx)); ok {
838850
triggerRuntime := cfClient.RuntimeEnvironment{
839-
Name: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.name", idx)).(string),
840-
Memory: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.memory", idx)).(string),
841-
CPU: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.cpu", idx)).(string),
842-
DindStorage: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.dind_storage", idx)).(string),
851+
Name: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.name", idx)).(string),
852+
Memory: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.memory", idx)).(string),
853+
CPU: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.cpu", idx)).(string),
854+
DindStorage: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.dind_storage", idx)).(string),
855+
RequiredAvailableStorage: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.required_available_storage", idx)).(string),
843856
}
844857
codefreshTrigger.RuntimeEnvironment = &triggerRuntime
845858
}

docs/resources/pipeline.md

+2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Optional:
160160
- `dind_storage` (String) The storage allocated to the runtime environment.
161161
- `memory` (String) The memory allocated to the runtime environment.
162162
- `name` (String) The name of the runtime environment.
163+
- `required_available_storage` (String) Minimum disk space required for build filesystem ( unit Gi is required).
163164

164165

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

257259
## Import
258260

0 commit comments

Comments
 (0)