When created from template, CheckPrecondition doesn't evaluate expression correctly after upstream stages get restarted
Issue Summary:
In pipeline created from template, CheckPrecondition doesn't evaluate expression correctly after upstream stages get restarted
Cloud Provider(s):
Kubernetes
Environment:
1.32.3
Feature Area:
Pipeline Expressions
Description:
We found that, if pipeline is created through template, the evalution expression of CheckPrecondition stages in that pipeline doesn't work correctly after the upstream stage restarted.
Steps to Reproduce:
- create a pipeline with a jenkins stage (ignore this stage failure) and a check precondition stage, example as below JSON configuration:
{
"keepWaitingPipelines": false,
"limitConcurrent": true,
"schema": "1",
"spelEvaluator": "v4",
"stages": [
{
"completeOtherBranchesThenFail": false,
"continuePipeline": true,
"failPipeline": false,
"job": "restart-test",
"master": "my-jenkins",
"name": "stage-1",
"parameters": {},
"refId": "1",
"requisiteStageRefIds": [],
"type": "jenkins"
},
{
"name": "Check Preconditions",
"preconditions": [
{
"context": {
"expression": "\"${ ((#stage('stage-1')['status'].toString() == 'SUCCEEDED') or (#stage('stage-1')['status'].toString() == 'SKIPPED')) }\""
},
"failPipeline": true,
"type": "expression"
}
],
"refId": "2",
"requisiteStageRefIds": [
"1"
],
"type": "checkPreconditions"
}
]
}
- export this pipeline as a template
- create another pipeline through that template, example as below JSON configuration:
{
"exclude": [],
"keepWaitingPipelines": false,
"limitConcurrent": true,
"notifications": [],
"parameterConfig": [],
"schema": "v2",
"stages": [],
"template": {
"artifactAccount": "front50ArtifactCredentials",
"reference": "spinnaker://6b09493f-f467-4f48-a5cb-87547e7edfdb:latest",
"type": "front50/pipelineTemplate"
},
"triggers": [],
"type": "templatedPipeline",
"variables": {}
}
- configure the jenkins job to give a failure output, then start an execution of the pipeline created from template. The
stage-1andCheck Preconditionswill both fail. - configure the jenkins job to give a success output, then restart
stage-1in last execution.stage-1will succeed, whileCheck Preconditionsstill fails.
Additional Details:
Related issue: https://github.com/spinnaker/spinnaker/issues/6829 and https://github.com/spinnaker/spinnaker/issues/6675. It is fixed with a change of reading pipeline configuration in gate. Is it possible that it does not cover the situation of pipeline created from template?
rjalander Is pipeline created by template covered in your last fix in https://github.com/spinnaker/gate/pull/1560/files ?
This issue hasn't been updated in 45 days, so we are tagging it as 'stale'. If you want to remove this label, comment:
@spinnakerbot remove-label stale
This issue is tagged as 'stale' and hasn't been updated in 45 days, so we are tagging it as 'to-be-closed'. It will be closed in 45 days unless updates are made. If you want to remove this label, comment:
@spinnakerbot remove-label to-be-closed
This issue is tagged as 'stale' and hasn't been updated in 45 days, so we are tagging it as 'to-be-closed'. It will be closed in 45 days unless updates are made. If you want to remove this label, comment:
@spinnakerbot remove-label to-be-closed
Just checking - seems like this issue was resolved in v1.31 ? We're encountering something similar on v1.30.1.
This issue hasn't been updated in 45 days, so we are tagging it as 'stale'. If you want to remove this label, comment:
@spinnakerbot remove-label stale
This issue is tagged as 'stale' and hasn't been updated in 45 days, so we are tagging it as 'to-be-closed'. It will be closed in 45 days unless updates are made. If you want to remove this label, comment:
@spinnakerbot remove-label to-be-closed
This issue is tagged as 'stale' and hasn't been updated in 45 days, so we are tagging it as 'to-be-closed'. It will be closed in 45 days unless updates are made. If you want to remove this label, comment:
@spinnakerbot remove-label to-be-closed
This issue is tagged as 'to-be-closed' and hasn't been updated in 45 days, so we are closing it. You can always reopen this issue if needed.