File tree Expand file tree Collapse file tree 5 files changed +11
-11
lines changed Expand file tree Collapse file tree 5 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,11 @@ type ExportRunner struct {
87
87
88
88
// runE generates the pipeline and writes it into a file or stdout.
89
89
func (r * ExportRunner ) runE (c * cobra.Command , args []string ) error {
90
- pipeline := r .Pipeline .Init (r .PipelineConfig ).Generate ()
90
+ pipeline , e := r .Pipeline .Init (r .PipelineConfig ).Generate ()
91
+
92
+ if e != nil {
93
+ return e
94
+ }
91
95
92
96
if r .OutputFilePath != "" {
93
97
fo , err := os .Create (r .OutputFilePath )
Original file line number Diff line number Diff line change @@ -54,8 +54,6 @@ func (p *CloudBuild) Init(config *types.PipelineConfig) Pipeline {
54
54
return p
55
55
}
56
56
57
- func (p * CloudBuild ) Generate () []byte {
58
- data , _ := yaml .Marshal (p )
59
-
60
- return data
57
+ func (p * CloudBuild ) Generate () (out []byte , err error ) {
58
+ return yaml .Marshal (p )
61
59
}
Original file line number Diff line number Diff line change @@ -82,8 +82,6 @@ func (p *GitHubActions) Init(config *types.PipelineConfig) Pipeline {
82
82
return p
83
83
}
84
84
85
- func (p * GitHubActions ) Generate () []byte {
86
- data , _ := yaml .Marshal (p )
87
-
88
- return data
85
+ func (p * GitHubActions ) Generate () (out []byte , err error ) {
86
+ return yaml .Marshal (p )
89
87
}
Original file line number Diff line number Diff line change @@ -22,5 +22,5 @@ const KptImage = "gongpu/kpt:latest"
22
22
// Pipeline is an abstraction of different workflow orchestrators.
23
23
type Pipeline interface {
24
24
Init (config * types.PipelineConfig ) Pipeline
25
- Generate () []byte
25
+ Generate () ( out []byte , err error )
26
26
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ func TestPipeline(t *testing.T) {
47
47
testCase := testCases [i ]
48
48
49
49
t .Run (testCase .description , func (t * testing.T ) {
50
- pipeline := pipeline .Init (testCase .config ).Generate ()
50
+ pipeline , _ := pipeline .Init (testCase .config ).Generate ()
51
51
52
52
actual := string (pipeline )
53
53
expected := strings .TrimLeft (testCase .expected , "\n " )
You can’t perform that action at this time.
0 commit comments