Skip to content

Commit

Permalink
Merge pull request #1266 from jstrachan/chrissena-fixes/copyPipelineP…
Browse files Browse the repository at this point in the history
…arams

fix: add missing PipelineRunParams when creating LighthouseJobSpec from job.Base
  • Loading branch information
jenkins-x-bot-test authored Mar 25, 2021
2 parents 7f021c3 + bf23597 commit 72110fe
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .lighthouse/jenkins-x/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions pkg/jobutil/jobutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
30 changes: 30 additions & 0 deletions pkg/jobutil/jobutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 72110fe

Please sign in to comment.