ci: add recreate option for dps (#22091)
fixes: [248](https://github.com/appsmithorg/cloud-deployment/issues/248) https://github.com/appsmithorg/appsmith-ci/pull/14#issuecomment-1504569726 This doesnt delete the existing stacks https://github.com/appsmithorg/appsmith-ci/pull/14#issuecomment-1504842238 this deletes the stack, database in mongo and therefore creating a complete new stack
This commit is contained in:
parent
8cefcc212d
commit
9b37810c7b
|
|
@ -20,6 +20,7 @@ jobs:
|
|||
skip-tests: `${{ github.event.client_payload.slash_command.args.named.skip-tests }}`.
|
||||
env: `${{ github.event.client_payload.slash_command.args.named.env }}`.
|
||||
PR: ${{ github.event.client_payload.pull_request.number }}.
|
||||
recreate: ${{ github.event.client_payload.slash_command.args.named.recreate }}.
|
||||
|
||||
server-build:
|
||||
name: server-build
|
||||
|
|
@ -165,6 +166,15 @@ jobs:
|
|||
ref: "refs/pull/${{ github.event.client_payload.pull_request.number }}/merge"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install mongosh
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y wget gnupg
|
||||
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-mongosh
|
||||
|
||||
- name: Install relevant packages
|
||||
run: |
|
||||
which aws
|
||||
|
|
@ -185,6 +195,7 @@ jobs:
|
|||
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
PULL_REQUEST_NUMBER: ${{ github.event.client_payload.pull_request.number }}
|
||||
RECREATE: ${{ github.event.client_payload.slash_command.args.named.recreate }}
|
||||
DB_USERNAME: ${{ secrets.DB_USERNAME }}
|
||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||
DB_URL: ${{ secrets.DB_URL }}
|
||||
|
|
|
|||
|
|
@ -45,11 +45,15 @@ kubectl config set-context --current --namespace=default
|
|||
echo "Getting the pods"
|
||||
kubectl get pods
|
||||
|
||||
echo "Delete previously created namespace"
|
||||
kubectl delete ns $NAMESPACE || echo "true"
|
||||
if [[ -n "${RECREATE-}" ]]
|
||||
then
|
||||
kubectl delete ns $NAMESPACE || true
|
||||
mongosh "mongodb+srv://$DB_USERNAME:$DB_PASSWORD@$DB_URL/$DBNAME?retryWrites=true&minPoolSize=1&maxPoolSize=10&maxIdleTimeMS=900000&authSource=admin" --eval 'db.dropDatabase()'
|
||||
fi
|
||||
|
||||
echo "Use kubernetes secret to Pull Image"
|
||||
kubectl create ns $NAMESPACE
|
||||
kubectl create ns $NAMESPACE || true
|
||||
|
||||
kubectl create secret docker-registry $SECRET \
|
||||
--docker-server=https://index.docker.io/v1/ \
|
||||
--docker-username=$DOCKER_HUB_USERNAME \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user