From 18713cca98324e57120e5be99b4d5b473441c5bd Mon Sep 17 00:00:00 2001 From: ecrupper Date: Tue, 30 Apr 2024 15:37:25 -0500 Subject: [PATCH 1/2] init commit --- pipeline/container.go | 4 +++- yaml/step.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pipeline/container.go b/pipeline/container.go index fcd12080..3d427cb0 100644 --- a/pipeline/container.go +++ b/pipeline/container.go @@ -52,6 +52,7 @@ type ( Volumes VolumeSlice `json:"volumes,omitempty" yaml:"volumes,omitempty"` User string `json:"user,omitempty" yaml:"user,omitempty"` ReportAs string `json:"report_as,omitempty" yaml:"report_as,omitempty"` + IDRequest string `json:"id_request,omitempty" yaml:"id_request,omitempty"` } ) @@ -135,7 +136,8 @@ func (c *Container) Empty() bool { len(c.Ulimits) == 0 && len(c.Volumes) == 0 && len(c.User) == 0 && - len(c.ReportAs) == 0 { + len(c.ReportAs) == 0 && + len(c.IDRequest) == 0 { return true } diff --git a/yaml/step.go b/yaml/step.go index 396a3b74..feadb8a9 100644 --- a/yaml/step.go +++ b/yaml/step.go @@ -35,6 +35,7 @@ type ( Privileged bool `yaml:"privileged,omitempty" json:"privileged,omitempty" jsonschema:"description=Run the container with extra privileges.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-privileged-tag"` User string `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"description=Set the user for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-user-tag"` ReportAs string `yaml:"report_as,omitempty" json:"report_as,omitempty" jsonschema:"description=Set the name of the step to report as.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-report_as-tag"` + IDRequest string `yaml:"id_request,omitempty" json:"id_request,omitempty" jsonschema:"description=Request ID Request Token for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-id_request-tag"` } ) @@ -62,6 +63,7 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice { Volumes: *step.Volumes.ToPipeline(), User: step.User, ReportAs: step.ReportAs, + IDRequest: step.IDRequest, }) } From 015fd03de543a4e833993f19b0becdb1dda8793b Mon Sep 17 00:00:00 2001 From: ecrupper Date: Thu, 2 May 2024 09:12:41 -0500 Subject: [PATCH 2/2] add tests --- pipeline/container_test.go | 1 + yaml/step_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/pipeline/container_test.go b/pipeline/container_test.go index 1e959cb5..3f5e3a45 100644 --- a/pipeline/container_test.go +++ b/pipeline/container_test.go @@ -932,6 +932,7 @@ func testContainers() *ContainerSlice { Name: "clone", Number: 2, Pull: "always", + IDRequest: "yes", }, { ID: "step_github/octocat._1_echo", diff --git a/yaml/step_test.go b/yaml/step_test.go index 2d0b6034..1ee2a065 100644 --- a/yaml/step_test.go +++ b/yaml/step_test.go @@ -31,6 +31,7 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) { Privileged: false, Pull: "not_present", ReportAs: "my-step", + IDRequest: "yes", Ruleset: Ruleset{ If: Rules{ Branch: []string{"main"}, @@ -88,6 +89,7 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) { Privileged: false, Pull: "not_present", ReportAs: "my-step", + IDRequest: "yes", Ruleset: pipeline.Ruleset{ If: pipeline.Rules{ Branch: []string{"main"},