From e52e5f10d3745f60c123ac60df73948f3e9e96ad Mon Sep 17 00:00:00 2001 From: alvarofloresPM Date: Mon, 20 Jan 2025 15:17:29 -0400 Subject: [PATCH 01/10] Add debug message to display CONTAINER_ID value --- .github/workflows/deploy-pm4.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 5f785f7..10c5585 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -300,6 +300,7 @@ jobs: docker compose build phpunit docker compose run phpunit CONTAINER_ID=$(docker ps -a | grep php-unit | awk '{print $1}') + echo "The value of CONTAINER_ID is $CONTAINER_ID" docker cp $CONTAINER_ID:/opt/processmaker/coverage.xml coverage.xml - name: Archive code coverage From 04b962ced905b145d80c0eced6355e769eb3980c Mon Sep 17 00:00:00 2001 From: alvarofloresPM Date: Mon, 20 Jan 2025 15:18:46 -0400 Subject: [PATCH 02/10] Add debug message to display CONTAINER_ID value --- .github/workflows/deploy-pm4.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 10c5585..da8257a 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -300,6 +300,7 @@ jobs: docker compose build phpunit docker compose run phpunit CONTAINER_ID=$(docker ps -a | grep php-unit | awk '{print $1}') + docker ps -a echo "The value of CONTAINER_ID is $CONTAINER_ID" docker cp $CONTAINER_ID:/opt/processmaker/coverage.xml coverage.xml From d57159faee564d3172d9a9dcdc676d3606278a2f Mon Sep 17 00:00:00 2001 From: Daniel Ryan Date: Tue, 21 Jan 2025 09:46:38 -1000 Subject: [PATCH 03/10] remove image build for debugging --- .github/workflows/deploy-pm4.yml | 97 ++++++++++++++++---------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index da8257a..2f5df3e 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -33,56 +33,56 @@ concurrency: cancel-in-progress: true jobs: imageEKS: - name: build-docker-image-EKS - if: github.event.action != 'closed' - runs-on: ${{ vars.RUNNER }} - steps: + #name: build-docker-image-EKS + #if: github.event.action != 'closed' + #runs-on: ${{ vars.RUNNER }} + #steps: - - name: Checkout - uses: actions/checkout@v4 - with: - repository: processmaker/.github + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # repository: processmaker/.github - - name: Common - uses: ./.github/actions/common - with: - token: ${{ secrets.GIT_TOKEN }} + # - name: Common + # uses: ./.github/actions/common + # with: + # token: ${{ secrets.GIT_TOKEN }} - - name: Set image name - run: | - RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} - echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV - - name: Generate image EKS - run: | - cd pm4-k8s-distribution/images - export CI_RELEASE_BRANCH=$RELEASE_BRANCH - branch=$(echo "${{ env.CI_PACKAGE_BRANCH }}" | sed 's/refs-heads-//g') tag=${{env.IMAGE_TAG}} bash build.k8s-cicd.sh - echo "VERSION=${{ env.IMAGE_TAG }}" >> $GITHUB_ENV - - name: List Images - run: | - docker images - # - name: Run Trivy vulnerability scanner - # uses: aquasecurity/trivy-action@master - # with: - # image-ref: processmaker/enterprise:${{ env.VERSION }} - # format: 'table' - # exit-code: '0' - # ignore-unfixed: false - # vuln-type: 'os,library' - # scanners: 'vuln,secret' - # severity: 'MEDIUM,HIGH,CRITICAL' - # env: - # TRIVY_TIMEOUT: 30m - - name: Login to Harbor - uses: docker/login-action@v2 - with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - 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}} + # - name: Set image name + # run: | + # RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} + # echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV + # - name: Generate image EKS + # run: | + # cd pm4-k8s-distribution/images + # export CI_RELEASE_BRANCH=$RELEASE_BRANCH + # branch=$(echo "${{ env.CI_PACKAGE_BRANCH }}" | sed 's/refs-heads-//g') tag=${{env.IMAGE_TAG}} bash build.k8s-cicd.sh + # echo "VERSION=${{ env.IMAGE_TAG }}" >> $GITHUB_ENV + # - name: List Images + # run: | + # docker images + # # - name: Run Trivy vulnerability scanner + # # uses: aquasecurity/trivy-action@master + # # with: + # # image-ref: processmaker/enterprise:${{ env.VERSION }} + # # format: 'table' + # # exit-code: '0' + # # ignore-unfixed: false + # # vuln-type: 'os,library' + # # scanners: 'vuln,secret' + # # severity: 'MEDIUM,HIGH,CRITICAL' + # # env: + # # TRIVY_TIMEOUT: 30m + # - name: Login to Harbor + # uses: docker/login-action@v2 + # with: + # registry: ${{ secrets.REGISTRY_HOST }} + # username: ${{ secrets.REGISTRY_USERNAME }} + # password: ${{ secrets.REGISTRY_PASSWORD }} + # - 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}} deployEKS: name: deploy-EKS @@ -261,7 +261,7 @@ jobs: runPhpUnit: name: run-phpunit if: github.event.action != 'closed' - needs: imageEKS + #needs: imageEKS runs-on: ${{ vars.RUNNER }} steps: - name: Checkout @@ -300,6 +300,7 @@ jobs: docker compose build phpunit docker compose run phpunit CONTAINER_ID=$(docker ps -a | grep php-unit | awk '{print $1}') + docker container ls docker ps -a echo "The value of CONTAINER_ID is $CONTAINER_ID" docker cp $CONTAINER_ID:/opt/processmaker/coverage.xml coverage.xml From 2ca0d5f9fc952109234c3b1667bf6521e277223e Mon Sep 17 00:00:00 2001 From: Daniel Ryan Date: Tue, 21 Jan 2025 09:49:22 -1000 Subject: [PATCH 04/10] comment imageEKS job --- .github/workflows/deploy-pm4.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 2f5df3e..7f13831 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -32,7 +32,7 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - imageEKS: + #imageEKS: #name: build-docker-image-EKS #if: github.event.action != 'closed' #runs-on: ${{ vars.RUNNER }} From b15cd5c7b0e227ab300514d35eb3c42da5e0048d Mon Sep 17 00:00:00 2001 From: Daniel Ryan Date: Tue, 21 Jan 2025 09:55:48 -1000 Subject: [PATCH 05/10] comment out needs: in jobs --- .github/workflows/deploy-pm4.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 7f13831..40df80c 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -87,7 +87,7 @@ jobs: deployEKS: name: deploy-EKS if: contains(github.event.pull_request.body, 'ci:deploy') - needs: imageEKS + #needs: imageEKS runs-on: ${{ vars.RUNNER }} steps: - name: Checkout .github repo @@ -154,7 +154,7 @@ jobs: runAPITest: name: Run API Tests - needs: [deployEKS] + #needs: [deployEKS] if: contains(github.event.pull_request.body, 'ci:api-test') runs-on: ${{ vars.RUNNER }} steps: From 23741c4162dba38c775e0617b500c67201bc7446 Mon Sep 17 00:00:00 2001 From: Daniel Ryan Date: Tue, 21 Jan 2025 10:21:36 -1000 Subject: [PATCH 06/10] skip run phpunit --- .github/workflows/deploy-pm4.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 40df80c..c6ab7af 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -298,10 +298,10 @@ jobs: docker pull $IMAGE docker compose down -v docker compose build phpunit - docker compose run phpunit - CONTAINER_ID=$(docker ps -a | grep php-unit | awk '{print $1}') - docker container ls - docker ps -a + #docker compose run phpunit + CONTAINER_ID=$(sudo docker ps -a | grep php-unit | awk '{print $1}') + sudo docker container ls + sudo docker ps -a echo "The value of CONTAINER_ID is $CONTAINER_ID" docker cp $CONTAINER_ID:/opt/processmaker/coverage.xml coverage.xml From 33246425b305dc4cb4920e573f5afa8ccb56c396 Mon Sep 17 00:00:00 2001 From: Daniel Ryan Date: Tue, 21 Jan 2025 10:23:27 -1000 Subject: [PATCH 07/10] use sudo when running docker commands --- .github/workflows/deploy-pm4.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index c6ab7af..406fff6 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -298,12 +298,12 @@ jobs: docker pull $IMAGE docker compose down -v docker compose build phpunit - #docker compose run phpunit + docker compose run phpunit CONTAINER_ID=$(sudo docker ps -a | grep php-unit | awk '{print $1}') sudo docker container ls sudo docker ps -a echo "The value of CONTAINER_ID is $CONTAINER_ID" - docker cp $CONTAINER_ID:/opt/processmaker/coverage.xml coverage.xml + sudo docker cp $CONTAINER_ID:/opt/processmaker/coverage.xml coverage.xml - name: Archive code coverage uses: actions/upload-artifact@v4 From c713d017f26369c401edcb44be76fd190760f7c1 Mon Sep 17 00:00:00 2001 From: Daniel Ryan Date: Tue, 21 Jan 2025 10:50:28 -1000 Subject: [PATCH 08/10] adjust grep to phpunit --- .github/workflows/deploy-pm4.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 406fff6..8f324c1 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -299,7 +299,7 @@ jobs: docker compose down -v docker compose build phpunit docker compose run phpunit - CONTAINER_ID=$(sudo docker ps -a | grep php-unit | awk '{print $1}') + CONTAINER_ID=$(sudo docker ps -a | grep phpunit | awk '{print $1}') sudo docker container ls sudo docker ps -a echo "The value of CONTAINER_ID is $CONTAINER_ID" From fc3df8f35cf1da95826e137443131cb6bc926f75 Mon Sep 17 00:00:00 2001 From: Daniel Ryan Date: Tue, 21 Jan 2025 11:13:38 -1000 Subject: [PATCH 09/10] add image build and needs: --- .github/workflows/deploy-pm4.yml | 102 +++++++++++++++---------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 8f324c1..729b2e7 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -32,62 +32,62 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - #imageEKS: - #name: build-docker-image-EKS - #if: github.event.action != 'closed' - #runs-on: ${{ vars.RUNNER }} - #steps: + imageEKS: + name: build-docker-image-EKS + if: github.event.action != 'closed' + runs-on: ${{ vars.RUNNER }} + steps: - # - name: Checkout - # uses: actions/checkout@v4 - # with: - # repository: processmaker/.github + - name: Checkout + uses: actions/checkout@v4 + with: + repository: processmaker/.github - # - name: Common - # uses: ./.github/actions/common - # with: - # token: ${{ secrets.GIT_TOKEN }} + - name: Common + uses: ./.github/actions/common + with: + token: ${{ secrets.GIT_TOKEN }} - # - name: Set image name - # run: | - # RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} - # echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV - # - name: Generate image EKS - # run: | - # cd pm4-k8s-distribution/images - # export CI_RELEASE_BRANCH=$RELEASE_BRANCH - # branch=$(echo "${{ env.CI_PACKAGE_BRANCH }}" | sed 's/refs-heads-//g') tag=${{env.IMAGE_TAG}} bash build.k8s-cicd.sh - # echo "VERSION=${{ env.IMAGE_TAG }}" >> $GITHUB_ENV - # - name: List Images - # run: | - # docker images - # # - name: Run Trivy vulnerability scanner - # # uses: aquasecurity/trivy-action@master - # # with: - # # image-ref: processmaker/enterprise:${{ env.VERSION }} - # # format: 'table' - # # exit-code: '0' - # # ignore-unfixed: false - # # vuln-type: 'os,library' - # # scanners: 'vuln,secret' - # # severity: 'MEDIUM,HIGH,CRITICAL' - # # env: - # # TRIVY_TIMEOUT: 30m - # - name: Login to Harbor - # uses: docker/login-action@v2 - # with: - # registry: ${{ secrets.REGISTRY_HOST }} - # username: ${{ secrets.REGISTRY_USERNAME }} - # password: ${{ secrets.REGISTRY_PASSWORD }} - # - 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}} + - name: Set image name + run: | + RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} + echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV + - name: Generate image EKS + run: | + cd pm4-k8s-distribution/images + export CI_RELEASE_BRANCH=$RELEASE_BRANCH + branch=$(echo "${{ env.CI_PACKAGE_BRANCH }}" | sed 's/refs-heads-//g') tag=${{env.IMAGE_TAG}} bash build.k8s-cicd.sh + echo "VERSION=${{ env.IMAGE_TAG }}" >> $GITHUB_ENV + - name: List Images + run: | + docker images + # - name: Run Trivy vulnerability scanner + # uses: aquasecurity/trivy-action@master + # with: + # image-ref: processmaker/enterprise:${{ env.VERSION }} + # format: 'table' + # exit-code: '0' + # ignore-unfixed: false + # vuln-type: 'os,library' + # scanners: 'vuln,secret' + # severity: 'MEDIUM,HIGH,CRITICAL' + # env: + # TRIVY_TIMEOUT: 30m + - name: Login to Harbor + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REGISTRY_HOST }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - 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}} deployEKS: name: deploy-EKS if: contains(github.event.pull_request.body, 'ci:deploy') - #needs: imageEKS + needs: imageEKS runs-on: ${{ vars.RUNNER }} steps: - name: Checkout .github repo @@ -154,7 +154,7 @@ jobs: runAPITest: name: Run API Tests - #needs: [deployEKS] + needs: [deployEKS] if: contains(github.event.pull_request.body, 'ci:api-test') runs-on: ${{ vars.RUNNER }} steps: @@ -261,7 +261,7 @@ jobs: runPhpUnit: name: run-phpunit if: github.event.action != 'closed' - #needs: imageEKS + needs: imageEKS runs-on: ${{ vars.RUNNER }} steps: - name: Checkout From 1e06e03be5081e3757f8a602a886013ff50685b9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 21 Jan 2025 11:26:46 -1000 Subject: [PATCH 10/10] Update deploy-pm4.yml cleanup debug commands --- .github/workflows/deploy-pm4.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 729b2e7..656a4b4 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -300,9 +300,7 @@ jobs: docker compose build phpunit docker compose run phpunit CONTAINER_ID=$(sudo docker ps -a | grep phpunit | awk '{print $1}') - sudo docker container ls - sudo docker ps -a - echo "The value of CONTAINER_ID is $CONTAINER_ID" + echo "Copying coverage report from PHP Unit Container: $CONTAINER_ID" sudo docker cp $CONTAINER_ID:/opt/processmaker/coverage.xml coverage.xml - name: Archive code coverage