Implements Workflow Dispatcher for Deployment Refresh
This commit is contained in:
48
.github/workflows/refresh-deployment.yml
vendored
Normal file
48
.github/workflows/refresh-deployment.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: workflow_02
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["build"]
|
||||||
|
branches: [main]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
repository_dispatch:
|
||||||
|
types: [refresh-deployments]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
refresh-deployments:
|
||||||
|
name: Refresh deployments
|
||||||
|
environment: prod
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Executing Remote Commands - Refresh All Deployments
|
||||||
|
env:
|
||||||
|
deployments: ${{ github.event.client_payload.deployments }}
|
||||||
|
if: ${{ env.deployments == '' }}
|
||||||
|
uses: appleboy/ssh-action@master
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SSH_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USER }}
|
||||||
|
port: ${{ secrets.SSH_PORT }}
|
||||||
|
key: ${{ secrets.SSH_KEY }}
|
||||||
|
script: |
|
||||||
|
[[ -d infra-hideyoshi.com ]] && \
|
||||||
|
./infra-hideyoshi.com/refresh.sh
|
||||||
|
|
||||||
|
- name: Executing Remote Commands - Refresh Specific Deployments
|
||||||
|
env:
|
||||||
|
deployments: ${{ github.event.client_payload.deployments }}
|
||||||
|
if: ${{ env.deployments != '' }}
|
||||||
|
uses: appleboy/ssh-action@master
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SSH_HOST }}
|
||||||
|
username: ${{ secrets.SSH_USER }}
|
||||||
|
port: ${{ secrets.SSH_PORT }}
|
||||||
|
key: ${{ secrets.SSH_KEY }}
|
||||||
|
script: |
|
||||||
|
[[ -d infra-hideyoshi.com ]] && \
|
||||||
|
./infra-hideyoshi.com/refresh.sh ${{ env.deployments }}
|
||||||
@@ -109,10 +109,11 @@ function main() {
|
|||||||
kubectl apply -f \
|
kubectl apply -f \
|
||||||
./deployment/cert-manager/cert-manager-certificate.yaml
|
./deployment/cert-manager/cert-manager-certificate.yaml
|
||||||
|
|
||||||
fi
|
if [[ $1 == "--staging" || $1 == "-s" ]]; then
|
||||||
|
bash ./refresh.sh
|
||||||
|
fi
|
||||||
|
|
||||||
# Refreshes all pods in case of a new image
|
fi
|
||||||
bash ./refresh.sh
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
16
refresh.sh
16
refresh.sh
@@ -4,12 +4,16 @@ NAMESPACES=(
|
|||||||
portfolio
|
portfolio
|
||||||
)
|
)
|
||||||
|
|
||||||
DEPLOYMENTS=(
|
if [ $# -eq 0 ]; then
|
||||||
"frontend-deployment"
|
DEPLOYMENTS=(
|
||||||
"backend-deployment"
|
"frontend-deployment"
|
||||||
"storage-deployment"
|
"backend-deployment"
|
||||||
"storage-processor-deployment"
|
"storage-deployment"
|
||||||
)
|
"storage-processor-deployment"
|
||||||
|
)
|
||||||
|
else
|
||||||
|
DEPLOYMENTS=("$@")
|
||||||
|
fi
|
||||||
|
|
||||||
for i in "${NAMESPACES[@]}"; do
|
for i in "${NAMESPACES[@]}"; do
|
||||||
for x in "${DEPLOYMENTS[@]}"; do
|
for x in "${DEPLOYMENTS[@]}"; do
|
||||||
|
|||||||
Reference in New Issue
Block a user