Skip to content

Commit f29b7e7

Browse files
committed
Fix to avoid Triggers Runtime to override back to default with empty value {}
1 parent 1a56273 commit f29b7e7

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

client/pipeline.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,24 @@ type SpecTemplate struct {
3535
}
3636

3737
type Trigger struct {
38-
Name string `json:"name,omitempty"`
39-
Description string `json:"description,omitempty"`
40-
Type string `json:"type,omitempty"`
41-
Repo string `json:"repo,omitempty"`
42-
Events []string `json:"events,omitempty"`
43-
BranchRegex string `json:"branchRegex,omitempty"`
44-
BranchRegexInput string `json:"branchRegexInput,omitempty"`
45-
PullRequestTargetBranchRegex string `json:"pullRequestTargetBranchRegex,omitempty"`
46-
CommentRegex string `json:"commentRegex,omitempty"`
47-
ModifiedFilesGlob string `json:"modifiedFilesGlob,omitempty"`
48-
Provider string `json:"provider,omitempty"`
49-
Disabled bool `json:"disabled,omitempty"`
50-
PullRequestAllowForkEvents bool `json:"pullRequestAllowForkEvents,omitempty"`
51-
CommitStatusTitle string `json:"commitStatusTitle,omitempty"`
52-
Context string `json:"context,omitempty"`
53-
Contexts []string `json:"contexts,omitempty"`
54-
RuntimeEnvironment RuntimeEnvironment `json:"runtimeEnvironment,omitempty"`
55-
Variables []Variable `json:"variables,omitempty"`
38+
Name string `json:"name,omitempty"`
39+
Description string `json:"description,omitempty"`
40+
Type string `json:"type,omitempty"`
41+
Repo string `json:"repo,omitempty"`
42+
Events []string `json:"events,omitempty"`
43+
BranchRegex string `json:"branchRegex,omitempty"`
44+
BranchRegexInput string `json:"branchRegexInput,omitempty"`
45+
PullRequestTargetBranchRegex string `json:"pullRequestTargetBranchRegex,omitempty"`
46+
CommentRegex string `json:"commentRegex,omitempty"`
47+
ModifiedFilesGlob string `json:"modifiedFilesGlob,omitempty"`
48+
Provider string `json:"provider,omitempty"`
49+
Disabled bool `json:"disabled,omitempty"`
50+
PullRequestAllowForkEvents bool `json:"pullRequestAllowForkEvents,omitempty"`
51+
CommitStatusTitle string `json:"commitStatusTitle,omitempty"`
52+
Context string `json:"context,omitempty"`
53+
Contexts []string `json:"contexts,omitempty"`
54+
RuntimeEnvironment *RuntimeEnvironment `json:"runtimeEnvironment,omitempty"`
55+
Variables []Variable `json:"variables,omitempty"`
5656
}
5757

5858
type RuntimeEnvironment struct {

codefresh/resource_pipeline.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ func flattenTriggers(triggers []cfClient.Trigger) []map[string]interface{} {
444444
m["type"] = trigger.Type
445445
m["events"] = trigger.Events
446446
m["variables"] = convertVariables(trigger.Variables)
447-
if trigger.RuntimeEnvironment != (cfClient.RuntimeEnvironment{}) {
448-
m["runtime_environment"] = flattenSpecRuntimeEnvironment(trigger.RuntimeEnvironment)
447+
if trigger.RuntimeEnvironment != nil {
448+
m["runtime_environment"] = flattenSpecRuntimeEnvironment(*trigger.RuntimeEnvironment)
449449
}
450450
res[i] = m
451451
}
@@ -534,7 +534,7 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline {
534534
CPU: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.cpu", idx)).(string),
535535
DindStorage: d.Get(fmt.Sprintf("spec.0.trigger.%v.runtime_environment.0.dind_storage", idx)).(string),
536536
}
537-
codefreshTrigger.RuntimeEnvironment = triggerRuntime
537+
codefreshTrigger.RuntimeEnvironment = &triggerRuntime
538538
}
539539
pipeline.Spec.Triggers = append(pipeline.Spec.Triggers, codefreshTrigger)
540540
}

0 commit comments

Comments
 (0)