Skip to content

Commit

Permalink
fix(compiler): validate yaml.Build post-expansion and fully validate …
Browse files Browse the repository at this point in the history
…step image (#1036)

* fix(compiler): validate yaml.Build post-expansion and fully validate step image

* remove errant other file update
  • Loading branch information
ecrupper authored Jan 12, 2024
1 parent 78eca51 commit 45f5ad3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions compiler/native/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ func (c *client) Compile(v interface{}) (*pipeline.Build, *library.Pipeline, err
_pipeline.SetData(data)
_pipeline.SetType(c.repo.GetPipelineType())

// validate the yaml configuration
err = c.Validate(p)
if err != nil {
return nil, _pipeline, err
}

// create map of templates for easy lookup
templates := mapFromTemplates(p.Templates)

Expand Down
8 changes: 4 additions & 4 deletions compiler/native/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ func validateStages(s yaml.StageSlice) error {
return fmt.Errorf("no name provided for step for stage %s", stage.Name)
}

if len(step.Image) == 0 && len(step.Template.Name) == 0 {
return fmt.Errorf("no image or template provided for step %s for stage %s", step.Name, stage.Name)
if len(step.Image) == 0 {
return fmt.Errorf("no image provided for step %s for stage %s", step.Name, stage.Name)
}

if step.Name == "clone" || step.Name == "init" {
Expand All @@ -128,8 +128,8 @@ func validateSteps(s yaml.StepSlice) error {
return fmt.Errorf("no name provided for step")
}

if len(step.Image) == 0 && len(step.Template.Name) == 0 {
return fmt.Errorf("no image or template provided for step %s", step.Name)
if len(step.Image) == 0 {
return fmt.Errorf("no image provided for step %s", step.Name)
}

if step.Name == "clone" || step.Name == "init" {
Expand Down

0 comments on commit 45f5ad3

Please sign in to comment.