Skip to content

Commit 2767a80

Browse files
committed
Revert SetVariables methods
1 parent 2a57793 commit 2767a80

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

client/pipeline.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ type RuntimeEnvironment struct {
5555
DindStorage string `json:"dindStorage,omitempty"`
5656
}
5757

58-
func (t *Trigger) SetVariables(variables map[string]string) {
58+
func (t *Trigger) SetVariables(variables map[string]interface{}) {
5959
for key, value := range variables {
60-
t.Variables = append(t.Variables, Variable{Key: key, Value: value})
60+
t.Variables = append(t.Variables, Variable{Key: key, Value: value.(string)})
6161
}
6262
}
6363

@@ -80,9 +80,9 @@ type Pipeline struct {
8080
Version string `json:"version,omitempty"`
8181
}
8282

83-
func (p *Pipeline) SetVariables(variables map[string]string) {
83+
func (p *Pipeline) SetVariables(variables map[string]interface{}) {
8484
for key, value := range variables {
85-
p.Spec.Variables = append(p.Spec.Variables, Variable{Key: key, Value: value})
85+
p.Spec.Variables = append(p.Spec.Variables, Variable{Key: key, Value: value.(string)})
8686
}
8787
}
8888

client/project.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ func (project *Project) GetID() string {
1919
}
2020

2121
// SetVariables project variables
22-
func (project *Project) SetVariables(variables map[string]string) {
22+
func (project *Project) SetVariables(variables map[string]interface{}) {
2323
for key, value := range variables {
24-
project.Variables = append(project.Variables, Variable{Key: key, Value: value})
24+
project.Variables = append(project.Variables, Variable{Key: key, Value: value.(string)})
2525
}
2626
}
2727

codefresh/resource_pipeline.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline {
406406
}
407407
}
408408

409-
variables := d.Get("spec.0.variables").(map[string]string)
409+
variables := d.Get("spec.0.variables").(map[string]interface{})
410410
pipeline.SetVariables(variables)
411411

412412
triggers := d.Get("spec.0.trigger").([]interface{})
@@ -425,7 +425,7 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline {
425425
Context: d.Get(fmt.Sprintf("spec.0.trigger.%v.context", idx)).(string),
426426
Events: convertStringArr(events),
427427
}
428-
variables := d.Get(fmt.Sprintf("spec.0.trigger.%v.variables", idx)).(map[string]string)
428+
variables := d.Get(fmt.Sprintf("spec.0.trigger.%v.variables", idx)).(map[string]interface{})
429429
codefreshTrigger.SetVariables(variables)
430430

431431
pipeline.Spec.Triggers = append(pipeline.Spec.Triggers, codefreshTrigger)

codefresh/resource_project.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func mapResourceToProject(d *schema.ResourceData) *cfClient.Project {
125125
ProjectName: d.Get("name").(string),
126126
Tags: convertStringArr(tags),
127127
}
128-
variables := d.Get("variables").(map[string]string)
128+
variables := d.Get("variables").(map[string]interface{})
129129
project.SetVariables(variables)
130130
return project
131131
}

go.sum

+1
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ github.com/hashicorp/terraform-json v0.5.0/go.mod h1:eAbqb4w0pSlRmdvl8fOyHAi/+8j
339339
github.com/hashicorp/terraform-plugin-sdk v1.7.0 h1:B//oq0ZORG+EkVrIJy0uPGSonvmXqxSzXe8+GhknoW0=
340340
github.com/hashicorp/terraform-plugin-sdk v1.7.0/go.mod h1:OjgQmey5VxnPej/buEhe+YqKm0KNvV3QqU4hkqHqPCY=
341341
github.com/hashicorp/terraform-plugin-sdk v1.13.0 h1:8v2/ZNiI12OHxEn8pzJ3noCHyRc0biKbKj+iFv5ZWKw=
342+
github.com/hashicorp/terraform-plugin-sdk v1.13.1 h1:kWq+V+4BMFKtzIuO8wb/k4SRGB/VVF8g468VSFmAnKM=
342343
github.com/hashicorp/terraform-plugin-test v1.2.0 h1:AWFdqyfnOj04sxTdaAF57QqvW7XXrT8PseUHkbKsE8I=
343344
github.com/hashicorp/terraform-plugin-test v1.2.0/go.mod h1:QIJHYz8j+xJtdtLrFTlzQVC0ocr3rf/OjIpgZLK56Hs=
344345
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 h1:hjyO2JsNZUKT1ym+FAdlBEkGPevazYsmVgIMw7dVELg=

0 commit comments

Comments
 (0)