Starting Pipeline Build

At this point the CI/CD pipeline cloud infrastructure, the build-out of which was launched two chapters back, should be completed.

First, please check the command prompt console where you ran cdk deploy for the “CicdInfraAsCode” project, to make there were no errors. You should see something like the following at the tail of the output after command has finished:

 30/30 | 1:10:43 PM | CREATE_COMPLETE      | AWS::CloudFormation::Stack  | Unicorn-Store-CI-CD-PipelineStack

 ✅  Unicorn-Store-CI-CD-PipelineStack

Stack ARN:

Next, navigate to the CodePipeline in the AWS Console and observe “Unicorn-Store-CI-CD-Pipeline” in the list, showing the “Failed” status next to it. The pipeline is in the failed state because the source code of the Unicorn Store solution has not yet been pushed to the CodeCommit Git repository.

Please click on the “Unicorn-Store-CI-CD-Pipeline” link to see the brand-new pipeline: CodePipeline in Failed state without source code

Starting the Pipeline: Pushing Source Code to CodeCommit

To trigger the build and deployment pipeline, all we need to do is to push the Unicorn Store to the CodeCommit Git repository just created.

Following step: adding Git “remote” (alias) pointing to the CodeCommit repository, can be skipped if you are taking this lab at an AWS event, as the “aws” Git remote is already created on your dev VM.

Windows users, please use Powershell in Administrator mode for running commands that follow.

  1. First, cd into the root of the Unicorn Store solution.
  2. Create Git “remote” named “aws”:

    git remote add aws (aws codecommit get-repository --repository-name Unicorn-Store-Sample-Git-Repo | jq -r .repositoryMetadata.cloneUrlHttp)
  3. Push the code to the CodeCommit repository:

    git push aws cdk-module

    In the command above, “aws” is the name of the git remote pointing to the CodeCommit in your AWS Account, and “cdk-module” is the name of the git branch.

Wait a few moments, and then go to the AWS Console CodePipeline page to observe CodePipeline build in-progress : CodePipeline

First run of the pipeline is likely to take approximately 15 minutes, primarily due to time required to provision application database and ECS-based application hosting infrastructure. Subsequent pipeline runs could finish in under one minute if no changes were introduced into the CDK-based infrastructure code.

Clicking “Details” links of each Build stage action, will show the real-time stdout/console output of the application build and hosting infrastructure build, respectively.

The Details of the Docker image build action output shows how application is being built. If it fails to build for whatever reason and results in a “red” action status, the console output will provide most definitive information about causes of issues. The same is true for the hosting/deployment infra Build step action. Even when everything builds fine, please review the Build step action output - that will provide a lot of insight into both how application is built & deployed, and how CI/CD pipeline CDK project’s Buildspec definitions translate into actual executable commands. The usefulness of this entire workshop may hinge on whether you take time to review Build actions’ output and connect this insight with what you learn from examining CI/CD project code.