Why implement CI/CD?
Continuous integration (CI) and continuious delivery (CD) enable sustainable software and fast, reliable deployments. CI starts with automated builds and tests, typically unit tests. This is however just the first step. Testing independent units and monoliths is relatively straightforward.
To text complex systems, we'll also leverage continuous delivery, which helps make sure the code is always deployable. This lets us test the components both individually and as a whole.
Such a CI/CD Workflow can have many steps, for example:
- Lint Code
- Run Unit Tests
- Create Build / Compile Code
- Run Code Coverage Analysis
- Archive Build
- Autogenerate Documentation
- Deploy to Dev/Stage/Prod
- Run E2E Tests with a Browser
- Promote Artifact
We'll cover many of these steps in our, which consists of two components:
1. Install PCF Dev
pcf dev start
Note: Cloud Foundry make require up to 10 minutes to start.
2. Clone this Repository
git clone https://github.com/AllianzDeutschlandAG/cidemo.git
3. Initialize Submodules
The Angular frontend Node backend are included as submodules. You will have to fast-forward those repositories so:
git submodule update --init
4. Configure Environment
For our components to communicate with each other properly we set our local IP address to
LOCAL_IP environment variable. In terminal, run:
5. Start Stack
To build all container images and start in one step, run:
docker-compose up --build
AZD Cloud Stack
Once the stack is up and running you can explore around:
|Angular App (Frontend)||http://localhost/||-||-|
|Node App (Backend)||http://localhost:3000/||-||-|
Enterprise means do-it-yourself (DIY)
There are great industry tools like Travis CI, Codeship and CircleCI, which help companies hit the ground running with continuous integration and delivery. However, as an insurer and financial institution, we cannot use tools due to laws regarding auditing and privacy. So we keep our entire CI/CD workflows in house in our own cloud stack.
For this demo, we will focus on one slice of the stack which leverages PaaS for fast one line deploys, e.g.
cf push. Much of the stack uses open source software and is included in the
Our automation server, which controls the workflows aka pipelines.
Provides Chrome and Firefox browsers for end-to-end testing. Local browser testing results in the "works on my machine" problem. Additionally having a hub means you can simultaneously test many browser versions.
To make more than one browser available, scale up using Docker like so:
docker-compose scale chrome=3
Artifactory is a repository manager used for:
- archive builds artifacts including source code for auditing purposes
- cache other repositories, e.g. npmjs.com
- host private libraries
A repository manager is crucial not just for auditing, but also for complex continuous delivery workflows. If a build passes the dev stage, you don't want to build it again. So at the next stage you will be grabbing it from Artifactory.
For this demo, we will be using the Artifactory OSS open sourced version with limited functionality - but free.
Pivotal Cloud Foundry
The cloud application platform where we will deploy our applications. For the demo, we will be running a local copy of PCF Dev. Unlike the rest of the toolchain, you need to install pcf dev separately.
Once installed login at https://apps.local.pcfdev.io/