Skip to content

Commit

Permalink
Merge pull request #1636 from UK-Export-Finance/fix/feature-deployment
Browse files Browse the repository at this point in the history
fix(feature-deployment): Feature environment deployment
  • Loading branch information
abhi-markan authored Jan 4, 2024
2 parents 13aad47 + 75505e2 commit 879a8a0
Show file tree
Hide file tree
Showing 12 changed files with 1,854 additions and 1,849 deletions.
73 changes: 40 additions & 33 deletions .github/workflows/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,58 @@ read selection
if [ -n "$selection" ]; then

############### INFRASTRUCTURE ###############
if [ "$selection" = "0" ]
then
destination=infrastructure
branch=main
if [ "$selection" = "0" ]; then
destination=infrastructure
branch=main
############### DEPLOYMENT ###############
elif [ "$selection" = "1" ]
then
read destination
branch=main
elif [ "$selection" = "1" ]; then
read destination
############### DEVELOPMENT ###############
if [ "$destination" = "dev" ]; then
branch=main
############### FEATURE ###############
elif [ "$destination" = "feature" ]; then
branch=main-application-no-pdf
############### STAGING ###############
elif [ "$destination" = "staging" ]; then
branch=dev
############### PRODUCTION ###############
elif [ "$destination" = "production" ]; then
branch=staging
fi
############### ACR PURGE ###############
elif [ "$selection" = "2" ]
then
destination=""
branch=""
az acr run --cmd "acr purge --filter 'get-a-quote:.*' --ago 15d" --registry "${ACR}" /dev/null
elif [ "$selection" = "2" ]; then
destination=""
branch=""
az acr run --cmd "acr purge --filter 'get-a-quote:.*' --ago 15d" --registry "${ACR}" /dev/null
############### ACR PURGE ###############
fi

if [ -n "$destination" -a -n "$branch" ]
then
# Display latest push commit
git checkout "${branch}"
git pull
printf "\n\n${NC}⬆️ ${branch} branch latest push : ${NC}"
printf "${GREEN}"
git log -n 1 --pretty | sort | grep commit
printf "${NC}\n\n"
if [ -n "$destination" -a -n "$branch" ]; then
# Display latest push commit
git checkout "${branch}"
git pull
printf "\n\n${NC}⬆️ ${branch} branch latest push : ${NC}"
printf "${GREEN}"
git log -n 1 --pretty | sort | grep commit
printf "${NC}\n\n"

# Deploy
git checkout -b "${destination}"
git push -f --set-upstream origin "${destination}"
# Deploy
git checkout -b "${destination}"
git push -f --set-upstream origin "${destination}"

# Clean up
git checkout "${branch}"
git branch -d "${destination}"
printf "\n\n✅ ${destination} deployment initiated, switched to ${branch}.\n\n"
# Clean up
git checkout "${branch}"
git branch -d "${destination}"
printf "\n\n✅ ${destination} deployment initiated, switched to ${branch}.\n\n"
fi

else
printf "${RED} ❌ Invalid input, terminating.${NC}\n\n";
exit 0;
printf "${RED} ❌ Invalid input, terminating.${NC}\n\n"
exit 0
fi

#######################################
# UKEF deployment shell script v0.0.7
# 31/05/2023
# Abhi Markan
# 03/01/2024
#######################################
1 change: 1 addition & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
push:
branches:
- dev
- feature
- staging
- production

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
runs-on: [self-hosted, EXIP, infrastructure]
steps:
- name: Pre-production 💫
if: contains('["dev", "staging"]', env.TARGET)
if: contains('["dev", "feature", "staging"]', env.TARGET)
run: echo "TYPE=Preproduction" >> $GITHUB_ENV

- name: Production 💫
Expand Down Expand Up @@ -321,7 +321,7 @@ jobs:
runs-on: [self-hosted, EXIP, infrastructure]
steps:
- name: Pre-production 💫
if: contains('["dev", "staging"]', env.TARGET)
if: contains('["dev", "feature", "staging"]', env.TARGET)
run: echo "TYPE=Preproduction" >> $GITHUB_ENV

- name: Production 💫
Expand Down Expand Up @@ -502,7 +502,7 @@ jobs:
--policy-name waf${{ env.PRODUCT }}${{ env.TARGET }}${{ vars.VERSION }}
- name: VPN 🧱
if: contains('["dev", "staging"]', env.TARGET)
if: contains('["dev", "feature", "staging"]', env.TARGET)
uses: Azure/cli@v1.0.8
with:
inlineScript: |
Expand Down Expand Up @@ -532,7 +532,7 @@ jobs:
runs-on: [self-hosted, EXIP, infrastructure]
steps:
- name: Pre-production 💫
if: contains('["dev", "staging"]', env.TARGET)
if: contains('["dev", "feature", "staging"]', env.TARGET)
run: echo "TYPE=Preproduction" >> $GITHUB_ENV

- name: Production 💫
Expand Down Expand Up @@ -665,7 +665,7 @@ jobs:
runs-on: [self-hosted, EXIP, infrastructure]
steps:
- name: Pre-production 💫
if: contains('["dev", "staging"]', env.TARGET)
if: contains('["dev", "feature", "staging"]', env.TARGET)
run: echo "TYPE=Preproduction" >> $GITHUB_ENV

- name: Production 💫
Expand Down Expand Up @@ -768,7 +768,7 @@ jobs:
runs-on: [self-hosted, EXIP, infrastructure]
steps:
- name: Pre-production 💫
if: contains('["dev", "staging"]', env.TARGET)
if: contains('["dev", "feature", "staging"]', env.TARGET)
run: echo "TYPE=Preproduction" >> $GITHUB_ENV

- name: Production 💫
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ run-name: Executing lint QA on ${{ github.repository }} 🚀

on:
pull_request:
branches: [main]
branches: [main, main-*]
paths:
- '.github/workflows/lint.yml'
- 'src/**'
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/sca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ run-name: Executing various SCAs on ${{ github.repository }} 🔍️

on:
pull_request:
branches:
- '*'
branches: [main, main-*]

env:
environment: 'qa'
timezone: 'Europe/London'
environment: "qa"
timezone: "Europe/London"

jobs:
# 1. Setup test infrastructure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ run-name: Executing test QA on ${{ github.repository }} 🚀

on:
pull_request:
branches: [main]
branches: [main, main-*]
paths:
- ".github/workflows/test.yml"
- "src/**"
Expand Down
Loading

0 comments on commit 879a8a0

Please sign in to comment.