CL9: Add Approval & Deployment

Task: Add Approval & Deployment

Add Approval Step

Open your pipeline and go to edit mode. Add a new stage below the Build.

Preparation menu

Add a new Action Group & Action “Approve”, make sure to select the proper SNS topic. The result should look as follows:

Preparation menu

Add Deployment Step

Create an additonal Action called Deploy and select AWS CodeBuild as Action provider:

Preparation menu

As previously done, create a new CodeBuild project. Suggested naming is <artifactId>-deploy.

Note: Make sure so select Ubuntu as OS once again!

Preparation menu

As Buidlspec, enter deployspec.yml:

Preparation menu

Finish the CodeBuild Wizard and return to CodePipeline. Finish the CodePipeline Wizard.

Preparation menu

The result should look as follows:

Preparation menu

Hit save!

Test

To trigger a new pipeline execution, just modify any file inside the repository and push changes e.g. put a comment in deployspec.yml.

$ git add *
$ git commit -m 'changed deployspec'
$ git push

Now check your pipeline and approve

Preparation menu

In case of errors, check the CodeBuild logs -> Build Details.

If you are facing the following “AccessDeniedException”, make sure to modify the respective role.

Preparation menu

Go to AWS IAM, locate the mentioned role and add a “AmazonSSMReadOnlyAccess” or similar policy:

Preparation menu

Restart the pipeline manually, by pressing “Release change”:

Preparation menu

Check for a successful build

Preparation menu

Verify, that the deployment has actually taken place, by looking into the Build logs.

Preparation menu

From the Build logs, note down the routes URL - you should now be able to launch it via your web browser. The output should look as follows:

Preparation menu

Make sure to also check your SAP Cloud Platform Cockpit - Applications Area!