From 45f5ad32ebef0a064952cb95d200329d2894a5ae Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Fri, 12 Jan 2024 16:17:23 -0500 Subject: [PATCH 1/3] fix(compiler): validate yaml.Build post-expansion and fully validate step image (#1036) * fix(compiler): validate yaml.Build post-expansion and fully validate step image * remove errant other file update --- compiler/native/compile.go | 6 ------ compiler/native/validate.go | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler/native/compile.go b/compiler/native/compile.go index b0648ded0..206124519 100644 --- a/compiler/native/compile.go +++ b/compiler/native/compile.go @@ -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) diff --git a/compiler/native/validate.go b/compiler/native/validate.go index 1d5b0440b..e3c79d862 100644 --- a/compiler/native/validate.go +++ b/compiler/native/validate.go @@ -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" { @@ -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" { From e3fc4966a5265485abd843fe1602f6ba2f65cd4b Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Wed, 17 Jan 2024 11:40:52 -0500 Subject: [PATCH 2/3] enhance(ci): add PR title validation (#1039) --- .github/workflows/validate-pr-title.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/validate-pr-title.yml diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml new file mode 100644 index 000000000..aa3588f64 --- /dev/null +++ b/.github/workflows/validate-pr-title.yml @@ -0,0 +1,17 @@ +# name of the action +name: validate PR title + +# trigger on pull_request events of the opened & edited type. +on: + pull_request: + types: [ opened, synchronize, edited, reopened ] + +# pipeline to execute +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: validate title + run: | + echo "${{ github.event.pull_request.title }}" | grep -Eq '^(feat|fix|chore|refactor|enhance|test|docs)\(.*\):.*$' && (echo "Pass"; exit 0) || (echo "Incorrect Format. Please see https://go-vela.github.io/docs/community/contributing_guidelines/#development-workflow"; exit 1) \ No newline at end of file From d79d3a52aabaaf3bb3ed78560b474f4d8bd7276a Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:09:53 -0500 Subject: [PATCH 3/3] fix(ci): title validator handle no parentheses + enforce whitespace (#1041) * fix(ci): title validator handle no parentheses + enforce whitespace * fix --- .github/workflows/validate-pr-title.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/validate-pr-title.yml b/.github/workflows/validate-pr-title.yml index aa3588f64..462f9be92 100644 --- a/.github/workflows/validate-pr-title.yml +++ b/.github/workflows/validate-pr-title.yml @@ -4,14 +4,14 @@ name: validate PR title # trigger on pull_request events of the opened & edited type. on: pull_request: - types: [ opened, synchronize, edited, reopened ] + types: [opened, synchronize, edited, reopened] # pipeline to execute jobs: validate: runs-on: ubuntu-latest - + steps: - - name: validate title - run: | - echo "${{ github.event.pull_request.title }}" | grep -Eq '^(feat|fix|chore|refactor|enhance|test|docs)\(.*\):.*$' && (echo "Pass"; exit 0) || (echo "Incorrect Format. Please see https://go-vela.github.io/docs/community/contributing_guidelines/#development-workflow"; exit 1) \ No newline at end of file + - name: validate title + run: | + echo "${{ github.event.pull_request.title }}" | grep -Eq '^(feat|fix|chore|refactor|enhance|test|docs)(\(.*\)|):\s.+$' && (echo "Pass"; exit 0) || (echo "Incorrect Format. Please see https://go-vela.github.io/docs/community/contributing_guidelines/#development-workflow"; exit 1)