[cdk-pipelines] Infinite-loop in self-mutating pipeline #32008
Description
Describe the bug
The pipeline's 'UpdatePipeline' stage succeeds and the pipeline restarts, which it is expected to do once when infrastructure is updated. However, when it restarts, it updates itself again. This loops infinitely, and the pipeline never reaches the Assets
stage. It appears to happen on V2
, with SUPERSEDED
mode, and restart_execution_on_update=True
.
I could not reproduce it on V2
with PARALLEL
mode and restart_execution_on_update=False
.
This appears to be caused by the docker asset hashes changing while the rest of the template stays the same. Synth is not introducing nondeterminism and the dockerfiles and directories are exactly the same between runs, but the hashes keep changing.
I initially reported this here and here.
This may be a regression of #9766 and the fix here.
#9080 is likely also related.
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
No response
Expected Behavior
The pipeline to self mutate once and then continue to Assets stage at the next cycle
Current Behavior
The pipeline continuously self mutates in an infinite loop.
Reproduction Steps
On codepipeline V2
, use restart_execution_on_update=True
in SUPERSEDED
mode.
Possible Solution
No response
Additional Information/Context
I reverted to PARALLEL
mode from SUPERSEDED
and restart_execution_on_update=False
.
It's now able to progress to Assets
stage. I'm on version 2.164.1
.
For context:
- For months I was using
SUPERSEDED
mode withrestart_execution_on_update=True
on codepipelineV1
. - I recently migrated to
V2
, usingPARALLEL
mode andrestart_execution_on_update=False
.- This worked
- Then I switched to
SUPERSEDED
mode withrestart_execution_on_update=False
.- This did not work as the build would get cancelled (expected) after self-mutate, and I'd have to restart it manually, and then it would get cancelled again (unexpected)
- Then I switched to
SUPERSEDED
mode withrestart_execution_on_update=True
.- This did not work as it would enter an endless loop between synth and self-mutate
- Then I switched back to
PARALLEL
mode andrestart_execution_on_update=False
.- This worked, again
I would like to switch back to SUPERSEDED
mode with restart_execution_on_update=True
as SUPERSEDED
mode supports building 50 docker assets in parallel while PARALLEL
only supports 5, and I'd like to not worry about the pipeline restarting after infra changes.
CDK CLI Version
2.164.1
Framework Version
No response
Node.js Version
v20.15.1
OS
MacOS
Language
Python
Language Version
No response
Other information
No response