Skip to content

Revert SetVariables methods #4

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
Jun 29, 2020
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
8 changes: 4 additions & 4 deletions client/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ type RuntimeEnvironment struct {
DindStorage string `json:"dindStorage,omitempty"`
}

func (t *Trigger) SetVariables(variables map[string]string) {
func (t *Trigger) SetVariables(variables map[string]interface{}) {
for key, value := range variables {
t.Variables = append(t.Variables, Variable{Key: key, Value: value})
t.Variables = append(t.Variables, Variable{Key: key, Value: value.(string)})
}
}

Expand All @@ -80,9 +80,9 @@ type Pipeline struct {
Version string `json:"version,omitempty"`
}

func (p *Pipeline) SetVariables(variables map[string]string) {
func (p *Pipeline) SetVariables(variables map[string]interface{}) {
for key, value := range variables {
p.Spec.Variables = append(p.Spec.Variables, Variable{Key: key, Value: value})
p.Spec.Variables = append(p.Spec.Variables, Variable{Key: key, Value: value.(string)})
}
}

Expand Down
4 changes: 2 additions & 2 deletions client/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func (project *Project) GetID() string {
}

// SetVariables project variables
func (project *Project) SetVariables(variables map[string]string) {
func (project *Project) SetVariables(variables map[string]interface{}) {
for key, value := range variables {
project.Variables = append(project.Variables, Variable{Key: key, Value: value})
project.Variables = append(project.Variables, Variable{Key: key, Value: value.(string)})
}
}

Expand Down
4 changes: 2 additions & 2 deletions codefresh/resource_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline {
}
}

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

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

pipeline.Spec.Triggers = append(pipeline.Spec.Triggers, codefreshTrigger)
Expand Down
2 changes: 1 addition & 1 deletion codefresh/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func mapResourceToProject(d *schema.ResourceData) *cfClient.Project {
ProjectName: d.Get("name").(string),
Tags: convertStringArr(tags),
}
variables := d.Get("variables").(map[string]string)
variables := d.Get("variables").(map[string]interface{})
project.SetVariables(variables)
return project
}
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ github.com/hashicorp/terraform-json v0.5.0/go.mod h1:eAbqb4w0pSlRmdvl8fOyHAi/+8j
github.com/hashicorp/terraform-plugin-sdk v1.7.0 h1:B//oq0ZORG+EkVrIJy0uPGSonvmXqxSzXe8+GhknoW0=
github.com/hashicorp/terraform-plugin-sdk v1.7.0/go.mod h1:OjgQmey5VxnPej/buEhe+YqKm0KNvV3QqU4hkqHqPCY=
github.com/hashicorp/terraform-plugin-sdk v1.13.0 h1:8v2/ZNiI12OHxEn8pzJ3noCHyRc0biKbKj+iFv5ZWKw=
github.com/hashicorp/terraform-plugin-sdk v1.13.1 h1:kWq+V+4BMFKtzIuO8wb/k4SRGB/VVF8g468VSFmAnKM=
github.com/hashicorp/terraform-plugin-test v1.2.0 h1:AWFdqyfnOj04sxTdaAF57QqvW7XXrT8PseUHkbKsE8I=
github.com/hashicorp/terraform-plugin-test v1.2.0/go.mod h1:QIJHYz8j+xJtdtLrFTlzQVC0ocr3rf/OjIpgZLK56Hs=
github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 h1:hjyO2JsNZUKT1ym+FAdlBEkGPevazYsmVgIMw7dVELg=
Expand Down