Skip to content

Commit c924c0d

Browse files
authored
CR-16640: Add requiredAvailableStorage (#101)
Signed-off-by: Laurent <[email protected]> ## What Added the new field to reserver disk space ## Why Requested by customer ## Notes Signed-off-by: Laurent <[email protected]>
1 parent b75d483 commit c924c0d

File tree

6 files changed

+35
-31
lines changed

6 files changed

+35
-31
lines changed

GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ HOSTNAME=codefresh.io
55
PKG_NAME=codefresh
66
NAMESPACE=app
77
BINARY=terraform-provider-${PKG_NAME}
8-
VERSION=0.1.0
8+
VERSION=0.2.1
99
OS_ARCH=darwin_amd64
1010

1111
default: build

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ export CODEFRESH_API_KEY='xyz'
7878
## Testing the Provider
7979

8080
```bash
81-
export TF_ACC="test"
81+
export TF_ACC="test"
8282
export CODEFRESH_API_KEY=[YOUR API TOKEN]
8383
go test -v ./...
8484
```
8585

8686
## License
8787

88-
Copyright 2022 Codefresh.
88+
Copyright 2023 Codefresh.
8989

9090
The Codefresh Provider is available under [MPL2.0 license](./LICENSE).

client/pipeline.go

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,24 @@ func (t *Trigger) SetVariables(variables map[string]interface{}) {
7878
}
7979

8080
type Spec struct {
81-
Variables []Variable `json:"variables,omitempty"`
82-
SpecTemplate *SpecTemplate `json:"specTemplate,omitempty"`
83-
Triggers []Trigger `json:"triggers,omitempty"`
84-
Priority int `json:"priority,omitempty"`
85-
Concurrency int `json:"concurrency,omitempty"`
86-
BranchConcurrency int `json:"branchConcurrency,omitempty"`
87-
TriggerConcurrency int `json:"triggerConcurrency,omitempty"`
88-
Contexts []interface{} `json:"contexts,omitempty"`
89-
Steps *Steps `json:"steps,omitempty"`
90-
Stages *Stages `json:"stages,omitempty"`
91-
Mode string `json:"mode,omitempty"`
92-
FailFast *bool `json:"fail_fast,omitempty"`
93-
RuntimeEnvironment RuntimeEnvironment `json:"runtimeEnvironment,omitempty"`
94-
TerminationPolicy []map[string]interface{} `json:"terminationPolicy,omitempty"`
95-
PackId string `json:"packId,omitempty"`
96-
Hooks *Hooks `json:"hooks,omitempty"`
97-
Options map[string]bool `json:"options,omitempty"`
81+
Variables []Variable `json:"variables,omitempty"`
82+
SpecTemplate *SpecTemplate `json:"specTemplate,omitempty"`
83+
Triggers []Trigger `json:"triggers,omitempty"`
84+
Priority int `json:"priority,omitempty"`
85+
Concurrency int `json:"concurrency,omitempty"`
86+
BranchConcurrency int `json:"branchConcurrency,omitempty"`
87+
TriggerConcurrency int `json:"triggerConcurrency,omitempty"`
88+
Contexts []interface{} `json:"contexts,omitempty"`
89+
Steps *Steps `json:"steps,omitempty"`
90+
Stages *Stages `json:"stages,omitempty"`
91+
Mode string `json:"mode,omitempty"`
92+
FailFast *bool `json:"fail_fast,omitempty"`
93+
RuntimeEnvironment RuntimeEnvironment `json:"runtimeEnvironment,omitempty"`
94+
TerminationPolicy []map[string]interface{} `json:"terminationPolicy,omitempty"`
95+
PackId string `json:"packId,omitempty"`
96+
RequiredAvailableStorage string `json:"requiredAvailableStorage,omitempty"`
97+
Hooks *Hooks `json:"hooks,omitempty"`
98+
Options map[string]bool `json:"options,omitempty"`
9899
}
99100

100101
type Steps struct {

codefresh/resource_pipeline.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ func resourcePipeline() *schema.Resource {
314314
Type: schema.TypeString,
315315
Optional: true,
316316
},
317+
"required_available_storage": {
318+
Type: schema.TypeString,
319+
Optional: true,
320+
},
317321
"runtime_environment": {
318322
Type: schema.TypeList,
319323
Optional: true,
@@ -510,6 +514,8 @@ func flattenSpec(spec cfClient.Spec) []interface{} {
510514
}
511515

512516
m["pack_id"] = spec.PackId
517+
m["required_available_storage"] = spec.RequiredAvailableStorage
518+
513519
m["concurrency"] = spec.Concurrency
514520
m["branch_concurrency"] = spec.BranchConcurrency
515521
m["trigger_concurrency"] = spec.TriggerConcurrency
@@ -638,11 +644,12 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline {
638644
OriginalYamlString: originalYamlString,
639645
},
640646
Spec: cfClient.Spec{
641-
PackId: d.Get("spec.0.pack_id").(string),
642-
Priority: d.Get("spec.0.priority").(int),
643-
Concurrency: d.Get("spec.0.concurrency").(int),
644-
BranchConcurrency: d.Get("spec.0.branch_concurrency").(int),
645-
TriggerConcurrency: d.Get("spec.0.trigger_concurrency").(int),
647+
PackId: d.Get("spec.0.pack_id").(string),
648+
RequiredAvailableStorage: d.Get("spec.0.required_available_storage").(string),
649+
Priority: d.Get("spec.0.priority").(int),
650+
Concurrency: d.Get("spec.0.concurrency").(int),
651+
BranchConcurrency: d.Get("spec.0.branch_concurrency").(int),
652+
TriggerConcurrency: d.Get("spec.0.trigger_concurrency").(int),
646653
},
647654
}
648655

docs/developer.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ run pluging with set env CODEFRESH_PLUGIN_DEBUG=true in delve
1313
// Use IntelliSense to learn about possible attributes.
1414
// Hover to view descriptions of existing attributes.
1515
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
16-
"version": "0.2.0",
16+
"version": "0.2.1",
1717
"configurations": [
1818
{
1919
"name": "terraform-provider-codefresh",
@@ -36,8 +36,3 @@ export TF_REATTACH_PROVIDERS='{"registry.terraform.io/-/codefresh":{"Protocol":"
3636
3737
terraform apply
3838
```
39-
40-
41-
42-
43-

docs/resources/pipeline.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ resource "codefresh_pipeline" "test" {
107107
- `spec_template` - (Optional) A collection of `spec_template` blocks as documented below.
108108
- `runtime_environment` - (Optional) A collection of `runtime_environment` blocks as documented below.
109109
- `pack_id` - (Optional) SAAS pack (`5cd1746617313f468d669013` for Small; `5cd1746717313f468d669014` for Medium; `5cd1746817313f468d669015` for Large; `5cd1746817313f468d669017` for XL; `5cd1746817313f468d669018` for XXL)
110+
- `required_available_storage` - (Optional) Minimum disk space required for build filesystem ( unit Gi is required)
110111
- `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
111112
- `termination_policy` - (Optional) A `termination_policy` block as documented below.
112113
- `options` - (Optional) A `options` block as documented below.

0 commit comments

Comments
 (0)