From 601d2229f7378c001e26e40640b000808a0b9bb0 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 13:42:24 +0300 Subject: [PATCH 01/10] Add Workflow --- .github/workflows/auto_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index a28e0fc55..114cf9c91 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -10,6 +10,7 @@ name: Java CI with Maven on: #[push] + workflow_dispatch: schedule: - cron: '0 0 * * *' From 53076ebdaca3fcdf5f6019a8580ab2af971501bd Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 15:25:18 +0300 Subject: [PATCH 02/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index 114cf9c91..8b514877f 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -50,6 +50,7 @@ jobs: - name: Check if Conference app exists id: check-conference-app run: | + sleep 30 response=$(curl -s "${{ secrets.SERVER_URL }}/rest/v2/applications" -b cookie.txt) if [[ $(echo "$response" | jq '. | any(. == "Conference")' | grep -c true) -eq 0 ]]; then echo "::set-output name=app_exists::false" @@ -74,6 +75,7 @@ jobs: curl -X POST -H "Accept: Application/json" -H "Content-Type: application/json" ${{ secrets.SERVER_URL }}/rest/v2/users/authenticate -d '{"email":"${{ secrets.USER_NAME }}","password":"${{ secrets.PASSWORD }}"}' -c cookie.txt - name: Recreate Conference App + if: steps.check-conference-app.outputs.app_exists == 'false' run: | export WAR_FILE_NAME="ConferenceCall.war" curl -X PUT -H "Accept: Application/json" -H "Content-Type: multipart/form-data" -F "file=@./$WAR_FILE_NAME" "${{ secrets.SERVER_URL }}/rest/v2/applications/Conference" -b cookie.txt From ed2f3e7a54d92e0baeb3ad4401c0d799d7fb0644 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 15:35:07 +0300 Subject: [PATCH 03/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index 8b514877f..d3cab4c74 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -52,6 +52,7 @@ jobs: run: | sleep 30 response=$(curl -s "${{ secrets.SERVER_URL }}/rest/v2/applications" -b cookie.txt) + echo "$response" if [[ $(echo "$response" | jq '. | any(. == "Conference")' | grep -c true) -eq 0 ]]; then echo "::set-output name=app_exists::false" else @@ -62,21 +63,21 @@ jobs: with: kubeconfig: ${{ secrets.KUBE_CONFIG_DATA }} - - name: Delete pod if the conference app not exists - if: steps.check-conference-app.outputs.app_exists == 'false' - run: | - POD_NAME=$(kubectl get pods -l app=ant-media-origin -n antmedia -o jsonpath='{.items[0].metadata.name}') - kubectl delete pod $POD_NAME -n antmedia - sleep 20 +# - name: Delete pod if the conference app not exists +# if: steps.check-conference-app.outputs.app_exists == 'false' +# run: | +# POD_NAME=$(kubectl get pods -l app=ant-media-origin -n antmedia -o jsonpath='{.items[0].metadata.name}') +# kubectl delete pod $POD_NAME -n antmedia +# sleep 20 - - name: Login to server - if: steps.check-conference-app.outputs.app_exists == 'false' - run: | - curl -X POST -H "Accept: Application/json" -H "Content-Type: application/json" ${{ secrets.SERVER_URL }}/rest/v2/users/authenticate -d '{"email":"${{ secrets.USER_NAME }}","password":"${{ secrets.PASSWORD }}"}' -c cookie.txt +# - name: Login to server +# if: steps.check-conference-app.outputs.app_exists == 'false' +# run: | +# curl -X POST -H "Accept: Application/json" -H "Content-Type: application/json" ${{ secrets.SERVER_URL }}/rest/v2/users/authenticate -d '{"email":"${{ secrets.USER_NAME }}","password":"${{ secrets.PASSWORD }}"}' -c cookie.txt - - name: Recreate Conference App - if: steps.check-conference-app.outputs.app_exists == 'false' - run: | - export WAR_FILE_NAME="ConferenceCall.war" - curl -X PUT -H "Accept: Application/json" -H "Content-Type: multipart/form-data" -F "file=@./$WAR_FILE_NAME" "${{ secrets.SERVER_URL }}/rest/v2/applications/Conference" -b cookie.txt +# - name: Recreate Conference App +# if: steps.check-conference-app.outputs.app_exists == 'false' +# run: | +# export WAR_FILE_NAME="ConferenceCall.war" +# curl -X PUT -H "Accept: Application/json" -H "Content-Type: multipart/form-data" -F "file=@./$WAR_FILE_NAME" "${{ secrets.SERVER_URL }}/rest/v2/applications/Conference" -b cookie.txt From 13c181ddaaad86eb1a4900e792c33ecb8bb4613e Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 15:42:08 +0300 Subject: [PATCH 04/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index d3cab4c74..48f29de67 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -50,9 +50,9 @@ jobs: - name: Check if Conference app exists id: check-conference-app run: | - sleep 30 response=$(curl -s "${{ secrets.SERVER_URL }}/rest/v2/applications" -b cookie.txt) echo "$response" + echo $response" | jq '. | any(. == "Conference")' | grep -c true) -eq 0 if [[ $(echo "$response" | jq '. | any(. == "Conference")' | grep -c true) -eq 0 ]]; then echo "::set-output name=app_exists::false" else From 7e6bdcf66a494d146f80cb6a720b546967d2e8f7 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 15:43:27 +0300 Subject: [PATCH 05/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index 48f29de67..d6f23e86f 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -52,7 +52,7 @@ jobs: run: | response=$(curl -s "${{ secrets.SERVER_URL }}/rest/v2/applications" -b cookie.txt) echo "$response" - echo $response" | jq '. | any(. == "Conference")' | grep -c true) -eq 0 + echo $response | jq '. | any(. == "Conference")' | grep -c true) -eq 0 if [[ $(echo "$response" | jq '. | any(. == "Conference")' | grep -c true) -eq 0 ]]; then echo "::set-output name=app_exists::false" else From 2aff739e4d6c9369412c1292e283e9035e0bc7b1 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 15:44:33 +0300 Subject: [PATCH 06/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index d6f23e86f..2da362515 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -52,7 +52,7 @@ jobs: run: | response=$(curl -s "${{ secrets.SERVER_URL }}/rest/v2/applications" -b cookie.txt) echo "$response" - echo $response | jq '. | any(. == "Conference")' | grep -c true) -eq 0 + echo $response | jq '. | any(. == "Conference")' | grep -c true if [[ $(echo "$response" | jq '. | any(. == "Conference")' | grep -c true) -eq 0 ]]; then echo "::set-output name=app_exists::false" else From 4be9a17503ac83efad3567fb4e9cc0617216b4e1 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 15:46:09 +0300 Subject: [PATCH 07/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index 2da362515..007a30269 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -50,6 +50,7 @@ jobs: - name: Check if Conference app exists id: check-conference-app run: | + sleep 30 response=$(curl -s "${{ secrets.SERVER_URL }}/rest/v2/applications" -b cookie.txt) echo "$response" echo $response | jq '. | any(. == "Conference")' | grep -c true From 4a016b8490e82cfc1f84759e30d713c1eff3f431 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 16:03:35 +0300 Subject: [PATCH 08/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index 007a30269..98179f52f 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -53,11 +53,10 @@ jobs: sleep 30 response=$(curl -s "${{ secrets.SERVER_URL }}/rest/v2/applications" -b cookie.txt) echo "$response" - echo $response | jq '. | any(. == "Conference")' | grep -c true - if [[ $(echo "$response" | jq '. | any(. == "Conference")' | grep -c true) -eq 0 ]]; then - echo "::set-output name=app_exists::false" - else + if [[ $response =~ "Conference" ]]; then echo "::set-output name=app_exists::true" + else + echo "::set-output name=app_exists::false" fi - name: Setup kubectl uses: azure/k8s-set-context@v1 From beabcdae871c80bed726ad749fc2885923e1fc3f Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 16:05:21 +0300 Subject: [PATCH 09/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index 98179f52f..698b60a09 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -55,6 +55,7 @@ jobs: echo "$response" if [[ $response =~ "Conference" ]]; then echo "::set-output name=app_exists::true" + echo "True" else echo "::set-output name=app_exists::false" fi From 6131d7c7c8da6cf3e7b83372a46eb7bf85bc11b9 Mon Sep 17 00:00:00 2001 From: Murat Ugur Eminoglu Date: Fri, 3 May 2024 16:08:07 +0300 Subject: [PATCH 10/10] Update auto_deploy.yml --- .github/workflows/auto_deploy.yml | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/auto_deploy.yml b/.github/workflows/auto_deploy.yml index 698b60a09..51aa50829 100644 --- a/.github/workflows/auto_deploy.yml +++ b/.github/workflows/auto_deploy.yml @@ -55,7 +55,6 @@ jobs: echo "$response" if [[ $response =~ "Conference" ]]; then echo "::set-output name=app_exists::true" - echo "True" else echo "::set-output name=app_exists::false" fi @@ -64,21 +63,21 @@ jobs: with: kubeconfig: ${{ secrets.KUBE_CONFIG_DATA }} -# - name: Delete pod if the conference app not exists -# if: steps.check-conference-app.outputs.app_exists == 'false' -# run: | -# POD_NAME=$(kubectl get pods -l app=ant-media-origin -n antmedia -o jsonpath='{.items[0].metadata.name}') -# kubectl delete pod $POD_NAME -n antmedia -# sleep 20 + - name: Delete pod if the conference app not exists + if: steps.check-conference-app.outputs.app_exists == 'false' + run: | + POD_NAME=$(kubectl get pods -l app=ant-media-origin -n antmedia -o jsonpath='{.items[0].metadata.name}') + kubectl delete pod $POD_NAME -n antmedia + sleep 20 -# - name: Login to server -# if: steps.check-conference-app.outputs.app_exists == 'false' -# run: | -# curl -X POST -H "Accept: Application/json" -H "Content-Type: application/json" ${{ secrets.SERVER_URL }}/rest/v2/users/authenticate -d '{"email":"${{ secrets.USER_NAME }}","password":"${{ secrets.PASSWORD }}"}' -c cookie.txt + - name: Login to server + if: steps.check-conference-app.outputs.app_exists == 'false' + run: | + curl -X POST -H "Accept: Application/json" -H "Content-Type: application/json" ${{ secrets.SERVER_URL }}/rest/v2/users/authenticate -d '{"email":"${{ secrets.USER_NAME }}","password":"${{ secrets.PASSWORD }}"}' -c cookie.txt -# - name: Recreate Conference App -# if: steps.check-conference-app.outputs.app_exists == 'false' -# run: | -# export WAR_FILE_NAME="ConferenceCall.war" -# curl -X PUT -H "Accept: Application/json" -H "Content-Type: multipart/form-data" -F "file=@./$WAR_FILE_NAME" "${{ secrets.SERVER_URL }}/rest/v2/applications/Conference" -b cookie.txt + - name: Recreate Conference App + if: steps.check-conference-app.outputs.app_exists == 'false' + run: | + export WAR_FILE_NAME="ConferenceCall.war" + curl -X PUT -H "Accept: Application/json" -H "Content-Type: multipart/form-data" -F "file=@./$WAR_FILE_NAME" "${{ secrets.SERVER_URL }}/rest/v2/applications/Conference" -b cookie.txt