Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHuynh committed Jan 17, 2025
1 parent 3156794 commit 57f8f9a
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 20 deletions.
1 change: 0 additions & 1 deletion compiler/types/yaml/buildkite/stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package buildkite

import (
"fmt"

bkYaml "github.com/buildkite/yaml"
"github.com/invopop/jsonschema"

Expand Down
1 change: 1 addition & 0 deletions compiler/types/yaml/buildkite/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type (
Commands raw.StringSlice `yaml:"commands,omitempty" json:"commands,omitempty" jsonschema:"description=Execution instructions to run inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-commands-key"`
Entrypoint raw.StringSlice `yaml:"entrypoint,omitempty" json:"entrypoint,omitempty" jsonschema:"description=Command to execute inside the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-entrypoint-key"`
Secrets StepSecretSlice `yaml:"secrets,omitempty" json:"secrets,omitempty" jsonschema:"description=Sensitive variables injected into the container environment.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-secrets-key"`
TestReport TestReport `yaml:"test_report,omitempty" json:"test_report,omitempty" jsonschema:"description=Test report configuration for the step.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-test_report-key"`
Template StepTemplate `yaml:"template,omitempty" json:"template,omitempty" jsonschema:"oneof_required=template,description=Name of template to expand in the pipeline.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-template-key"`
Ulimits UlimitSlice `yaml:"ulimits,omitempty" json:"ulimits,omitempty" jsonschema:"description=Set the user limits for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-ulimits-key"`
Volumes VolumeSlice `yaml:"volumes,omitempty" json:"volumes,omitempty" jsonschema:"description=Mount volumes for the container.\nReference: https://go-vela.github.io/docs/reference/yaml/steps/#the-volume-key"`
Expand Down
40 changes: 40 additions & 0 deletions compiler/types/yaml/buildkite/test_report.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package buildkite

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

// TestReport represents the structure for test report configuration.
type TestReport struct {
Results []string `yaml:"results,omitempty" json:"results,omitempty"`
Attachments []string `yaml:"attachments,omitempty" json:"attachments,omitempty"`
}

// ToPipeline converts the TestReport type
// to a pipeline TestReport type.
func (t *TestReport) ToPipeline() *pipeline.TestReport {
return &pipeline.TestReport{
Results: t.Results,
Attachments: t.Attachments,
}
}

// UnmarshalYAML implements the Unmarshaler interface for the TestReport type.
func (t *TestReport) UnmarshalYAML(unmarshal func(interface{}) error) error {
// test report we try unmarshalling to
testReport := new(struct {
Results []string `yaml:"results,omitempty" json:"results,omitempty"`
Attachments []string `yaml:"attachments,omitempty" json:"attachments,omitempty"`
})

// attempt to unmarshal test report type
err := unmarshal(testReport)
if err != nil {
return err
}

// set the results field
t.Results = testReport.Results
// set the attachments field
t.Attachments = testReport.Attachments

return nil
}
File renamed without changes.
Loading

0 comments on commit 57f8f9a

Please sign in to comment.