This section outlines the continuous integration (CI) strategy implemented at SafeBank. π
main
main
build-dev
, build-uat
, build-prod
: These jobs automate the process of building the frontend application for different environmentsAspect | build-dev |
build-uat |
build-prod |
---|---|---|---|
Environment File | .env.development |
.env.uat |
.env.prod |
Build Output | dist-dev/ |
dist-uat/ |
dist-prod/ |
Purpose | Local development/testing | Stakeholder/user testing | Deployment for end-users |
Code Checkout: actions/checkout@v4
Node.js Setup: actions/setup-node@v4
Login to Azure: azure/login@v2
Get Registry Credentials from vault: Azure/cli@v2.1.0
appInsightsKey
) from Azure Key Vault using Azure CLInpm
Install Dependencies and Build
Upload artifact for deployment job: actions/upload-artifact@v4
build-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version: '18.x'
cache: 'npm'
- name: "Log in to azure"
uses: azure/login@v2
with:
creds: $
- name: "Get registry credentials from vault"
uses: Azure/cli@v2.1.0
with:
inlineScript: |
echo "VUE_APP_APPINSIGHTS_INSTRUMENTATIONKEY=$(az keyvault secret show --name appInsightsKey --vault-name $ --query value -o tsv)" >> $GITHUB_ENV
- name: npm install, build, and test
env:
VUE_APP_APPINSIGHTS_INSTRUMENTATIONKEY: $
run: |
npm install
npm run build -- --mode development --dest dist-dev ## this command will build the vue.js app using .env.development variables into the dest-div/ folder
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: node-app-dev
path: dist-dev/
main
build-dev
, build-uat
, build-prod
: These jobs automate the process of building the backend application for different environmentsAspect | build-dev | build-uat | build-prod |
---|---|---|---|
Key Vault Name | env.KEY_VAULT_NAME_DEV |
env.KEY_VAULT_NAME_UAT |
env.KEY_VAULT_NAME_PROD |
App Insights Key | Retrieved from dev Key Vault | Retrieved from UAT Key Vault | Retrieved from prod Key Vault |
Docker Context Name | docker-context-dev |
docker-context-uat |
docker-context-prod |
Checkout: actions/checkout@v4
Set up Python: actions/setup-python@v5
Login to Azure: azure/login@v2
Get Registry Credentials from vault: Azure/cli@v2.1.0
appInsightsKey
) from Azure Key Vault using Azure CLIpip
Install dependencies
Use flake8 for Linting
Test using Python functional and unit tests
Save Docker context as artifact: actions/upload-artifact@v4
build-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: "Log in to azure"
uses: azure/login@v2
with:
creds: $
- name: "Get app insights key from vault"
uses: Azure/cli@v2.1.0
with:
inlineScript: |
echo "VUE_APP_APPINSIGHTS_INSTRUMENTATIONKEY=$(az keyvault secret show --name appInsightsKey --vault-name $ --query value -o tsv)" >> $GITHUB_ENV
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8 pytest
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m pytest --cov=iebank_api -v
- name: Save Docker context as artifact
uses: actions/upload-artifact@v4
with:
name: docker-context-dev
path: .
if-no-files-found: error
π Continuous Deployment Strategy for IE Bank Corp π
Our Continuous Deployment (CD) strategy ensures deployment for both the frontend - the static website and backend - the Dockerized API of the IE Bank system. This document also covers both the inner loop and outer loop workflows and the release strategy. π οΈ
For local development and debugging. We can run and debug the app directly in VSCode using Docker containers for a consistent and isolated environment. Hereβs how itβs done:
The outer loop automates the build and deployment process for both the frontend and backend, ensuring fast, reliable, and repeatable releases.
Trigger the Workflow:
Set Up Node.js Environment:
Log In to Azure:
Retrieve Secrets from Azure Key Vault:
Install Dependencies and Build Static Files:
Upload Build Artifacts:
Deploy to Azure Static Web Apps:
Trigger the Workflow:
Check Out the Repository:
Log In to our Azure Container Registry:
Build Docker Image:
Push Docker Image to ACR:
Deploy to Azure App Services: