Working with stage transitions in CodePipeline
Transitions are links between pipeline stages that can be disabled or enabled. They are enabled by default. When you re-enable a disabled transition, the latest revision runs through the remaining stages of the pipeline unless more than 30 days have passed. Pipeline execution won't resume for a transition that has been disabled more than 30 days unless a new change is detected or you manually rerun the pipeline.
You can use the AWS CodePipeline console or the AWS CLI to disable or enable transitions between stages in a pipeline.
Note
You can use an approval action to pause the run of a pipeline until it is manually approved to continue. For more information, see Add a manual approval action to a stage.
Disable or enable transitions (console)
To disable or enable transitions in a pipeline
-
Sign in to the AWS Management Console and open the CodePipeline console at http://console.aws.amazon.com/codesuite/codepipeline/home
. The names of all pipelines associated with your AWS account are displayed.
-
In Name, choose the name of the pipeline for which you want to enable or disable transitions. This opens a detailed view of the pipeline, including the transitions between the stages of the pipeline.
-
Find the arrow after the last stage that you want to run, and then choose the button next to it. For example, in the following pipeline, if you want the actions in the Staging stage to run, but not the actions in the stage named Production, choose the Disable transition button between those two stages:
-
In the Disable transition dialog box, enter a reason for disabling the transition, and then choose Disable.
The button changes to show that transitions are disabled between the stage preceding the arrow and the stage following the arrow. Any revisions that were already running in the stages that come after the disabled transition continue through the pipeline, but any subsequent revisions do not continue past the disabled transition.
-
Choose the Enable transition button next to the arrow. In the Enable transition dialog box, choose Enable. The pipeline immediately enables the transition between the two stages. If any revisions have been run through the earlier stages after the transition was disabled, in a few moments, the pipeline starts running the latest revision through the stages after the formerly disabled transition. The pipeline runs the revision through all remaining stages in the pipeline.
Note
It might take a few seconds for changes to appear in the CodePipeline console after you enable the transition.
Disable or enable transitions (CLI)
To disable a transition between stages by using the AWS CLI, run the disable-stage-transition command. To enable a disabled transition, run the enable-stage-transition command.
To disable a transition
-
Open a terminal (Linux, macOS, or Unix) or command prompt (Windows) and use the AWS CLI to run the disable-stage-transition command, specifying the name of the pipeline, the name of the stage to which you want to disable transitions, the transition type, and the reason you are disabling transitions to that stage. Unlike using the console, you must also specify whether you are disabling transitions into the stage (inbound) or transitions out of the stage after all actions complete (outbound).
For example, to disable the transition to a stage named
Staging
in a pipeline namedMyFirstPipeline
, you would type a command similar to the following:aws codepipeline disable-stage-transition --pipeline-name
MyFirstPipeline
--stage-nameStaging
--transition-type Inbound --reason "My Reason
"The command returns nothing.
-
To verify the transition has been disabled, either view the pipeline in the CodePipeline console or run the get-pipeline-state command. For more information, see View pipelines (console) and View pipeline details and history (CLI).
To enable a transition
-
Open a terminal (Linux, macOS, or Unix) or command prompt (Windows) and use the AWS CLI to run the enable-stage-transition command, specifying the name of the pipeline, the name of the stage to which you want to enable transitions, and the transition type.
For example, to enable the transition to a stage named
Staging
in a pipeline namedMyFirstPipeline
, you would type a command similar to the following:aws codepipeline enable-stage-transition --pipeline-name
MyFirstPipeline
--stage-nameStaging
--transition-type InboundThe command returns nothing.
-
To verify the transition has been disabled, either view the pipeline in the CodePipeline console or run the get-pipeline-state command. For more information, see View pipelines (console) and View pipeline details and history (CLI).