CICD Pipelines For Different Deployment Stratgeies
CICD Pipelines For Different Deployment Stratgeies
1. Rolling Deployment
Description
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
2. Blue-Green Deployment
Description
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
3. Canary Deployment
Description
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Deploy Canary version
run: kubectl apply -f manifests/canary-deployment.yaml
Rolling Deployment
• Build Job: Checks out the code, sets up Node.js, installs dependencies, and runs
tests.
• Deploy Job: Needs the build job to complete, checks out the code again, and
deploys the new version using a rolling update strategy.
Diagram:
+----------------------+
| Build Job |
| - Checkout code |
| - Setup Node.js |
| - Install dependencies|
| - Run tests |
+----------------------+
|
v
+----------------------+
| Deploy Job |
| - Checkout code |
| - Deploy to K8s |
| - Rolling strategy |
+----------------------+
Blue-Green Deployment
Diagram:
+----------------------+
| Build Job |
| - Checkout code |
| - Setup Node.js |
| - Install dependencies|
| - Run tests |
+----------------------+
|
v
+----------------------+
| Deploy Job |
| - Checkout code |
| - Deploy to Blue |
| - Switch traffic |
+----------------------+
Canary Deployment
Diagram:
+----------------------+
| Build Job |
| - Checkout code |
| - Setup Node.js |
| - Install dependencies|
| - Run tests |
+----------------------+
|
v
+-----------------------------+
| Deploy Job |
| - Checkout code |
| - Deploy Canary version |
| - Monitor Canary deployment |
| - Scale up Canary deployment|
| - Promote Canary to stable |
+-----------------------------+
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
Explanation
Diagram:
+----------------------+
| Build Job |
| - Checkout code |
| - Setup Node.js |
| - Install dependencies|
| - Run tests |
+----------------------+
|
v
+-----------------------------+
| Deploy Job |
| - Checkout code |
| - Deploy A version |
| - Deploy B version |
| - Configure traffic split |
+-----------------------------+
5. Shadow Deployment
Description
Shadow deployment involves deploying the new version of the application alongside
the old version, but only the old version handles live traffic. The new version
processes the same requests without serving the responses to test its performance.
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
Diagram:
+----------------------+
| Build Job |
| - Checkout code |
| - Setup Node.js |
| - Install dependencies|
| - Run tests |
+----------------------+
|
v
+-----------------------------+
| Deploy Job |
| - Checkout code |
| - Deploy stable version |
| - Deploy shadow version |
| - Mirror traffic to shadow |
+-----------------------------+
6. Recreate Deployment
Description
A recreate deployment involves taking down all instances of the previous version of
the application and then deploying the new version.
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
Explanation
Diagram:
+----------------------+
| Build Job |
| - Checkout code |
| - Setup Node.js |
| - Install dependencies|
| - Run tests |
+----------------------+
|
v
+-----------------------------+
| Deploy Job |
| - Checkout code |
| - Scale down current version|
| - Deploy new version |
+-----------------------------+
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
Explanation
Diagram:
+----------------------+
| Build Job |
| - Checkout code |
| - Setup Node.js |
| - Install dependencies|
| - Run tests |
+----------------------+
|
v
+-----------------------------+
| Deploy Job |
| - Checkout code |
| - Set up Helm |
| - Deploy with Helm |
+-----------------------------+
8. Serverless Deployment
Description
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
Diagram:
+----------------------+
| Build Job |
| - Checkout code |
| - Setup Node.js |
| - Install dependencies|
| - Run tests |
+----------------------+
|
v
+-----------------------------+
| Deploy Job |
| - Checkout code |
| - Set up Serverless |
| - Deploy to AWS Lambda |
+-----------------------------+