From c0c730d926383bc4b807d5097dccb6e00fba7e0c Mon Sep 17 00:00:00 2001 From: Chris Sena Date: Fri, 13 Nov 2020 10:37:52 +0000 Subject: [PATCH 1/4] fix: add missing PipelineRunParams when creating LighthouseJobSpec from job.Base add missing PipelineRunParams in specFromJobBase add corresponding test case fix #1155 --- pkg/jobutil/jobutil.go | 13 +++++++------ pkg/jobutil/jobutil_test.go | 32 +++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/pkg/jobutil/jobutil.go b/pkg/jobutil/jobutil.go index d09649682..f1c7eab2c 100644 --- a/pkg/jobutil/jobutil.go +++ b/pkg/jobutil/jobutil.go @@ -163,12 +163,13 @@ func specFromJobBase(jb job.Base) v1alpha1.LighthouseJobSpec { namespace = *jb.Namespace } return v1alpha1.LighthouseJobSpec{ - Agent: jb.Agent, - Job: jb.Name, - Namespace: namespace, - MaxConcurrency: jb.MaxConcurrency, - PodSpec: jb.Spec, - PipelineRunSpec: jb.PipelineRunSpec, + Agent: jb.Agent, + Job: jb.Name, + Namespace: namespace, + MaxConcurrency: jb.MaxConcurrency, + PodSpec: jb.Spec, + PipelineRunSpec: jb.PipelineRunSpec, + PipelineRunParams: jb.PipelineRunParams, } } diff --git a/pkg/jobutil/jobutil_test.go b/pkg/jobutil/jobutil_test.go index 0cd75a01f..a106bd028 100644 --- a/pkg/jobutil/jobutil_test.go +++ b/pkg/jobutil/jobutil_test.go @@ -163,6 +163,36 @@ func TestPresubmitSpec(t *testing.T) { }, }, }, + { + name: "pipeline_run_params are added to lighthouseJobSpec", + p: job.Presubmit{ + Base: job.Base{ + PipelineRunParams: []job.PipelineRunParam{ + { + Name: "FOO_PARAM", + ValueTemplate: "BAR_VALUE", + }, + }, + }, + }, + refs: v1alpha1.Refs{ + PathAlias: "fancy", + CloneURI: "cats", + }, + expected: v1alpha1.LighthouseJobSpec{ + Type: job.PresubmitJob, + Refs: &v1alpha1.Refs{ + PathAlias: "fancy", + CloneURI: "cats", + }, + PipelineRunParams: []job.PipelineRunParam{ + { + Name: "FOO_PARAM", + ValueTemplate: "BAR_VALUE", + }, + }, + }, + }, } for _, tc := range tests { @@ -526,7 +556,7 @@ func TestSpecFromJobBase(t *testing.T) { verify func(v1alpha1.LighthouseJobSpec) error }{ { - name: "Verify reporter config gets copied", + name: "Verify reporter config gets copied", jobBase: job.Base{ /* ReporterConfig: &v1alpha1.ReporterConfig{ Slack: &v1alpha1.SlackReporterConfig{ From 6ee9cb0a0470c3f734349c9091664259f88521cb Mon Sep 17 00:00:00 2001 From: Chris Sena Date: Fri, 13 Nov 2020 10:48:14 +0000 Subject: [PATCH 2/4] test: add pipeline_run_params to test param value added to PipelineRun --- .../test_data/controller/start-pullrequest/expected-lhjob.yml | 2 ++ .../test_data/controller/start-pullrequest/expected-pr.yml | 2 ++ .../test_data/controller/start-pullrequest/observed-lhjob.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-lhjob.yml b/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-lhjob.yml index 08be098a1..51b8111f8 100644 --- a/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-lhjob.yml +++ b/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-lhjob.yml @@ -34,6 +34,8 @@ spec: value_template: '{{ range $i, $v := .Refs.Pulls }}{{if $i}} {{end}}{{ $v.SHA }}{{ end }}' - name: repo-url value_template: '{{ .Refs.CloneURI }}' + - name: foo-param + value_template: bar-value refs: base_link: https://github.com/jenkins-x/lighthouse/commit/e8d56b5ee9671599c75644af574a251dd3b94a5c base_ref: master diff --git a/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-pr.yml b/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-pr.yml index 079685d45..8f551991a 100644 --- a/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-pr.yml +++ b/pkg/engines/tekton/test_data/controller/start-pullrequest/expected-pr.yml @@ -52,6 +52,8 @@ spec: value: https://github.com/jenkins-x/lighthouse.git - name: branch-name value: dd64c739442d505cf5381e2a14b60968e8a0d86e + - name: foo-param + value: bar-value - name: repo-url value: https://github.com/jenkins-x/lighthouse.git pipelineRef: diff --git a/pkg/engines/tekton/test_data/controller/start-pullrequest/observed-lhjob.yml b/pkg/engines/tekton/test_data/controller/start-pullrequest/observed-lhjob.yml index 699d6c322..3b318c11b 100644 --- a/pkg/engines/tekton/test_data/controller/start-pullrequest/observed-lhjob.yml +++ b/pkg/engines/tekton/test_data/controller/start-pullrequest/observed-lhjob.yml @@ -31,6 +31,8 @@ spec: value_template: '{{ range $i, $v := .Refs.Pulls }}{{if $i}} {{end}}{{ $v.SHA }}{{ end }}' - name: repo-url value_template: '{{ .Refs.CloneURI }}' + - name: foo-param + value_template: bar-value refs: base_link: https://github.com/jenkins-x/lighthouse/commit/e8d56b5ee9671599c75644af574a251dd3b94a5c base_ref: master From 7f2cb5b6c7e668baaa0b5591d9e8d5e17de4cc2c Mon Sep 17 00:00:00 2001 From: Chris Sena Date: Mon, 16 Nov 2020 18:47:07 +0000 Subject: [PATCH 3/4] style: fix formatting in jobutil_test.go --- pkg/jobutil/jobutil_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/jobutil/jobutil_test.go b/pkg/jobutil/jobutil_test.go index a106bd028..987e2496c 100644 --- a/pkg/jobutil/jobutil_test.go +++ b/pkg/jobutil/jobutil_test.go @@ -556,7 +556,7 @@ func TestSpecFromJobBase(t *testing.T) { verify func(v1alpha1.LighthouseJobSpec) error }{ { - name: "Verify reporter config gets copied", + name: "Verify reporter config gets copied", jobBase: job.Base{ /* ReporterConfig: &v1alpha1.ReporterConfig{ Slack: &v1alpha1.SlackReporterConfig{ From bf235971cb6b6cdd379fa07cee4381e24b668bee Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 25 Mar 2021 12:46:21 +0000 Subject: [PATCH 4/4] fix: lets make the release a prerelease --- .lighthouse/jenkins-x/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.lighthouse/jenkins-x/release.yaml b/.lighthouse/jenkins-x/release.yaml index 758971058..dc850ffe4 100755 --- a/.lighthouse/jenkins-x/release.yaml +++ b/.lighthouse/jenkins-x/release.yaml @@ -69,7 +69,7 @@ spec: /kaniko/executor $KANIKO_FLAGS --context=/workspace/source --dockerfile=docker/gc/Dockerfile --destination=gcr.io/jenkinsxio/lighthouse-gc-jobs:$VERSION --build-arg=VERSION=$VERSION - name: chart-docs resources: {} - - image: gcr.io/jenkinsxio/jx-changelog:0.0.34 + - image: gcr.io/jenkinsxio/jx-changelog:0.0.35 name: changelog resources: {} script: | @@ -79,7 +79,7 @@ spec: sed -i -e "s/^version:.*/version: $VERSION/" ./charts/$REPO_NAME/Chart.yaml sed -i -e "s/tag:.*/tag: $VERSION/" ./charts/$REPO_NAME/values.yaml; - jx changelog create --verbose --header-file=hack/changelog-header.md --version=$VERSION --rev=$PULL_BASE_SHA --output-markdown=changelog.md --update-release=false + jx changelog create --verbose --header-file=hack/changelog-header.md --version=$VERSION --rev=$PULL_BASE_SHA --output-markdown=changelog.md --prerelease - name: release-chart resources: {} - name: upload-binaries