Skip to content

Commit

Permalink
fields for buildkite and ymal
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHuynh committed Jan 20, 2025
1 parent 14660f5 commit 05a09bb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
2 changes: 2 additions & 0 deletions compiler/types/yaml/buildkite/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice {
Pull: step.Pull,
Ruleset: *step.Ruleset.ToPipeline(),
Secrets: *step.Secrets.ToPipeline(),
TestReport: *step.TestReport.ToPipeline(),
Ulimits: *step.Ulimits.ToPipeline(),
Volumes: *step.Volumes.ToPipeline(),
User: step.User,
Expand Down Expand Up @@ -166,6 +167,7 @@ func (s *Step) ToYAML() *yaml.Step {
Ruleset: *s.Ruleset.ToYAML(),
Secrets: *s.Secrets.ToYAML(),
Template: s.Template.ToYAML(),
TestReport: s.TestReport.ToYAML(),
Ulimits: *s.Ulimits.ToYAML(),
Volumes: *s.Volumes.ToYAML(),
Parameters: s.Parameters,
Expand Down
8 changes: 4 additions & 4 deletions compiler/types/yaml/buildkite/step_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) {
},
},
TestReport: TestReport{
Results: []string{"test.txt"},
Attachments: []string{"test.log"},
Results: []string{"test-results/*.xml"},
Attachments: []string{"screenshots/**/*.png", " video/*.mp4"},
},
},
},
Expand Down Expand Up @@ -139,8 +139,8 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) {
},
},
TestReport: pipeline.TestReport{
Results: []string{"test.txt"},
Attachments: []string{"test.log"},
Results: []string{"test-results/*.xml"},
Attachments: []string{"screenshots/**/*.png", " video/*.mp4"},
},
},
},
Expand Down
12 changes: 11 additions & 1 deletion compiler/types/yaml/buildkite/test_report.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package buildkite

import "github.com/go-vela/server/compiler/types/pipeline"
import (
"github.com/go-vela/server/compiler/types/pipeline"
"github.com/go-vela/server/compiler/types/yaml/yaml"
)

// TestReport represents the structure for test report configuration.
type TestReport struct {
Expand Down Expand Up @@ -38,3 +41,10 @@ func (t *TestReport) UnmarshalYAML(unmarshal func(interface{}) error) error {

return nil
}

func (t *TestReport) ToYAML() yaml.TestReport {
return yaml.TestReport{
Results: t.Results,
Attachments: t.Attachments,
}
}
7 changes: 7 additions & 0 deletions compiler/types/yaml/buildkite/testdata/step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@
registry: index.docker.io
repo: github/octocat
tags: [ latest, dev ]

- name: test-reports
image: golang:1.20
pull: true
test_report:
results: ["test-results/*.xml"]
attachments: ["screenshots/**/*.png", " video/*.mp4"]
2 changes: 1 addition & 1 deletion compiler/types/yaml/yaml/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ func (s *StepSlice) ToPipeline() *pipeline.ContainerSlice {
Pull: step.Pull,
Ruleset: *step.Ruleset.ToPipeline(),
Secrets: *step.Secrets.ToPipeline(),
TestReport: *step.TestReport.ToPipeline(),
Ulimits: *step.Ulimits.ToPipeline(),
Volumes: *step.Volumes.ToPipeline(),
User: step.User,
ReportAs: step.ReportAs,
IDRequest: step.IDRequest,
TestReport: *step.TestReport.ToPipeline(),
})
}

Expand Down
17 changes: 17 additions & 0 deletions compiler/types/yaml/yaml/step_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) {
AccessMode: "ro",
},
},
TestReport: TestReport{
Results: []string{"test-results/*.xml"},
Attachments: []string{"screenshots/**/*.png", " video/*.mp4"},
},
},
},
want: &pipeline.ContainerSlice{
Expand Down Expand Up @@ -134,6 +138,10 @@ func TestYaml_StepSlice_ToPipeline(t *testing.T) {
AccessMode: "ro",
},
},
TestReport: pipeline.TestReport{
Results: []string{"test-results/*.xml"},
Attachments: []string{"screenshots/**/*.png", " video/*.mp4"},
},
},
},
},
Expand Down Expand Up @@ -213,6 +221,15 @@ func TestYaml_StepSlice_UnmarshalYAML(t *testing.T) {
},
},
},
{
Name: "test-reports",
Image: "golang:1.20",
Pull: "always",
TestReport: TestReport{
Results: []string{"test-results/*.xml"},
Attachments: []string{"screenshots/**/*.png", " video/*.mp4"},
},
},
},
},
{
Expand Down

0 comments on commit 05a09bb

Please sign in to comment.