Simplify CloudFormation ChangeSets in Jenkins Pipelines with ChangeSetDeploy

Previously when deploying CloudFormation changes in Jenkins using the ciinabox-pipelines shared library you had to created the change set and then execute it in separate methods in your pipeline. However there is now a new method that orchestrates both create and execute in one method; changeSetDeploy.

The changeSetDeploy method replaces the createChangeSet and executeChangeSet methods making your pipeline simpler by orchestrating the create and execute methods for you.

@Library('ciinabox') _

pipeline {
  stages {
    stage('deploy change set') {
      steps {
          region: env.AWS_REGION,
          stackName: env.STACK_NAME,
          templateUrl: "${env.TEMPLATE_URL}/${env.CF_VERSION}/template.yaml",
          awsAccountId: env.DEV_ACCOUNT,
          role: env.CIINABOXV2_ROLE,
          roleArn: env.CFN_ROLE,
          nestedStacks: true

Continue on Empty Change Sets

By default changeSetDeploy with continue the pipeline if no changes are detected in created change set. If you do want the pipeline to fail on empty change sets this can be done by setting the failOnEmptyChangeSet property to true.

Approve Change Set

If you want a approval step in-between the create and execute stages of the change set you can set the approveChanges to true. You can then view the changes in the console output in Jenkins before approving the changes to be applied to the stack.

Further Reading

checkout the changeSetDeploy method or the demo-cloudformation-changeset pipeline for further docs and usage help.