Skip to content

FIX delete instance #6056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 12 additions & 19 deletions .github/workflows/deploy-pm4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,7 @@ jobs:
- name: Push Enterprise Image to Harbor
run: |
docker tag processmaker/enterprise:${{env.IMAGE_TAG}} ${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}
docker push ${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}
prepareDB:
needs: imageEKS
runs-on: self-hosted
steps:
- name: Clone private repository
run: |
git clone --depth 1 -b eng "https://$GITHUB_TOKEN@github.com/ProcessMaker/argocd.git" argocd
- name: CreateDB
run: |
cd argocd
deploy=$(echo -n ${{env.IMAGE_TAG}} | md5sum | head -c 10)
sed -i "s/{{instance}}/ci-$deploy/" template-db.yaml
kubectl get namespace ci-processmaker-ns-pm4
namespace=$(kubectl get namespace $deploy-ns-pm4|grep $deploy|awk '{print $1}')
kubectl apply -f template-db.yaml
docker push ${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}
deployEKS:
name: build-deploy-EKS
if: contains(github.event.pull_request.body, 'ci:deploy')
Expand Down Expand Up @@ -126,11 +111,15 @@ jobs:
echo "NAMESPACE : ci-$deploy-ns-pm4"
helm repo add processmaker ${{ secrets.HELM_REPO }} --username ${{ secrets.HELM_USERNAME }} --password ${{ secrets.HELM_PASSWORD }} && helm repo update
if ! kubectl get namespace/ci-$deploy-ns-pm4 ; then
echo "Creating DB"
sed -i "s/{{instance}}/ci-$deploy/" template-db.yaml
kubectl apply -f template-db.yaml
echo "Creating Deploy :: $deploy"
sed -i "s/{{instance}}/ci-$deploy/" template-instance.yaml
sed -i "s/{{image}}/${{env.IMAGE_TAG}}/" template-instance.yaml
cat template-instance.yaml
helm install --timeout 40m -f template-instance.yaml ci-$deploy processmaker/enterprise
#Add cert
sed -i "s/{{instance}}/ci-$deploy/" template-cert.yaml
sed -i "s/{{tls-crt}}/${{ secrets.TLS_CRT }}/" template-cert.yaml
sed -i "s/{{tls-key}}/${{ secrets.TLS_KEY }}/" template-cert.yaml
Expand All @@ -157,9 +146,13 @@ jobs:
- name: Delete instance EKS
run: |
deploy=$(echo -n $IMAGE_TAG | md5sum | head -c 10)
echo "Deleting Instace :: ci-$deploy"
helm delete ci-$deploy
kubectl delete namespace ci-$deploy-ns-pm4
if kubectl get namespace/ci-$deploy-ns-pm4 ; then
echo "Deleting Instace :: ci-$deploy"
helm delete ci-$deploy
kubectl delete namespace ci-$deploy-ns-pm4
else
echo "The pull request does not have an instance on K8s [https://ci-$deploy.engk8s.processmaker.net] not found!!"
fi
runPhpUnit:
name: run-phpunit
if: github.event.action != 'closed'
Expand Down