From ffda3573aa90eb27a72a4547ce1f1f5054907ab3 Mon Sep 17 00:00:00 2001 From: Laurent Date: Fri, 4 Mar 2022 11:57:30 -0700 Subject: [PATCH 1/3] #28: add pack_id to support Saas package size --- client/pipeline.go | 1 + codefresh/resource_pipeline.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/client/pipeline.go b/client/pipeline.go index c91ddbd..b22123d 100644 --- a/client/pipeline.go +++ b/client/pipeline.go @@ -92,6 +92,7 @@ type Spec struct { FailFast *bool `json:"fail_fast,omitempty"` RuntimeEnvironment RuntimeEnvironment `json:"runtimeEnvironment,omitempty"` TerminationPolicy []map[string]interface{} `json:"terminationPolicy,omitempty"` + PackId string `json:"packId,omitempty"` Hooks *Hooks `json:"hooks,omitempty"` Options map[string]bool `json:"options,omitempty"` } diff --git a/codefresh/resource_pipeline.go b/codefresh/resource_pipeline.go index 822e467..023f141 100644 --- a/codefresh/resource_pipeline.go +++ b/codefresh/resource_pipeline.go @@ -310,6 +310,10 @@ func resourcePipeline() *schema.Resource { }, }, }, + "pack_id": { + Type: schema.TypeString, + Optional: true, + }, "runtime_environment": { Type: schema.TypeList, Optional: true, @@ -505,10 +509,12 @@ func flattenSpec(spec cfClient.Spec) []interface{} { m["options"] = resOptions } + m["pack_id"] = spec.PackId m["concurrency"] = spec.Concurrency m["branch_concurrency"] = spec.BranchConcurrency m["trigger_concurrency"] = spec.TriggerConcurrency + m["priority"] = spec.Priority m["contexts"] = spec.Contexts @@ -633,6 +639,7 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline { OriginalYamlString: originalYamlString, }, Spec: cfClient.Spec{ + PackId: d.Get("spec.0.pack_id").(string), Priority: d.Get("spec.0.priority").(int), Concurrency: d.Get("spec.0.concurrency").(int), BranchConcurrency: d.Get("spec.0.branch_concurrency").(int), From 42504ed22017f689d7a4d2d935a69279aa01c054 Mon Sep 17 00:00:00 2001 From: Vadim Gusev Date: Mon, 14 Mar 2022 17:00:00 +0300 Subject: [PATCH 2/3] run go fmt --- client/pipeline.go | 2 +- codefresh/resource_pipeline.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/pipeline.go b/client/pipeline.go index b22123d..2d19482 100644 --- a/client/pipeline.go +++ b/client/pipeline.go @@ -92,7 +92,7 @@ type Spec struct { FailFast *bool `json:"fail_fast,omitempty"` RuntimeEnvironment RuntimeEnvironment `json:"runtimeEnvironment,omitempty"` TerminationPolicy []map[string]interface{} `json:"terminationPolicy,omitempty"` - PackId string `json:"packId,omitempty"` + PackId string `json:"packId,omitempty"` Hooks *Hooks `json:"hooks,omitempty"` Options map[string]bool `json:"options,omitempty"` } diff --git a/codefresh/resource_pipeline.go b/codefresh/resource_pipeline.go index 023f141..1c39253 100644 --- a/codefresh/resource_pipeline.go +++ b/codefresh/resource_pipeline.go @@ -509,12 +509,11 @@ func flattenSpec(spec cfClient.Spec) []interface{} { m["options"] = resOptions } - m["pack_id"] = spec.PackId + m["pack_id"] = spec.PackId m["concurrency"] = spec.Concurrency m["branch_concurrency"] = spec.BranchConcurrency m["trigger_concurrency"] = spec.TriggerConcurrency - m["priority"] = spec.Priority m["contexts"] = spec.Contexts @@ -639,7 +638,7 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline { OriginalYamlString: originalYamlString, }, Spec: cfClient.Spec{ - PackId: d.Get("spec.0.pack_id").(string), + PackId: d.Get("spec.0.pack_id").(string), Priority: d.Get("spec.0.priority").(int), Concurrency: d.Get("spec.0.concurrency").(int), BranchConcurrency: d.Get("spec.0.branch_concurrency").(int), From b2b117ba533f42006bc4fec307f790c2105d5d24 Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 14 Mar 2022 07:37:56 -0700 Subject: [PATCH 3/3] go fmt --- client/pipeline.go | 2 +- codefresh/resource_pipeline.go | 5 ++--- tools.go | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/pipeline.go b/client/pipeline.go index b22123d..2d19482 100644 --- a/client/pipeline.go +++ b/client/pipeline.go @@ -92,7 +92,7 @@ type Spec struct { FailFast *bool `json:"fail_fast,omitempty"` RuntimeEnvironment RuntimeEnvironment `json:"runtimeEnvironment,omitempty"` TerminationPolicy []map[string]interface{} `json:"terminationPolicy,omitempty"` - PackId string `json:"packId,omitempty"` + PackId string `json:"packId,omitempty"` Hooks *Hooks `json:"hooks,omitempty"` Options map[string]bool `json:"options,omitempty"` } diff --git a/codefresh/resource_pipeline.go b/codefresh/resource_pipeline.go index 023f141..1c39253 100644 --- a/codefresh/resource_pipeline.go +++ b/codefresh/resource_pipeline.go @@ -509,12 +509,11 @@ func flattenSpec(spec cfClient.Spec) []interface{} { m["options"] = resOptions } - m["pack_id"] = spec.PackId + m["pack_id"] = spec.PackId m["concurrency"] = spec.Concurrency m["branch_concurrency"] = spec.BranchConcurrency m["trigger_concurrency"] = spec.TriggerConcurrency - m["priority"] = spec.Priority m["contexts"] = spec.Contexts @@ -639,7 +638,7 @@ func mapResourceToPipeline(d *schema.ResourceData) *cfClient.Pipeline { OriginalYamlString: originalYamlString, }, Spec: cfClient.Spec{ - PackId: d.Get("spec.0.pack_id").(string), + PackId: d.Get("spec.0.pack_id").(string), Priority: d.Get("spec.0.priority").(int), Concurrency: d.Get("spec.0.concurrency").(int), BranchConcurrency: d.Get("spec.0.branch_concurrency").(int), diff --git a/tools.go b/tools.go index 23cb7bc..e139785 100644 --- a/tools.go +++ b/tools.go @@ -1,3 +1,4 @@ +//go:build tools // +build tools package main