Skip to content

Commit

Permalink
feat: Vela OIDC Provider (#375)
Browse files Browse the repository at this point in the history
* init commit

* add tests

---------

Co-authored-by: david may <1301201+wass3r@users.noreply.github.com>
  • Loading branch information
ecrupper and wass3r authored May 16, 2024
1 parent 88010b5 commit 57d6b8f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pipeline/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
)

Expand Down Expand Up @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions pipeline/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ func testContainers() *ContainerSlice {
Name: "clone",
Number: 2,
Pull: "always",
IDRequest: "yes",
},
{
ID: "step_github/octocat._1_echo",
Expand Down
2 changes: 2 additions & 0 deletions yaml/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
)

Expand Down Expand Up @@ -62,6 +63,7 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice {
Volumes: *step.Volumes.ToPipeline(),
User: step.User,
ReportAs: step.ReportAs,
IDRequest: step.IDRequest,
})
}

Expand Down
2 changes: 2 additions & 0 deletions yaml/step_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -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"},
Expand Down

0 comments on commit 57d6b8f

Please sign in to comment.