-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(pipelines): Fix pipeline triggers for some templated pipelines #2963
fix(pipelines): Fix pipeline triggers for some templated pipelines #2963
Conversation
@@ -87,7 +87,7 @@ class DependentPipelineStarter implements ApplicationContextAware { | |||
strategy : suppliedParameters.strategy == true | |||
] | |||
|
|||
if (pipelineConfig.parameterConfig || !suppliedParameters.empty) { | |||
if (pipelineConfig.parameterConfig || !suppliedParameters.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just a bug, suppliedParameters.empty
tried to look up the key empty
in the map instead of calling the isEmpty()
method.
Work in progress, do not merge yet. |
Pipeline triggers and pipeline stages were broken for templated pipelines that use a dynamic source that references an artifact. Resolved by resolving the artifacts a bit earlier (before the preprocessors).
1bb02fb
to
424d08a
Compare
Updated by adding a test and some minor adjustments. Should be ready for review now. |
} | ||
|
||
if (pipelineConfig.errors != null) { | ||
throw new ValidationException("Pipeline template is invalid", pipelineConfig.errors as List<Map<String, Object>>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Template parsing errors were silently being swallowed, so I added this to surface them to Deck in a proper way. Without this, the code will fail here with the error Cannot get property 'id' on null object
.
Sorry, removed - I thought the author can always edit labels. |
if (parentPipelineStageId != null) { | ||
pipelineConfig.receivedArtifacts = artifactResolver?.getArtifacts(parentPipeline.stageById(parentPipelineStageId)) | ||
} else { | ||
pipelineConfig.receivedArtifacts = artifactResolver?.getAllArtifacts(parentPipeline) | ||
} | ||
|
||
pipelineConfig.trigger = trigger | ||
pipelineConfig.expectedArtifacts = expectedArtifacts | ||
|
||
def artifactError = null | ||
try { | ||
artifactResolver?.resolveArtifacts(pipelineConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this resolve correctly before the pipeline template is expanded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The artifacts should be found in the trigger, which is not a part of the pipeline template, so yes, I believe so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about closing and opening and resolving and unresolving. I’m on mobile and apparently pressing all the buttons 🙄
In our use case the pipeline definition is the artifact, so we have to resolve the artifacts before we can render the pipeline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Templates always make my head hurt, but it seems reasonable.
I will let you know if we run into any issues (we have some crazy template use cases)
@spinnaker/reviewers Can we get this merged? |
@jervi : sorry about that, merging now |
…pinnaker#2963) Pipeline triggers and pipeline stages were broken for templated pipelines that use a dynamic source that references an artifact. Resolved by resolving the artifacts a bit earlier (before the preprocessors). (cherry picked from commit 2e07fcc)
Pipeline triggers and pipeline stages were broken for templated pipelines that use a dynamic source that references an artifact. Resolved by resolving the artifacts a bit earlier (before the preprocessors).