-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
TimHuynh
committed
Jan 17, 2025
1 parent
3156794
commit 57f8f9a
Showing
5 changed files
with
108 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ package buildkite | |
|
||
import ( | ||
"fmt" | ||
|
||
bkYaml "github.com/buildkite/yaml" | ||
"github.com/invopop/jsonschema" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.