From 02991687da8100dafcbf4416e772eb92c65d17b8 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Mon, 8 Jan 2024 14:38:07 -0800 Subject: [PATCH 001/216] Switch to k8s CICD --- .github/workflows/deploy-pm4.yml | 295 ++++++++++++------------------- 1 file changed, 111 insertions(+), 184 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 0ce642d97a..6ed37d0142 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -1,212 +1,139 @@ -name: BUILD-PM4 +name: deploy-k8s +run-name: ${{ github.actor }} send deploy EKS 🚀 on: - #push: - # branches: - # - kr-github-actions pull_request: types: [opened, reopened, synchronize, edited, closed] - schedule: - - cron: '30 2 * * *' # every day at midnight - #workflow_dispatch: - #pull_request: - # branches: - # - main + #schedule: + # - cron: '30 2 * * *' # every day at midnight workflow_dispatch: workflow_call: env: - SHA: ${{github.event.pull_request.head.sha}} - PROJECT: ${{github.event.pull_request.head.repo.name}} - CI_PR_BODY: ${{ github.event_name == 'schedule' && 'ci:deploy' || github.event.pull_request.body }} - PACKAGE_URL: ${{github.event.pull_request.head.repo.ssh_url}} - PACKAGE_BRANCH: ${{github.event.pull_request.head.ref}} - #MY_GITHUB_TOKEN: ${{ secrets.GH_STATUS_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} - #GIT_TOKEN: ${{ secrets.MY_GH_TOKEN }} - OWNER: ${{ github.event.pull_request.head.repo.owner.login }} - #Other Parameters aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ secrets.AWS_REGION }} - aws-url: ${{ secrets.AWS_URL }} - STM_TOKEN: ${{ secrets.STM_TOKEN }} - CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'develop' }} - CI_PROJECT: ${{github.event.pull_request.head.repo.name || 'processmaker' }} - CI_TEST: $CI_PROJECT - IMAGE_TAG1: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g") - GITHUB_COMMENT: ${{ secrets.GH_COMMENT }} + AWS_URL: ${{ secrets.AWS_URL }} pull_req_id: ${{github.event.pull_request.number}} - BASE: ${{ contains(github.event.pull_request.body, 'ci:php81') && 'ci-base' || 'ci-base-php82' }} - CDATA_LICENSE_DOCUSIGN: ${{ secrets.CDATA_LICENSE_DOCUSIGN }} - CDATA_LICENSE_EXCEL: ${{ secrets.CDATA_LICENSE_EXCEL }} - CDATA_LICENSE_GITHUB: ${{ secrets.CDATA_LICENSE_GITHUB }} - CDATA_LICENSE_SLACK: ${{ secrets.CDATA_LICENSE_SLACK }} + DATE: $(date -d '-1 day' '+%Y-%m-%d'|sed 's/-//g') + CURRENT_DATE: $(date '+%Y-%m-%d %H:%M:%S'|sed 's/-//g') + CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'next' }} + CI_PROJECT: ${{github.event.pull_request.head.repo.name || 'processmaker' }} + CI_PR_BODY: ${{ github.event_name == 'schedule' && 'No ci tags needed here' || github.event.pull_request.body }} + IMAGE_TAG: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g") + DEPLOY: ${{ secrets.DEPLOY }} + GH_USER: ${{ secrets.GH_USER }} + GH_EMAIL: ${{ secrets.GH_EMAIL }} + GITHUB_COMMENT: ${{ secrets.GH_COMMENT }} + DOM_EKS: ${{ secrets.DOM_EKS }} + GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} + BUILD_BASE: ${{ (contains(github.event.pull_request.body, 'ci:build-base') || github.event_name == 'schedule') && '1' || '0' }} + BASE_IMAGE: ${{ secrets.REGISTRY_HOST }}/processmaker/processmaker:base + K8S_BRANCH: develop concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - job1: - name: build-stm-image + imageEKS: + name: build-docker-image-EKS if: github.event.action != 'closed' - runs-on: ${{ vars.RUNNER }} - steps: - - name: Export Params + runs-on: ${{ vars.RUNNER }} + steps: + - name: Set image name run: | - echo "Env Check: CI_PROJECT: $CI_PROJECT CI_PACKAGE_BRANCH: $CI_PACKAGE_BRANCH CI_PR_BODY: $CI_PR_BODY BASE: $BASE" - echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV - echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - #Additional - echo "CACHEBUSTER="$(date +%s) >> $GITHUB_ENV - - name: Clone Repo STM + RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} + echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV + - name: Clone repo K8S run: | - git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ env.aws-access-key-id }} - aws-secret-access-key: ${{ env.aws-secret-access-key }} - aws-region: ${{ env.aws-region }} - - name: Login to ECR - run: | - aws ecr get-login-password | docker login --username AWS --password-stdin ${{env.aws-url}} - - name: Build and Push the base images - if: contains(github.event.pull_request.body, 'ci:build-base') || github.event_name == 'schedule' + # TODO: Change branch when pm4 k8s distribution is released + echo "IMAGE: ${{ env.IMAGE }}" + git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution + - name: Generate image EKS run: | - cd pm4-stm-docker - docker-compose build --no-cache base-php82 - docker-compose build --no-cache cache - docker push ${REPOSITORY}:ci-base-php82 - docker push ${REPOSITORY}:ci-cache - - name: Build and Push the image to ECR + cd pm4-k8s-distribution/images + branch=$CI_PACKAGE_BRANCH tag=${{env.IMAGE_TAG}} bash build.k8s-cicd.sh + echo "VERSION=${{ env.IMAGE_TAG }}" >> $GITHUB_ENV + - name: List Images run: | - cd pm4-stm-docker - docker-compose build processmaker - docker push ${IMAGE} - job2: - name: deploy-stm - if: github.event.action != 'closed' - needs: job1 - runs-on: ${{ vars.RUNNER }} - container: - image: cimg/php:7.4 - options: --user root - steps: - - name: Export Params + 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: build-deploy-EKS + if: contains(github.event.pull_request.body, 'ci:deploy') + needs: imageEKS + runs-on: self-hosted + steps: + - name: Clone private repository run: | - echo "Env Check: CI_PROJECT: $CI_PROJECT CI_PACKAGE_BRANCH: $CI_PACKAGE_BRANCH CI_PR_BODY: $CI_PR_BODY" - echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV - echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - echo "IMAGE_TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - echo "STM_TOKEN=${{env.STM_TOKEN}}" >> $GITHUB_ENV - - name: Clone Repo STM + 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 + - name: Install pm4-tools run: | - git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker - cd pm4-stm-docker - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ env.aws-access-key-id }} - aws-secret-access-key: ${{ env.aws-secret-access-key }} - aws-region: ${{ env.aws-region }} - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - name: Deploy STM - id: stm + git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution + cd pm4-k8s-distribution/images/pm4-tools + composer install --no-interaction + cd .. + - name: Deploy instance EKS run: | - mkdir -p /tmp/workspace - cd pm4-stm-docker/deploy-stm - composer install --no-dev - php run.php - if [ -f "url.txt" ]; then - INSTANCE_URL=$(cat url.txt) + cd argocd + deploy=$(echo -n ${{env.IMAGE_TAG}} | md5sum | head -c 10) + current_datetime=$(echo -n ${{env.CURRENT_DATE}} | md5sum | head -c 10) + 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 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 --version 2.1.0 + else + echo "Bouncing Instance "; + sed -i "s/{{instance}}/ci-$deploy/g" template-bounce.yaml + sed -i "s/{{current_datetime}}/$current_datetime/g" template-bounce.yaml + helm upgrade --timeout 20m ci-$deploy processmaker/enterprise --version 2.1.0 + kubectl apply -f template-bounce.yaml fi - echo "Instance URL: '${INSTANCE_URL}'" + export INSTANCE_URL=https://ci-$deploy$DOM_EKS echo "INSTANCE_URL=${INSTANCE_URL}" >> "$GITHUB_ENV" - - name: Publish the URL to the Github PR - if: success() || steps.stm.conclusion == 'success' + ../pm4-k8s-distribution/images/pm4-tools/pm wait-for-instance-ready + - name: Comment Instance run: | - cd pm4-stm-docker echo "Instance URL: '${INSTANCE_URL}'" - bash ./github_comment.sh "$PROJECT" "$pull_req_id" - job3: - name: run-phpunit - if: github.event.action != 'closed' - needs: job1 - runs-on: ${{ vars.RUNNER }} - steps: - - name: Export Params - run: | - echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV - echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - - name: Clone Repo STM - run: | - git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker - cd pm4-stm-docker - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ env.aws-access-key-id }} - aws-secret-access-key: ${{ env.aws-secret-access-key }} - aws-region: ${{ env.aws-region }} - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - - name: PHPUnits - run: | - cd pm4-stm-docker - docker pull $IMAGE - docker-compose down -v - docker-compose build phpunit - docker-compose run phpunit - #job4: - # name: run-benchmarks - # needs: job2 - # runs-on: ${{ vars.RUNNER }} - # steps: - # - name: my-step - # run: | - # echo "Fifth Step" - #job5: - # name: run-cypress - # needs: job2 - # runs-on: ${{ vars.RUNNER }} - # steps: - # - name: my-step - # run: | - # echo "fourth Step" - #job6: - # name: run-cypress-qa - # needs: job2 - # runs-on: ${{ vars.RUNNER }} - # steps: - # - name: my-step - # run: | - # echo "Sixt Step" - job7: + bash argocd/gh_comment.sh "$CI_PROJECT" "$pull_req_id" + deleteEKS: name: Delete Instance if: github.event.action == 'closed' - runs-on: ${{ vars.RUNNER }} - container: - image: cimg/php:7.4 - options: --user root - steps: - - name: Export Params - run: | - echo "REPOSITORY=${{env.aws-url}}/enterprise" >> $GITHUB_ENV - echo "TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - echo "IMAGE_TAG=${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - echo "IMAGE=${{env.aws-url}}/enterprise:${{env.IMAGE_TAG1}}" >> $GITHUB_ENV - echo "STM_TOKEN=${{env.STM_TOKEN}}" >> $GITHUB_ENV - - name: Clone Repo STM - run: | - git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker - cd pm4-stm-docker - - name: Delete Instance STM - run: | - mkdir -p /tmp/workspace - cd pm4-stm-docker/deploy-stm - composer install --no-dev - php run-delete-instance.php + runs-on: self-hosted + steps: + - 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 From 93b3d1bc9740e6b9aa4f19d1445c217daa736566 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Wed, 10 Jan 2024 17:03:55 -0800 Subject: [PATCH 002/216] Enable phpunit --- .github/workflows/deploy-pm4.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 6ed37d0142..edd290853a 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -137,3 +137,33 @@ jobs: echo "Deleting Instace :: ci-$deploy" helm delete ci-$deploy kubectl delete namespace ci-$deploy-ns-pm4 + + runPhpUnit: + name: run-phpunit + if: github.event.action != 'closed' + needs: imageEKS + runs-on: ${{ vars.RUNNER }} + steps: + - name: Export Params + run: | + echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}" >> $GITHUB_ENV + - name: Clone Repo STM + run: | + git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker + cd pm4-stm-docker + - name: Login to Harbor + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REGISTRY_HOST }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + - name: PHPUnits + run: | + cd pm4-stm-docker + docker pull $IMAGE + docker-compose down -v + docker-compose build phpunit + docker-compose run phpunit From b5aaa3f4853c88966c30e620e318d7dddf028ad6 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Wed, 10 Jan 2024 17:32:01 -0800 Subject: [PATCH 003/216] Update deploy-pm4.yml --- .github/workflows/deploy-pm4.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index edd290853a..61ac8d4a44 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -157,9 +157,6 @@ jobs: registry: ${{ secrets.REGISTRY_HOST }} username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - name: PHPUnits run: | cd pm4-stm-docker From 9ed12ba07e233fb8a7421405725c4f800b1cda95 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Thu, 11 Jan 2024 08:10:59 -0800 Subject: [PATCH 004/216] Enable cicd phpunit --- .github/workflows/deploy-pm4.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 61ac8d4a44..a48f2443cc 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -27,7 +27,7 @@ env: GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} BUILD_BASE: ${{ (contains(github.event.pull_request.body, 'ci:build-base') || github.event_name == 'schedule') && '1' || '0' }} BASE_IMAGE: ${{ secrets.REGISTRY_HOST }}/processmaker/processmaker:base - K8S_BRANCH: develop + K8S_BRANCH: cicd-enable-phpunit concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -43,7 +43,6 @@ jobs: echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV - name: Clone repo K8S run: | - # TODO: Change branch when pm4 k8s distribution is released echo "IMAGE: ${{ env.IMAGE }}" git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution - name: Generate image EKS @@ -147,10 +146,10 @@ jobs: - name: Export Params run: | echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}" >> $GITHUB_ENV - - name: Clone Repo STM + - name: Clone repo K8S run: | - git clone --depth 1 -b cicd "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-stm-docker.git" pm4-stm-docker - cd pm4-stm-docker + echo "IMAGE: ${{ env.IMAGE }}" + git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution - name: Login to Harbor uses: docker/login-action@v2 with: @@ -159,8 +158,8 @@ jobs: password: ${{ secrets.REGISTRY_PASSWORD }} - name: PHPUnits run: | - cd pm4-stm-docker - docker pull $IMAGE - docker-compose down -v - docker-compose build phpunit + cd pm4-stm-docker + docker pull $IMAGE + docker-compose down -v + docker-compose build phpunit docker-compose run phpunit From 149239af6b0918adb7e497604854475712159ba4 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Thu, 11 Jan 2024 08:33:29 -0800 Subject: [PATCH 005/216] Fix folder location --- .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 a48f2443cc..0d6b8e0633 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -158,7 +158,7 @@ jobs: password: ${{ secrets.REGISTRY_PASSWORD }} - name: PHPUnits run: | - cd pm4-stm-docker + cd pm4-k8s-distribution/images/pm4-tools docker pull $IMAGE docker-compose down -v docker-compose build phpunit From 63b0a7417de2a425c3b6a032d9c02158eeb8d268 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Thu, 11 Jan 2024 11:51:01 -0800 Subject: [PATCH 006/216] Set branch back to develop now that its merged --- .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 0d6b8e0633..120686f754 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -27,7 +27,7 @@ env: GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }} BUILD_BASE: ${{ (contains(github.event.pull_request.body, 'ci:build-base') || github.event_name == 'schedule') && '1' || '0' }} BASE_IMAGE: ${{ secrets.REGISTRY_HOST }}/processmaker/processmaker:base - K8S_BRANCH: cicd-enable-phpunit + K8S_BRANCH: develop concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true From 22beab86d9e68d8fe3f96e5bb536033fe929ee5a Mon Sep 17 00:00:00 2001 From: mavalosn Date: Mon, 15 Jan 2024 21:46:12 -0400 Subject: [PATCH 007/216] Add Second alternative --- .github/workflows/deploy-pm4.yml | 288 +++++++++++++++++-------------- 1 file changed, 159 insertions(+), 129 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 120686f754..c115d6383e 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -5,6 +5,9 @@ on: types: [opened, reopened, synchronize, edited, closed] #schedule: # - cron: '30 2 * * *' # every day at midnight + push: + branches: + - FOUR-13153 workflow_dispatch: workflow_call: env: @@ -15,7 +18,7 @@ env: pull_req_id: ${{github.event.pull_request.number}} DATE: $(date -d '-1 day' '+%Y-%m-%d'|sed 's/-//g') CURRENT_DATE: $(date '+%Y-%m-%d %H:%M:%S'|sed 's/-//g') - CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'next' }} + CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'FOUR-13151' }} CI_PROJECT: ${{github.event.pull_request.head.repo.name || 'processmaker' }} CI_PR_BODY: ${{ github.event_name == 'schedule' && 'No ci tags needed here' || github.event.pull_request.body }} IMAGE_TAG: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g") @@ -32,134 +35,161 @@ 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' + deploy: runs-on: ${{ vars.RUNNER }} + steps: - - name: Set image name - run: | - RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} - echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV - - name: Clone repo K8S - run: | - echo "IMAGE: ${{ env.IMAGE }}" - git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution - - name: Generate image EKS - run: | - cd pm4-k8s-distribution/images - branch=$CI_PACKAGE_BRANCH 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: build-deploy-EKS - if: contains(github.event.pull_request.body, 'ci:deploy') - 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 - - name: Install pm4-tools - run: | - git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution - cd pm4-k8s-distribution/images/pm4-tools - composer install --no-interaction - cd .. - - name: Deploy instance EKS - run: | - cd argocd - deploy=$(echo -n ${{env.IMAGE_TAG}} | md5sum | head -c 10) - current_datetime=$(echo -n ${{env.CURRENT_DATE}} | md5sum | head -c 10) - 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 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 --version 2.1.0 - else - echo "Bouncing Instance "; - sed -i "s/{{instance}}/ci-$deploy/g" template-bounce.yaml - sed -i "s/{{current_datetime}}/$current_datetime/g" template-bounce.yaml - helm upgrade --timeout 20m ci-$deploy processmaker/enterprise --version 2.1.0 - kubectl apply -f template-bounce.yaml - fi - export INSTANCE_URL=https://ci-$deploy$DOM_EKS - echo "INSTANCE_URL=${INSTANCE_URL}" >> "$GITHUB_ENV" - ../pm4-k8s-distribution/images/pm4-tools/pm wait-for-instance-ready - - name: Comment Instance - run: | - echo "Instance URL: '${INSTANCE_URL}'" - bash argocd/gh_comment.sh "$CI_PROJECT" "$pull_req_id" - deleteEKS: - name: Delete Instance - if: github.event.action == 'closed' - runs-on: self-hosted - steps: - - 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 + - name: Checkout code + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID1 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY1 }} + aws-region: ${{ secrets.aws-region }} + + - name: Set up kubectl + run: | + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl + sudo mv kubectl /usr/local/bin/ + - name: Authenticate with Amazon EKS + run: aws eks update-kubeconfig --region us-east-1 --name next-qa-cluster + - name: Deploy to Amazon EKS + run: kubectl get nodes + #imageEKS: + # name: build-docker-image-EKS + # if: github.event.action != 'closed' + # runs-on: ${{ vars.RUNNER }} + # steps: + # - name: Set image name + # run: | + # RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} + # echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV + # - name: Clone repo K8S + # run: | + # echo "IMAGE: ${{ env.IMAGE }}" + # git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution + # - name: Generate image EKS + # run: | + # cd pm4-k8s-distribution/images + # branch=$CI_PACKAGE_BRANCH 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: build-deploy-EKS + # #if: contains(github.event.pull_request.body, 'ci:deploy') + # #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 + # - name: Install pm4-tools + # run: | + # git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution + # cd pm4-k8s-distribution/images/pm4-tools + # composer install --no-interaction + # cd .. + # - name: Deploy instance EKS + # run: | + # cd argocd + # deploy=$(echo -n ${{env.IMAGE_TAG}} | md5sum | head -c 10) + # current_datetime=$(echo -n ${{env.CURRENT_DATE}} | md5sum | head -c 10) + # 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 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 0m -f template-instance.yaml ci-$deploy processmaker/enterprise --version 2.1.0 + # 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 + # kubectl apply -f template-cert.yaml + # else + # echo "Bouncing Instance "; + # sed -i "s/{{instance}}/ci-$deploy/g" template-bounce.yaml + # sed -i "s/{{current_datetime}}/$current_datetime/g" template-bounce.yaml + # helm upgrade --timeout 20m ci-$deploy processmaker/enterprise --version 2.1.0 + # kubectl apply -f template-bounce.yaml + # fi + # export INSTANCE_URL=https://ci-$deploy$DOM_EKS + # echo "INSTANCE_URL=${INSTANCE_URL}" >> "$GITHUB_ENV" + # ../pm4-k8s-distribution/images/pm4-tools/pm wait-for-instance-ready + # - name: Comment Instance + # run: | + # echo "Instance URL: '${INSTANCE_URL}'" + # bash argocd/gh_comment.sh "$CI_PROJECT" "$pull_req_id" + #deleteEKS: + # name: Delete Instance + # if: github.event.action == 'closed' + # runs-on: self-hosted + # steps: + # - 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 - runPhpUnit: - name: run-phpunit - if: github.event.action != 'closed' - needs: imageEKS - runs-on: ${{ vars.RUNNER }} - steps: - - name: Export Params - run: | - echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}" >> $GITHUB_ENV - - name: Clone repo K8S - run: | - echo "IMAGE: ${{ env.IMAGE }}" - git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution - - name: Login to Harbor - uses: docker/login-action@v2 - with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - name: PHPUnits - run: | - cd pm4-k8s-distribution/images/pm4-tools - docker pull $IMAGE - docker-compose down -v - docker-compose build phpunit - docker-compose run phpunit + #runPhpUnit: + # name: run-phpunit + # if: github.event.action != 'closed' + # needs: imageEKS + # runs-on: ${{ vars.RUNNER }} + # steps: + # - name: Export Params + # run: | + # echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}" >> $GITHUB_ENV + # - name: Clone repo K8S + # run: | + # echo "IMAGE: ${{ env.IMAGE }}" + # git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution + # - name: Login to Harbor + # uses: docker/login-action@v2 + # with: + # registry: ${{ secrets.REGISTRY_HOST }} + # username: ${{ secrets.REGISTRY_USERNAME }} + # password: ${{ secrets.REGISTRY_PASSWORD }} + # - name: PHPUnits + # run: | + # cd pm4-k8s-distribution/images/pm4-tools + # docker pull $IMAGE + # docker-compose down -v + # docker-compose build phpunit + # docker-compose run phpunit \ No newline at end of file From 051d78fea208bf871f5590db3d6394a744626121 Mon Sep 17 00:00:00 2001 From: mavalosn Date: Mon, 15 Jan 2024 21:48:24 -0400 Subject: [PATCH 008/216] Add Second alternative --- .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 c115d6383e..44a4cb78b6 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -47,7 +47,7 @@ jobs: with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID1 }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY1 }} - aws-region: ${{ secrets.aws-region }} + aws-region: ${{ secrets.AWS_REGION }} - name: Set up kubectl run: | From 34ca24a071784331d537ff4e9b3a6cf8b110a67e Mon Sep 17 00:00:00 2001 From: mavalosn Date: Mon, 15 Jan 2024 22:14:30 -0400 Subject: [PATCH 009/216] Add Second alternative --- .github/workflows/deploy-pm4.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 44a4cb78b6..ce3a5bbe07 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -56,8 +56,10 @@ jobs: sudo mv kubectl /usr/local/bin/ - name: Authenticate with Amazon EKS run: aws eks update-kubeconfig --region us-east-1 --name next-qa-cluster - - name: Deploy to Amazon EKS - run: kubectl get nodes + #- name: Deploy to Amazon EKS + # run: kubectl get nodes + - name: Helm list + run: helm version && helm list #imageEKS: # name: build-docker-image-EKS # if: github.event.action != 'closed' From 3ed250a8a3a8ada02badc7907f6ef65b64941b67 Mon Sep 17 00:00:00 2001 From: mavalosn Date: Mon, 15 Jan 2024 22:16:43 -0400 Subject: [PATCH 010/216] Add Second alternative --- .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 ce3a5bbe07..ee2bb1c743 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -55,7 +55,7 @@ jobs: chmod +x kubectl sudo mv kubectl /usr/local/bin/ - name: Authenticate with Amazon EKS - run: aws eks update-kubeconfig --region us-east-1 --name next-qa-cluster + run: aws eks update-kubeconfig --region us-east-1 --name pm4-eng #- name: Deploy to Amazon EKS # run: kubectl get nodes - name: Helm list From 494a7a0e32068d95880d60d79d9d51227c2b3d45 Mon Sep 17 00:00:00 2001 From: mavalosn Date: Mon, 15 Jan 2024 23:00:54 -0400 Subject: [PATCH 011/216] Fix CICD --- .github/workflows/deploy-pm4.yml | 128 ++++++++++++++++++++----------- 1 file changed, 83 insertions(+), 45 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index ee2bb1c743..269c957deb 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -3,11 +3,11 @@ run-name: ${{ github.actor }} send deploy EKS 🚀 on: pull_request: types: [opened, reopened, synchronize, edited, closed] - #schedule: - # - cron: '30 2 * * *' # every day at midnight push: branches: - FOUR-13153 + #schedule: + # - cron: '30 2 * * *' # every day at midnight workflow_dispatch: workflow_call: env: @@ -35,31 +35,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: - deploy: - runs-on: ${{ vars.RUNNER }} - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID1 }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY1 }} - aws-region: ${{ secrets.AWS_REGION }} - - - name: Set up kubectl - run: | - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" - chmod +x kubectl - sudo mv kubectl /usr/local/bin/ - - name: Authenticate with Amazon EKS - run: aws eks update-kubeconfig --region us-east-1 --name pm4-eng - #- name: Deploy to Amazon EKS - # run: kubectl get nodes - - name: Helm list - run: helm version && helm list #imageEKS: # name: build-docker-image-EKS # if: github.event.action != 'closed' @@ -103,10 +78,77 @@ jobs: # 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: build-deploy-EKS + #if: contains(github.event.pull_request.body, 'ci:deploy') + #needs: imageEKS + runs-on: ${{ vars.RUNNER }} + 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 + - name: Install pm4-tools + run: | + git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution + cd pm4-k8s-distribution/images/pm4-tools + composer install --no-interaction + cd .. + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID1 }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY1 }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Set up kubectl + run: | + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + chmod +x kubectl + sudo mv kubectl /usr/local/bin/ + - name: Authenticate with Amazon EKS + run: aws eks update-kubeconfig --region us-east-1 --name pm4-eng + - name: Deploy instance EKS + run: | + cd argocd + deploy=$(echo -n ${{env.IMAGE_TAG}} | md5sum | head -c 10) + current_datetime=$(echo -n ${{env.CURRENT_DATE}} | md5sum | head -c 10) + 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 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 --version 2.1.0 + 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 + kubectl apply -f template-cert.yaml + else + echo "Bouncing Instance "; + sed -i "s/{{instance}}/ci-$deploy/g" template-bounce.yaml + sed -i "s/{{current_datetime}}/$current_datetime/g" template-bounce.yaml + helm upgrade --timeout 20m ci-$deploy processmaker/enterprise --version 2.1.0 + kubectl apply -f template-bounce.yaml + fi + export INSTANCE_URL=https://ci-$deploy$DOM_EKS + echo "INSTANCE_URL=${INSTANCE_URL}" >> "$GITHUB_ENV" + ../pm4-k8s-distribution/images/pm4-tools/pm wait-for-instance-ready + - name: Comment Instance + run: | + echo "Instance URL: '${INSTANCE_URL}'" + bash argocd/gh_comment.sh "$CI_PROJECT" "$pull_req_id" #deployEKS: # name: build-deploy-EKS - # #if: contains(github.event.pull_request.body, 'ci:deploy') - # #needs: imageEKS + # if: contains(github.event.pull_request.body, 'ci:deploy') + # needs: imageEKS # runs-on: self-hosted # steps: # - name: Clone private repository @@ -138,11 +180,7 @@ jobs: # 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 0m -f template-instance.yaml ci-$deploy processmaker/enterprise --version 2.1.0 - # 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 - # kubectl apply -f template-cert.yaml + # helm install --timeout 40m -f template-instance.yaml ci-$deploy processmaker/enterprise --version 2.1.0 # else # echo "Bouncing Instance "; # sed -i "s/{{instance}}/ci-$deploy/g" template-bounce.yaml @@ -157,17 +195,17 @@ jobs: # run: | # echo "Instance URL: '${INSTANCE_URL}'" # bash argocd/gh_comment.sh "$CI_PROJECT" "$pull_req_id" - #deleteEKS: - # name: Delete Instance - # if: github.event.action == 'closed' - # runs-on: self-hosted - # steps: - # - 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 + deleteEKS: + name: Delete Instance + if: github.event.action == 'closed' + runs-on: self-hosted + steps: + - 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 #runPhpUnit: # name: run-phpunit From 3970ae0c0e48724f46c632429e3d438c0440ab08 Mon Sep 17 00:00:00 2001 From: mavalosn Date: Mon, 15 Jan 2024 23:04:33 -0400 Subject: [PATCH 012/216] Fix CICD --- .github/workflows/deploy-pm4.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 269c957deb..98080c5fd5 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -78,12 +78,9 @@ jobs: # 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: build-deploy-EKS - #if: contains(github.event.pull_request.body, 'ci:deploy') - #needs: imageEKS - runs-on: ${{ vars.RUNNER }} - steps: + prepareDB: + 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 @@ -94,7 +91,24 @@ jobs: 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 + kubectl apply -f template-db.yaml + deployEKS: + name: build-deploy-EKS + #if: contains(github.event.pull_request.body, 'ci:deploy') + #needs: imageEKS + runs-on: ${{ vars.RUNNER }} + 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 - name: Install pm4-tools run: | git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution From 4917e8601ba7b50b6bd9c02e1360d0a538db994d Mon Sep 17 00:00:00 2001 From: mavalosn Date: Mon, 15 Jan 2024 23:30:08 -0400 Subject: [PATCH 013/216] Fix CICD --- .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 98080c5fd5..efce6edd66 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -140,7 +140,7 @@ jobs: 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 --version 2.1.0 + helm install --timeout 40m -f template-instance.yaml ci-$deploy processmaker/enterprise 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 From 0f476868289c11a2f4f893d1512bea02201da053 Mon Sep 17 00:00:00 2001 From: mavalosn Date: Tue, 16 Jan 2024 08:02:34 -0400 Subject: [PATCH 014/216] Test nes instance --- .github/workflows/deploy-pm4.yml | 90 ++++++++++++++++---------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index efce6edd66..218b4b70fa 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -18,7 +18,7 @@ env: pull_req_id: ${{github.event.pull_request.number}} DATE: $(date -d '-1 day' '+%Y-%m-%d'|sed 's/-//g') CURRENT_DATE: $(date '+%Y-%m-%d %H:%M:%S'|sed 's/-//g') - CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'FOUR-13151' }} + CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'FOUR-13153' }} CI_PROJECT: ${{github.event.pull_request.head.repo.name || 'processmaker' }} CI_PR_BODY: ${{ github.event_name == 'schedule' && 'No ci tags needed here' || github.event.pull_request.body }} IMAGE_TAG: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g") @@ -35,50 +35,51 @@ 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: - # - name: Set image name - # run: | - # RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} - # echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV - # - name: Clone repo K8S - # run: | - # echo "IMAGE: ${{ env.IMAGE }}" - # git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution - # - name: Generate image EKS - # run: | - # cd pm4-k8s-distribution/images - # branch=$CI_PACKAGE_BRANCH 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}} + imageEKS: + name: build-docker-image-EKS + if: github.event.action != 'closed' + runs-on: ${{ vars.RUNNER }} + steps: + - name: Set image name + run: | + RESOLVED_IMAGE_TAG=${{ env.IMAGE_TAG }} + echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:$RESOLVED_IMAGE_TAG" >> $GITHUB_ENV + - name: Clone repo K8S + run: | + echo "IMAGE: ${{ env.IMAGE }}" + git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution + - name: Generate image EKS + run: | + cd pm4-k8s-distribution/images + branch=$CI_PACKAGE_BRANCH 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}} prepareDB: + needs: imageEKS runs-on: self-hosted steps: - name: Clone private repository @@ -93,6 +94,7 @@ jobs: namespace=$(kubectl get namespace $deploy-ns-pm4|grep $deploy|awk '{print $1}') kubectl apply -f template-db.yaml deployEKS: + needs: imageEKS name: build-deploy-EKS #if: contains(github.event.pull_request.body, 'ci:deploy') #needs: imageEKS From 8fdb8fb2f1d1242a645ade17b9f9f8a4e19c2a3f Mon Sep 17 00:00:00 2001 From: mavalosn Date: Tue, 16 Jan 2024 16:22:07 -0400 Subject: [PATCH 015/216] Fix CICD --- .github/workflows/deploy-pm4.yml | 125 ++++++++----------------------- 1 file changed, 31 insertions(+), 94 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 218b4b70fa..9f2f048483 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -3,9 +3,6 @@ run-name: ${{ github.actor }} send deploy EKS 🚀 on: pull_request: types: [opened, reopened, synchronize, edited, closed] - push: - branches: - - FOUR-13153 #schedule: # - cron: '30 2 * * *' # every day at midnight workflow_dispatch: @@ -18,7 +15,7 @@ env: pull_req_id: ${{github.event.pull_request.number}} DATE: $(date -d '-1 day' '+%Y-%m-%d'|sed 's/-//g') CURRENT_DATE: $(date '+%Y-%m-%d %H:%M:%S'|sed 's/-//g') - CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'FOUR-13153' }} + CI_PACKAGE_BRANCH: ${{github.event.pull_request.head.ref || 'next' }} CI_PROJECT: ${{github.event.pull_request.head.repo.name || 'processmaker' }} CI_PR_BODY: ${{ github.event_name == 'schedule' && 'No ci tags needed here' || github.event.pull_request.body }} IMAGE_TAG: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g") @@ -94,23 +91,14 @@ jobs: namespace=$(kubectl get namespace $deploy-ns-pm4|grep $deploy|awk '{print $1}') kubectl apply -f template-db.yaml deployEKS: - needs: imageEKS name: build-deploy-EKS - #if: contains(github.event.pull_request.body, 'ci:deploy') - #needs: imageEKS + if: contains(github.event.pull_request.body, 'ci:deploy') + needs: imageEKS runs-on: ${{ vars.RUNNER }} 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 + git clone --depth 1 -b eng "https://$GITHUB_TOKEN@github.com/ProcessMaker/argocd.git" argocd - name: Install pm4-tools run: | git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution @@ -161,56 +149,6 @@ jobs: run: | echo "Instance URL: '${INSTANCE_URL}'" bash argocd/gh_comment.sh "$CI_PROJECT" "$pull_req_id" - #deployEKS: - # name: build-deploy-EKS - # if: contains(github.event.pull_request.body, 'ci:deploy') - # 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 - # - name: Install pm4-tools - # run: | - # git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution - # cd pm4-k8s-distribution/images/pm4-tools - # composer install --no-interaction - # cd .. - # - name: Deploy instance EKS - # run: | - # cd argocd - # deploy=$(echo -n ${{env.IMAGE_TAG}} | md5sum | head -c 10) - # current_datetime=$(echo -n ${{env.CURRENT_DATE}} | md5sum | head -c 10) - # 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 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 --version 2.1.0 - # else - # echo "Bouncing Instance "; - # sed -i "s/{{instance}}/ci-$deploy/g" template-bounce.yaml - # sed -i "s/{{current_datetime}}/$current_datetime/g" template-bounce.yaml - # helm upgrade --timeout 20m ci-$deploy processmaker/enterprise --version 2.1.0 - # kubectl apply -f template-bounce.yaml - # fi - # export INSTANCE_URL=https://ci-$deploy$DOM_EKS - # echo "INSTANCE_URL=${INSTANCE_URL}" >> "$GITHUB_ENV" - # ../pm4-k8s-distribution/images/pm4-tools/pm wait-for-instance-ready - # - name: Comment Instance - # run: | - # echo "Instance URL: '${INSTANCE_URL}'" - # bash argocd/gh_comment.sh "$CI_PROJECT" "$pull_req_id" deleteEKS: name: Delete Instance if: github.event.action == 'closed' @@ -221,31 +159,30 @@ jobs: 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 - - #runPhpUnit: - # name: run-phpunit - # if: github.event.action != 'closed' - # needs: imageEKS - # runs-on: ${{ vars.RUNNER }} - # steps: - # - name: Export Params - # run: | - # echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}" >> $GITHUB_ENV - # - name: Clone repo K8S - # run: | - # echo "IMAGE: ${{ env.IMAGE }}" - # git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution - # - name: Login to Harbor - # uses: docker/login-action@v2 - # with: - # registry: ${{ secrets.REGISTRY_HOST }} - # username: ${{ secrets.REGISTRY_USERNAME }} - # password: ${{ secrets.REGISTRY_PASSWORD }} - # - name: PHPUnits - # run: | - # cd pm4-k8s-distribution/images/pm4-tools - # docker pull $IMAGE - # docker-compose down -v - # docker-compose build phpunit - # docker-compose run phpunit \ No newline at end of file + kubectl delete namespace ci-$deploy-ns-pm4 + runPhpUnit: + name: run-phpunit + if: github.event.action != 'closed' + needs: imageEKS + runs-on: ${{ vars.RUNNER }} + steps: + - name: Export Params + run: | + echo "IMAGE=${{ secrets.REGISTRY_HOST }}/processmaker/enterprise:${{env.IMAGE_TAG}}" >> $GITHUB_ENV + - name: Clone repo K8S + run: | + echo "IMAGE: ${{ env.IMAGE }}" + git clone --depth 1 -b "$K8S_BRANCH" "https://$GITHUB_TOKEN@github.com/ProcessMaker/pm4-k8s-distribution.git" pm4-k8s-distribution + - name: Login to Harbor + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REGISTRY_HOST }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + - name: PHPUnits + run: | + cd pm4-k8s-distribution/images/pm4-tools + docker pull $IMAGE + docker-compose down -v + docker-compose build phpunit + docker-compose run phpunit \ No newline at end of file From 5dfea307adfece2e1f4390cb1f014317e2ce3a22 Mon Sep 17 00:00:00 2001 From: Ryan Cooley Date: Wed, 17 Jan 2024 12:23:48 -0800 Subject: [PATCH 016/216] Update custom package --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0d27b559e1..cf2cb79fef 100644 --- a/composer.json +++ b/composer.json @@ -98,7 +98,7 @@ "processmaker": { "build": "ad1d0941", "custom": { - "package-ellucian-ethos": "1.14.2", + "package-ellucian-ethos": "1.14.3", "package-plaid": "1.3.1", "paypal-package": "dev-fall", "pps-adsync": "dev-fall", From 06c65345e7cb82bdaf5cdc8705013bcbdb6ec46b Mon Sep 17 00:00:00 2001 From: Ryan Cooley Date: Wed, 17 Jan 2024 12:24:42 -0800 Subject: [PATCH 017/216] Version 4.8.3 Build #a93a06a5 --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cf2cb79fef..b34c6311c1 100644 --- a/composer.json +++ b/composer.json @@ -96,7 +96,7 @@ "Gmail" ], "processmaker": { - "build": "ad1d0941", + "build": "a93a06a5", "custom": { "package-ellucian-ethos": "1.14.3", "package-plaid": "1.3.1", diff --git a/composer.lock b/composer.lock index 2abfa40398..7fe1749e4a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5159980e43b36cd56a051795b1389dba", + "content-hash": "256b0e6faf785d88a800da3b927c6cba", "packages": [ { "name": "aws/aws-crt-php", From 47d8c67cf556e7e2ddbe771099b7d01d06b47818 Mon Sep 17 00:00:00 2001 From: mavalosn Date: Wed, 17 Jan 2024 16:59:57 -0400 Subject: [PATCH 018/216] FIX delete instance --- .github/workflows/deploy-pm4.yml | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/.github/workflows/deploy-pm4.yml b/.github/workflows/deploy-pm4.yml index 9f2f048483..2e94786e3e 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -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') @@ -126,6 +111,9 @@ 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 @@ -157,9 +145,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' From e19f9f51d6abc6bb9218af10fff1021514bcf3cb Mon Sep 17 00:00:00 2001 From: mavalosn Date: Thu, 18 Jan 2024 11:54:09 -0400 Subject: [PATCH 019/216] Update branch --- .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 2e94786e3e..0f9ef37736 100644 --- a/.github/workflows/deploy-pm4.yml +++ b/.github/workflows/deploy-pm4.yml @@ -119,6 +119,7 @@ jobs: 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 From 8bf8da7cf797c34b434e5c46e63221b968f0d2ac Mon Sep 17 00:00:00 2001 From: Ryan Cooley Date: Thu, 25 Jan 2024 11:39:47 -0400 Subject: [PATCH 020/216] Merge pull request #6094 from ProcessMaker/FOUR-13273 [FOUR-13273] Update translation script --- .github/workflows/scripts/translate.py | 33 +++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/scripts/translate.py b/.github/workflows/scripts/translate.py index 33b8087379..0097e2562a 100644 --- a/.github/workflows/scripts/translate.py +++ b/.github/workflows/scripts/translate.py @@ -1,12 +1,15 @@ import json import os import openai +from openai import OpenAI + +client = OpenAI( + api_key=os.environ["OPENAI_API_KEY"], + organization=os.environ["OPENAI_ORG"] +) import sys import time -openai.api_key = os.environ["OPENAI_API_KEY"] -openai.organization = os.environ["OPENAI_ORG"] - # Supported languages dictionary languages = { 'es': 'Spanish', @@ -50,19 +53,17 @@ def main(): while retry_count < max_retries: try: start_time = time.time() - response=openai.ChatCompletion.create( - model='gpt-4', - messages=[ - { - "role": "user", - "content": prompt - } - ], - temperature=0.3, - max_tokens=500, - n=1, - stop=None - ) + response=client.chat.completions.create(model='gpt-4', + messages=[ + { + "role": "user", + "content": prompt + } + ], + temperature=0.3, + max_tokens=500, + n=1, + stop=None) elapsed_time = time.time() - start_time if elapsed_time < timeout: translated_data[key] = response.choices[0].message.content.strip('"') From 205078e4c47fe6d779865005213fb886cdcb73f2 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Fri, 2 Feb 2024 17:05:13 -0800 Subject: [PATCH 021/216] Refactor --- .../PMColumnFilterPopoverCommonMixin.js | 30 ++++++++++++++++++- resources/js/components/shared/PmqlInput.vue | 26 ++++++++++++++-- .../requests/components/RequestsListing.vue | 14 +++------ resources/js/tasks/components/TasksList.vue | 16 ++++------ 4 files changed, 62 insertions(+), 24 deletions(-) diff --git a/resources/js/common/PMColumnFilterPopoverCommonMixin.js b/resources/js/common/PMColumnFilterPopoverCommonMixin.js index 6b03592443..dc0eece5a8 100644 --- a/resources/js/common/PMColumnFilterPopoverCommonMixin.js +++ b/resources/js/common/PMColumnFilterPopoverCommonMixin.js @@ -8,7 +8,27 @@ const PMColumnFilterCommonMixin = { viewProcesses: [] }; }, + watch: { + advancedFilter() { + console.log("Advanced filter set", JSON.stringify(this.advancedFilter)); + } + }, methods: { + storeFilterConfiguration() { + const { order, type } = this.filterConfiguration(); + let url = "users/store_filter_configuration/"; + if (this.$props.columns) { + url += "savedSearch|" + this.savedSearch; + } else { + url += type; + } + let config = { + filter: this.advancedFilter, + order, + }; + ProcessMaker.apiClient.put(url, config); + window.Processmaker.filter_user = config; + }, getViewConfigFilter() { return [ { @@ -67,15 +87,23 @@ const PMColumnFilterCommonMixin = { } ]; }, - onApply(json, index) { + addAliases(json) { let oldValue, type, value; for (let i in json) { + console.log("JSON", json[i]); oldValue = json[i].subject.value; type = this.getTypeColumnFilter(oldValue); value = this.getAliasColumnForFilter(oldValue); json[i].subject.type = type; json[i].subject.value = value; + + if (json[i].or && json[i].or.length > 0) { + this.addAliases(json[i].or); + } } + }, + onApply(json, index) { + this.addAliases(json); this.advancedFilterInit(); this.advancedFilter[index] = json; this.markStyleWhenColumnSetAFilter(); diff --git a/resources/js/components/shared/PmqlInput.vue b/resources/js/components/shared/PmqlInput.vue index 27da5985c6..d25f20d3f6 100755 --- a/resources/js/components/shared/PmqlInput.vue +++ b/resources/js/components/shared/PmqlInput.vue @@ -145,11 +145,11 @@
{{ $t(capitalizeString(filter[0])) }}: @@ -173,9 +173,11 @@ @endsection From ab8f19533d775441b98406fb170d22b8276d424b Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 6 Feb 2024 17:37:42 -0400 Subject: [PATCH 035/216] Setup columns --- resources/js/components/shared/Column.vue | 4 ++-- resources/js/components/shared/ColumnConfig.vue | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/resources/js/components/shared/Column.vue b/resources/js/components/shared/Column.vue index 95350fe072..8f068d236c 100644 --- a/resources/js/components/shared/Column.vue +++ b/resources/js/components/shared/Column.vue @@ -10,7 +10,7 @@ {{ item.label }}
- +
@@ -22,7 +22,7 @@ import DataFormats from '../../data-formats'; export default { - props: ["column","withoutConfig","withoutRemove","withoutFormat"], + props: ["column","withoutConfig","withoutRemove","withoutFormat","forceEnableConfig"], data() { return { item: this.column diff --git a/resources/js/components/shared/ColumnConfig.vue b/resources/js/components/shared/ColumnConfig.vue index 2a6c1c182e..e5e0d80ad6 100644 --- a/resources/js/components/shared/ColumnConfig.vue +++ b/resources/js/components/shared/ColumnConfig.vue @@ -10,16 +10,16 @@ - + - + - + {{ $t('Sortable') }} @@ -44,6 +44,12 @@ export default { DataFormatSelector, DataMaskSelector }, + props: { + editOnlyLabel: { + type: Boolean, + default: false, + }, + }, data() { return { disabled: true, From 900c5fb26ff39b429b215b381fee7c69ad473355 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Tue, 6 Feb 2024 17:54:57 -0400 Subject: [PATCH 036/216] Config column properties --- resources/js/components/shared/ColumnConfig.vue | 8 +++++--- resources/js/components/shared/DataFormatSelector.vue | 7 ++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/resources/js/components/shared/ColumnConfig.vue b/resources/js/components/shared/ColumnConfig.vue index e5e0d80ad6..6c2dbfc225 100644 --- a/resources/js/components/shared/ColumnConfig.vue +++ b/resources/js/components/shared/ColumnConfig.vue @@ -10,16 +10,16 @@ - + - + - + {{ $t('Sortable') }} @@ -108,6 +108,7 @@ export default { onShow() { this.index = this.$parent.columnToConfig.index; + this.original.default = this.$parent.columnToConfig.data.default; this.original.label = this.$parent.columnToConfig.data.label; this.original.field = this.$parent.columnToConfig.data.field; this.original.sortable = this.$parent.columnToConfig.data.sortable; @@ -120,6 +121,7 @@ export default { this.title = this.$t('Configure {{name}}', {name: this.original.label}); } + this.column.default = this.original.default; this.column.label = this.original.label; this.column.field = this.original.field; this.column.sortable = this.original.sortable; diff --git a/resources/js/components/shared/DataFormatSelector.vue b/resources/js/components/shared/DataFormatSelector.vue index bd3219e812..50bb1ff9e0 100644 --- a/resources/js/components/shared/DataFormatSelector.vue +++ b/resources/js/components/shared/DataFormatSelector.vue @@ -11,6 +11,7 @@ :searchable="true" :internal-search="true" :allow-empty="false" + :disabled="disabled" > @@ -24,7 +25,11 @@ export default { value: { type: String, default: 'string' - } + }, + disabled: { + type: Boolean, + default: false, + }, }, data() { return { From a310773ff2f20069457495ebb3781f4929c3650c Mon Sep 17 00:00:00 2001 From: Sanja Date: Tue, 6 Feb 2024 14:06:17 -0800 Subject: [PATCH 037/216] Add helperProcessRequestId Property to Controller Data --- .../js/components/templates/mixins/wizardHelperProcessModal.js | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/js/components/templates/mixins/wizardHelperProcessModal.js b/resources/js/components/templates/mixins/wizardHelperProcessModal.js index 083105da3f..74520b6585 100644 --- a/resources/js/components/templates/mixins/wizardHelperProcessModal.js +++ b/resources/js/components/templates/mixins/wizardHelperProcessModal.js @@ -109,6 +109,7 @@ export default { process_category_id: this.template.process.process_category_id, projects: null, wizardTemplateUuid: this.template.uuid, + helperProcessRequestId: this.task.process_request_id, }).then((response) => { if (response.data?.existingAssets) { this.handleExistingAssets(response.data); From 8d84314a090b451d7391d71bd99bced566a86b81 Mon Sep 17 00:00:00 2001 From: Sanja Date: Tue, 6 Feb 2024 14:08:10 -0800 Subject: [PATCH 038/216] Store Helper Process Request ID in Properties Attribute --- ProcessMaker/Templates/ProcessTemplate.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ProcessMaker/Templates/ProcessTemplate.php b/ProcessMaker/Templates/ProcessTemplate.php index 09e480a1c4..ee61cf3c02 100644 --- a/ProcessMaker/Templates/ProcessTemplate.php +++ b/ProcessMaker/Templates/ProcessTemplate.php @@ -248,9 +248,15 @@ public function create($request) : JsonResponse $payload['export'][$key]['attributes']['description'] = $requestData['description']; $payload['export'][$key]['attributes']['process_category_id'] = $requestData['process_category_id']; // Store the wizard template uuid on the process to rerun the helper process - if (isset($request->wizardTemplateUuid)) { + if (isset($requestData['wizardTemplateUuid'])) { $properties = json_decode($payload['export'][$key]['attributes']['properties'], true); - $properties['wizardTemplateUuid'] = $request->wizardTemplateUuid; + $properties['wizardTemplateUuid'] = $requestData['wizardTemplateUuid']; + $payload['export'][$key]['attributes']['properties'] = json_encode($properties); + } + // Store the helper process request id that initiated the process creation + if (isset($requestData['helperProcessRequestId'])) { + $properties = json_decode($payload['export'][$key]['attributes']['properties'], true); + $properties['helperProcessRequestId'] = $requestData['helperProcessRequestId']; $payload['export'][$key]['attributes']['properties'] = json_encode($properties); } From c78aff2f0fc740a00e8f3380135c2f822ffd4999 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Tue, 6 Feb 2024 14:56:43 -0800 Subject: [PATCH 039/216] Refactor column aliases --- .../common/PMColumnFilterPopoverCommonMixin.js | 16 ++++++++++++---- resources/js/tasks/components/TasksList.vue | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/resources/js/common/PMColumnFilterPopoverCommonMixin.js b/resources/js/common/PMColumnFilterPopoverCommonMixin.js index 75345ac265..369c476f56 100644 --- a/resources/js/common/PMColumnFilterPopoverCommonMixin.js +++ b/resources/js/common/PMColumnFilterPopoverCommonMixin.js @@ -1,3 +1,5 @@ +import { cloneDeep } from "lodash"; + const PMColumnFilterCommonMixin = { data() { return { @@ -102,7 +104,6 @@ const PMColumnFilterCommonMixin = { return this.tableHeaders.find(column.field === value)?.label; }, onApply(json, index) { - this.addAliases(json); this.advancedFilterInit(); this.advancedFilter[index] = json; this.markStyleWhenColumnSetAFilter(); @@ -129,7 +130,11 @@ const PMColumnFilterCommonMixin = { } }, formattedFilter() { - return this.json2Array(this.advancedFilter).flat(1); + const filterCopy = cloneDeep(this.advancedFilter); + Object.keys(filterCopy).forEach((key) => { + this.addAliases(filterCopy[key]); + }) + return this.json2Array(filterCopy).flat(1); }, getAdvancedFilter() { let formattedFilter = this.formattedFilter(); @@ -153,7 +158,7 @@ const PMColumnFilterCommonMixin = { if (column.format) { format = column.format; } - if (column.field === "status" || column.field === "assignee" || column.field === "participants" || column.field === 'process') { + if (column.field === "status" || column.field === "assignee" || column.field === "participants") { format = "stringSelect"; } return format; @@ -176,7 +181,10 @@ const PMColumnFilterCommonMixin = { }, getOperators(column) { let operators = []; - if (column.field === "status" || column.field === "assignee" || column.field === "participants" || column.field === 'process') { + if (column.field === "case_title" || column.field === "name" || column.field === "process" || column.field === "task_name") { + operators = ["=", "in", "contains", "regex"]; + } + if (column.field === "status" || column.field === "assignee" || column.field === "participants") { operators = ["=", "in"]; } return operators; diff --git a/resources/js/tasks/components/TasksList.vue b/resources/js/tasks/components/TasksList.vue index 237fb61cc2..1e48eda37b 100644 --- a/resources/js/tasks/components/TasksList.vue +++ b/resources/js/tasks/components/TasksList.vue @@ -24,7 +24,7 @@ Date: Tue, 6 Feb 2024 18:57:27 -0800 Subject: [PATCH 040/216] Continue refactoring advanced filter --- ProcessMaker/Models/ProcessRequestToken.php | 26 +++---- .../PMColumnFilterPopoverCommonMixin.js | 67 ++++++++++--------- .../js/common/advancedFilterStatusMixin.js | 24 +++---- .../requests/components/RequestsListing.vue | 11 +-- resources/js/tasks/components/TasksList.vue | 13 +--- resources/views/requests/index.blade.php | 2 +- resources/views/tasks/index.blade.php | 2 +- 7 files changed, 63 insertions(+), 82 deletions(-) diff --git a/ProcessMaker/Models/ProcessRequestToken.php b/ProcessMaker/Models/ProcessRequestToken.php index 10db8195c0..a058acfcd0 100644 --- a/ProcessMaker/Models/ProcessRequestToken.php +++ b/ProcessMaker/Models/ProcessRequestToken.php @@ -34,12 +34,12 @@ * @property string $element_id * @property string $element_type * @property string $status - * @property \Carbon\Carbon $completed_at - * @property \Carbon\Carbon $due_at - * @property \Carbon\Carbon $initiated_at - * @property \Carbon\Carbon $riskchanges_at - * @property \Carbon\Carbon $updated_at - * @property \Carbon\Carbon $created_at + * @property Carbon $completed_at + * @property Carbon $due_at + * @property Carbon $initiated_at + * @property Carbon $riskchanges_at + * @property Carbon $updated_at + * @property Carbon $created_at * @property ProcessRequest $processRequest * * @OA\Schema( @@ -332,7 +332,7 @@ public function getScreen(): ?Screen // It uses a try-catch block to handle any exceptions that might occur, for example in test environments. try { $localName = $this->getBpmnDefinition()->localName; - } catch (\Throwable $t) { + } catch (Throwable $t) { $localName = null; } $isManualTask = $localName === 'manualTask'; @@ -457,7 +457,7 @@ public function getAdvanceStatusAttribute() /** * Check if the user has access to reassign this task * - * @param \ProcessMaker\Models\User $user + * @param User $user */ public function authorizeReassignment(User $user) { @@ -616,7 +616,7 @@ public function fieldAliasCompleted() public function fieldAliasUser_Id() { - return 'user_id'; + return 'process_request_tokens.user_id'; } /** @@ -665,9 +665,9 @@ public function valueAliasStatus($value, $expression, $callback = null, User $us } elseif (array_key_exists($value, $statusMap)) { $query->where('is_self_service', 0); if ($expression->operator == '=') { - $query->whereIn('status', $statusMap[$value]); + $query->whereIn('process_request_tokens.status', $statusMap[$value]); } elseif ($expression->operator == '!=') { - $query->whereNotIn('status', $statusMap[$value]); + $query->whereNotIn('process_request_tokens.status', $statusMap[$value]); } } else { $query->where('status', $expression->operator, $value) @@ -909,8 +909,8 @@ public function persistUserData($user) /** * Log an error when executing the token * - * @param \Throwable $error - * @param \ProcessMaker\Nayra\Contracts\Bpmn\FlowElementInterface $bpmnElement + * @param Throwable $error + * @param FlowElementInterface $bpmnElement */ public function logError(Throwable $error, FlowElementInterface $bpmnElement) { diff --git a/resources/js/common/PMColumnFilterPopoverCommonMixin.js b/resources/js/common/PMColumnFilterPopoverCommonMixin.js index 369c476f56..48b028deac 100644 --- a/resources/js/common/PMColumnFilterPopoverCommonMixin.js +++ b/resources/js/common/PMColumnFilterPopoverCommonMixin.js @@ -1,4 +1,4 @@ -import { cloneDeep } from "lodash"; +import { get, cloneDeep } from "lodash"; const PMColumnFilterCommonMixin = { data() { @@ -20,12 +20,11 @@ const PMColumnFilterCommonMixin = { url += type; } let config = { - filter: this.advancedFilter, - order, + filters: this.formattedFilter(), + order }; ProcessMaker.apiClient.put(url, config); - window.Processmaker.filter_user = config; - window.Processmaker.advanced_filter = this.formattedFilter(); + window.ProcessMaker.advanced_filter = config; window.ProcessMaker.EventBus.$emit("advanced-filter-updated"); }, getViewConfigFilter() { @@ -86,22 +85,29 @@ const PMColumnFilterCommonMixin = { } ]; }, - addAliases(json) { - let oldValue, type, value; + addAliases(json, key, label) { + let type, value; for (let i in json) { - oldValue = json[i].subject.value; - type = this.getTypeColumnFilter(oldValue); - value = this.getAliasColumnForFilter(oldValue); + type = this.getTypeColumnFilter(json[i].subject.type); + value = this.getAliasColumnForFilter(json[i].subject.value); json[i].subject.type = type; json[i].subject.value = value; + json[i]._column_field = key; + json[i]._column_label = label; if (json[i].or && json[i].or.length > 0) { - this.addAliases(json[i].or); + this.addAliases(json[i].or, key, label); } } }, - findColumnLabel(value) { - return this.tableHeaders.find(column.field === value)?.label; + getTypeColumnFilter(value) { + return this.tableHeaders.find(column => column.field === value)?.filter_subject?.type || value; + }, + getAliasColumnForFilter(value) { + return this.tableHeaders.find(column => column.field === value)?.filter_subject?.value || value; + }, + getAliasColumnForOrderBy(value) { + return this.tableHeaders.find(column => column.field === value)?.order_column || value; }, onApply(json, index) { this.advancedFilterInit(); @@ -132,7 +138,8 @@ const PMColumnFilterCommonMixin = { formattedFilter() { const filterCopy = cloneDeep(this.advancedFilter); Object.keys(filterCopy).forEach((key) => { - this.addAliases(filterCopy[key]); + const label = this.tableHeaders.find(column => column.field === key)?.label; + this.addAliases(filterCopy[key], key, label); }) return this.json2Array(filterCopy).flat(1); }, @@ -246,24 +253,24 @@ const PMColumnFilterCommonMixin = { } } }, - getFilterConfiguration(name) { - if ("filter_user" in window.Processmaker) { - this.setFilterPropsFromConfig(window.Processmaker.filter_user); - } - }, - setFilterPropsFromConfig(config) { - if (typeof config !== "object") { - config = {}; - } - if ("filter" in config && typeof config.filter === "object") { - this.advancedFilter = config.filter; - } - if (config?.order?.by && config?.order?.direction) { - this.setOrderByProps(config.order.by, config.order.direction); + getFilterConfiguration() { + const filters = {}; + get(window, 'ProcessMaker.advanced_filter.filters', []).forEach((filter) => { + const key = filter._column_field; + if (!(key in filters)) { + filters[key] = []; + } + console.log("Setting filter for", key, filter); + filters[key].push(filter); + }); + this.advancedFilter = filters; + + const order = get(window, 'ProcessMaker.advanced_filter.order'); + if (order?.by && order?.direction) { + this.setOrderByProps(order.by, order.direction); } + this.markStyleWhenColumnSetAFilter(); - - window.Processmaker.advanced_filter = this.formattedFilter(); window.ProcessMaker.EventBus.$emit("advanced-filter-updated"); }, json2Array(json) { diff --git a/resources/js/common/advancedFilterStatusMixin.js b/resources/js/common/advancedFilterStatusMixin.js index 880664a360..ba0699e908 100644 --- a/resources/js/common/advancedFilterStatusMixin.js +++ b/resources/js/common/advancedFilterStatusMixin.js @@ -1,3 +1,5 @@ +import { get } from "lodash"; + export default { data() { return { @@ -10,12 +12,14 @@ export default { }, methods: { setAdvancedFilter() { - this.advancedFilter = window.Processmaker.advanced_filter || []; + this.advancedFilter = get(window, 'ProcessMaker.advanced_filter.filters', []); + + // console.log("Got advanced filter", JSON.parse(JSON.stringify(this.advancedFilter))); }, formatForBadge(filters, result) { for(const filter of filters) { result.push([ - this.formatBadgeSubject(filter.subject.value), + this.formatBadgeSubject(filter), [{name: this.formatBadgeValue(filter), advanced_filter: true}] ]); @@ -24,20 +28,8 @@ export default { } } }, - formatBadgeSubject(value) { - const parts = value.split("."); - let result = value; - if (parts.length > 1) { - result = parts[1]; - } - result = result.replace(/_/g, " "); - if (result === "name") { - result = "process"; - } - if (result === "element name") { - result = "task"; - } - return result; + formatBadgeSubject(filter) { + return get(filter, '_column_label', ''); }, formatBadgeValue(filter) { let result = filter.operator; diff --git a/resources/js/requests/components/RequestsListing.vue b/resources/js/requests/components/RequestsListing.vue index ea2bcdc438..591981f4b1 100644 --- a/resources/js/requests/components/RequestsListing.vue +++ b/resources/js/requests/components/RequestsListing.vue @@ -169,7 +169,7 @@ export default { mounted() { this.getParticipants(""); this.setupColumns(); - this.getFilterConfiguration("requestFilter"); + this.getFilterConfiguration(); }, methods: { setupColumns() { @@ -511,15 +511,6 @@ export default { type: 'requestFilter', } }, - getTypeColumnFilter(value) { - return this.tableHeaders.find(column => column.field === value)?.filter_subject?.type || "Field"; - }, - getAliasColumnForFilter(value) { - return this.tableHeaders.find(column => column.field === value)?.filter_subject?.value || value; - }, - getAliasColumnForOrderBy(value) { - return this.tableHeaders.find(column => column.field === value)?.order_column || value; - } } }; diff --git a/resources/js/tasks/components/TasksList.vue b/resources/js/tasks/components/TasksList.vue index 1e48eda37b..c4da7737a0 100644 --- a/resources/js/tasks/components/TasksList.vue +++ b/resources/js/tasks/components/TasksList.vue @@ -257,7 +257,7 @@ export default { this.getAssignee(""); this.getProcess(); this.setupColumns(); - this.getFilterConfiguration("taskFilter"); + this.getFilterConfiguration(); const params = new URL(document.location).searchParams; const successRouting = params.get("successfulRouting") === "true"; if (successRouting) { @@ -307,7 +307,7 @@ export default { default: true, width: 80, filter_subject: { type: 'Relationship', value: 'processRequest.case_number' }, - order_column: 'processRequest.case_number', + order_column: 'process_requests.case_number', }, { label: this.$t("Case title"), @@ -539,15 +539,6 @@ export default { type: 'taskFilter', } }, - getTypeColumnFilter(value) { - return this.tableHeaders.find(column => column.field === value)?.filter_subject?.type || "Field"; - }, - getAliasColumnForFilter(value) { - return this.tableHeaders.find(column => column.field === value)?.filter_subject?.value || value; - }, - getAliasColumnForOrderBy(value) { - return this.tableHeaders.find(column => column.field === value)?.order_column || value; - } } }; diff --git a/resources/views/requests/index.blade.php b/resources/views/requests/index.blade.php index 285fd97b53..093a5966e8 100644 --- a/resources/views/requests/index.blade.php +++ b/resources/views/requests/index.blade.php @@ -109,7 +109,7 @@ function() use ($title) { return [__($title), null]; } //Data needed for default search window.Processmaker.user = @json($currentUser); window.Processmaker.status = '{{ $type }}'; - window.Processmaker.filter_user = @json($userFilter); + window.ProcessMaker.advanced_filter = @json($userFilter); @endsection diff --git a/resources/views/tasks/index.blade.php b/resources/views/tasks/index.blade.php index 0b62c9d3c2..6c87f84eb8 100644 --- a/resources/views/tasks/index.blade.php +++ b/resources/views/tasks/index.blade.php @@ -81,7 +81,7 @@ @section('js') @endsection From 8192533a44a966616c03706b50f1314271fdaedf Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Wed, 7 Feb 2024 10:12:00 -0400 Subject: [PATCH 041/216] FOUR-14056 --- .../processes-catalogue/components/optionsMenu/ButtonsStart.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/processes-catalogue/components/optionsMenu/ButtonsStart.vue b/resources/js/processes-catalogue/components/optionsMenu/ButtonsStart.vue index de4b42790c..f45a61d52e 100644 --- a/resources/js/processes-catalogue/components/optionsMenu/ButtonsStart.vue +++ b/resources/js/processes-catalogue/components/optionsMenu/ButtonsStart.vue @@ -116,7 +116,7 @@ export default { this.spin = 0; const instance = response.data; this.$cookies.set("fromTriggerStartEvent", true, "1min"); - window.location = `/requests/${instance.id}`; + window.location = `/requests/${instance.id}?fromTriggerStartEvent=`; }).catch((err) => { const { data } = err.response; if (data.message) { From ad949af192561cd5cfb27de31835db3679719d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:34:44 -0300 Subject: [PATCH 042/216] Fix SKD_DIR path --- ProcessMaker/Console/Commands/BuildScriptExecutors.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ProcessMaker/Console/Commands/BuildScriptExecutors.php b/ProcessMaker/Console/Commands/BuildScriptExecutors.php index d2bf0edca5..ece157a185 100644 --- a/ProcessMaker/Console/Commands/BuildScriptExecutors.php +++ b/ProcessMaker/Console/Commands/BuildScriptExecutors.php @@ -71,7 +71,7 @@ public function handle() $this->userId = $this->argument('user'); try { $this->buildExecutor(); - } catch (\Exception $e) { + } catch (Exception $e) { if ($this->userId) { event(new BuildScriptExecutor($e->getMessage(), $this->userId, 'error')); } @@ -153,7 +153,7 @@ public function buildExecutor() $this->info('Building the docker executor'); $image = $scriptExecutor->dockerImageName(); - $command = Docker::command() . " build --build-arg SDK_DIR=/sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}"; + $command = Docker::command() . " build --build-arg SDK_DIR=./sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}"; if ($this->userId) { $this->runProc( @@ -229,7 +229,7 @@ private function associateWithExistingImage($executor) $instance = config('app.instance'); foreach ($images as $image) { if (!preg_match('/executor-' . $instance . '-.+-(\d+):/', $image, $match)) { - throw new \Exception('Not a valid image:' . (string) $image); + throw new Exception('Not a valid image:' . (string) $image); } $id = intval($match[1]); $existingExecutor = ScriptExecutor::find($id); From 0f0c6727583a260e32b16cfc59715672375a1b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:46:43 -0300 Subject: [PATCH 043/216] Fox sonarCube issues --- .../Console/Commands/BuildScriptExecutors.php | 6 ++++-- .../Exception/InvalidDockerImageException.php | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 ProcessMaker/Exception/InvalidDockerImageException.php diff --git a/ProcessMaker/Console/Commands/BuildScriptExecutors.php b/ProcessMaker/Console/Commands/BuildScriptExecutors.php index ece157a185..07bb9b40eb 100644 --- a/ProcessMaker/Console/Commands/BuildScriptExecutors.php +++ b/ProcessMaker/Console/Commands/BuildScriptExecutors.php @@ -5,6 +5,7 @@ use Exception; use Illuminate\Console\Command; use ProcessMaker\Events\BuildScriptExecutor; +use ProcessMaker\Exception\InvalidDockerImageException; use ProcessMaker\Facades\Docker; use ProcessMaker\Models\ScriptExecutor; @@ -153,7 +154,8 @@ public function buildExecutor() $this->info('Building the docker executor'); $image = $scriptExecutor->dockerImageName(); - $command = Docker::command() . " build --build-arg SDK_DIR=./sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}"; + $command = Docker::command() . + " build --build-arg SDK_DIR=./sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}"; if ($this->userId) { $this->runProc( @@ -229,7 +231,7 @@ private function associateWithExistingImage($executor) $instance = config('app.instance'); foreach ($images as $image) { if (!preg_match('/executor-' . $instance . '-.+-(\d+):/', $image, $match)) { - throw new Exception('Not a valid image:' . (string) $image); + throw new InvalidDockerImageException('Not a valid image:' . (string) $image); } $id = intval($match[1]); $existingExecutor = ScriptExecutor::find($id); diff --git a/ProcessMaker/Exception/InvalidDockerImageException.php b/ProcessMaker/Exception/InvalidDockerImageException.php new file mode 100644 index 0000000000..fd4abad0eb --- /dev/null +++ b/ProcessMaker/Exception/InvalidDockerImageException.php @@ -0,0 +1,13 @@ + Date: Wed, 7 Feb 2024 13:13:03 -0400 Subject: [PATCH 044/216] FOUR-13251 The selection list for participants is replaced by a text input that accepts the operators: '=', 'in', 'contains', 'regex'. These operators provide more filtering options; the change is due to a selection list becoming too large when we have many participants. Additionally, we have hidden the sorting buttons for the participants column since a record in the table can have many participants. --- ProcessMaker/Filters/Filter.php | 5 +++++ ProcessMaker/Models/ProcessRequest.php | 20 +++++++++++++++++++ .../PMColumnFilterPopoverCommonMixin.js | 13 +++++------- .../PMColumnFilterForm.vue | 5 +++-- .../PMColumnFilterPopover.vue | 5 +++-- .../requests/components/RequestsListing.vue | 4 +++- 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/ProcessMaker/Filters/Filter.php b/ProcessMaker/Filters/Filter.php index 2ae8b71ca4..04e381a2da 100644 --- a/ProcessMaker/Filters/Filter.php +++ b/ProcessMaker/Filters/Filter.php @@ -13,6 +13,8 @@ class Filter { const TYPE_PARTICIPANTS = 'Participants'; + const TYPE_PARTICIPANTS_FULLNAME = 'ParticipantsFullName'; + const TYPE_STATUS = 'Status'; const TYPE_FIELD = 'Field'; @@ -195,6 +197,9 @@ private function valueAliasMethod() case self::TYPE_PARTICIPANTS: $method = 'valueAliasParticipant'; break; + case self::TYPE_PARTICIPANTS_FULLNAME: + $method = 'valueAliasParticipantByFullName'; + break; case self::TYPE_STATUS: $method = 'valueAliasStatus'; break; diff --git a/ProcessMaker/Models/ProcessRequest.php b/ProcessMaker/Models/ProcessRequest.php index 43c3ea179c..7c10244fcf 100644 --- a/ProcessMaker/Models/ProcessRequest.php +++ b/ProcessMaker/Models/ProcessRequest.php @@ -725,6 +725,26 @@ public function valueAliasParticipant($value, $expression) } } + /** + * PMQL value alias for participant field by fullname. + * @param string $value + * @return callable + */ + public function valueAliasParticipantByFullName($value, $expression) + { + return function ($query) use ($value, $expression) { + $query->whereIn('id', function ($subquery) use ($value, $expression) { + $subquery->select('process_request_id')->from('process_request_tokens') + ->whereIn('user_id', function ($subquery) use ($value, $expression) { + $subquery->select('id') + ->from('users') + ->whereRaw("CONCAT(firstname, ' ', lastname) " . $expression->operator . " ?", [$value]); + }) + ->whereIn('element_type', ['task', 'userTask', 'startEvent']); + }); + }; + } + /** * Get the process version used by this request * diff --git a/resources/js/common/PMColumnFilterPopoverCommonMixin.js b/resources/js/common/PMColumnFilterPopoverCommonMixin.js index 6b03592443..0e749b1269 100644 --- a/resources/js/common/PMColumnFilterPopoverCommonMixin.js +++ b/resources/js/common/PMColumnFilterPopoverCommonMixin.js @@ -123,7 +123,7 @@ const PMColumnFilterCommonMixin = { if (column.format) { format = column.format; } - if (column.field === "status" || column.field === "assignee" || column.field === "participants" || column.field === 'process') { + if (column.field === "status" || column.field === "assignee") { format = "stringSelect"; } return format; @@ -136,17 +136,14 @@ const PMColumnFilterCommonMixin = { if (column.field === "assignee") { formatRange = this.viewAssignee; } - if (column.field === "participants") { - formatRange = this.viewParticipants; - } - if (column.field === "process") { - formatRange = this.viewProcesses; - } return formatRange; }, getOperators(column) { let operators = []; - if (column.field === "status" || column.field === "assignee" || column.field === "participants" || column.field === 'process') { + if (column.field === "case_title" || column.field === "name" || column.field === "process" || column.field === "task_name" || column.field === "participants") { + operators = ["=", "in", "contains", "regex"]; + } + if (column.field === "status" || column.field === "assignee") { operators = ["=", "in"]; } return operators; diff --git a/resources/js/components/PMColumnFilterPopover/PMColumnFilterForm.vue b/resources/js/components/PMColumnFilterPopover/PMColumnFilterForm.vue index c905b7d675..476ed8f79e 100644 --- a/resources/js/components/PMColumnFilterPopover/PMColumnFilterForm.vue +++ b/resources/js/components/PMColumnFilterPopover/PMColumnFilterForm.vue @@ -2,7 +2,8 @@
+ @onChange="onChangeSort" + v-if="typeof hideSortingButtons === 'boolean' ? !hideSortingButtons : true">
@@ -90,7 +91,7 @@ components: { ...Components }, - props: ["type", "value", "format", "formatRange", "operators", "viewConfig", "sort"], + props: ["type", "value", "format", "formatRange", "operators", "viewConfig", "sort", "hideSortingButtons"], data() { return { items: [], diff --git a/resources/js/components/PMColumnFilterPopover/PMColumnFilterPopover.vue b/resources/js/components/PMColumnFilterPopover/PMColumnFilterPopover.vue index 7e3586317c..6e0a4703a5 100644 --- a/resources/js/components/PMColumnFilterPopover/PMColumnFilterPopover.vue +++ b/resources/js/components/PMColumnFilterPopover/PMColumnFilterPopover.vue @@ -23,6 +23,7 @@ :operators="operators" :viewConfig="viewConfig" :sort="sort" + :hideSortingButtons="hideSortingButtons" @onChangeSort="onChangeSort" @onApply="onApply" @onClear="onClear" @@ -41,7 +42,7 @@ PMColumnFilterForm, PMColumnFilterIconThreeDots }, - props: ["container", "boundary", "id", "type", "value", "format", "formatRange", "operators", "viewConfig", "sort"], + props: ["container", "boundary", "id", "type", "value", "format", "formatRange", "operators", "viewConfig", "sort", "hideSortingButtons"], data() { return { popoverShow: false @@ -103,4 +104,4 @@ .popover{ max-width: 375px; } - \ No newline at end of file + diff --git a/resources/js/requests/components/RequestsListing.vue b/resources/js/requests/components/RequestsListing.vue index d1b3bf72ca..5207d5f959 100644 --- a/resources/js/requests/components/RequestsListing.vue +++ b/resources/js/requests/components/RequestsListing.vue @@ -29,6 +29,7 @@ :viewConfig="getViewConfigFilter()" :container="''" :boundary="'viewport'" + :hideSortingButtons="column.hideSortingButtons" @onChangeSort="onChangeSort($event, column.field)" @onApply="onApply($event, column.field)" @onClear="onClear(column.field)" @@ -266,6 +267,7 @@ export default { default: true, width: 160, truncate: true, + hideSortingButtons: true, }, { label: this.$t("Status"), @@ -527,7 +529,7 @@ export default { type = "Task"; } if (value === "participants") { - type = "Participants"; + type = "ParticipantsFullName"; } if (value === "status") { type = "Status"; From 35cf25db850f2e5cefc90e1630ab588b8a2f948d Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Wed, 7 Feb 2024 09:28:09 -0800 Subject: [PATCH 045/216] Fix order column name --- resources/js/tasks/components/TasksList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/tasks/components/TasksList.vue b/resources/js/tasks/components/TasksList.vue index c4da7737a0..d0af414428 100644 --- a/resources/js/tasks/components/TasksList.vue +++ b/resources/js/tasks/components/TasksList.vue @@ -318,7 +318,7 @@ export default { width: 220, truncate: true, filter_subject: { type: 'Relationship', value: 'processRequest.case_title' }, - order_column: 'processRequest.case_title', + order_column: 'process_requests.case_title', }, { label: this.$t("Process"), From 792d589e4f49735a8bde8476f4d771ce2eb28188 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 7 Feb 2024 14:26:39 -0400 Subject: [PATCH 046/216] Add button to edit default request list --- resources/views/requests/index.blade.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/views/requests/index.blade.php b/resources/views/requests/index.blade.php index 518fa8c39f..b28bf8dd12 100644 --- a/resources/views/requests/index.blade.php +++ b/resources/views/requests/index.blade.php @@ -89,6 +89,14 @@ function() use ($title) { return [__($title), null]; }
+ +
From f6f6b342b505c5f35e889ab7cb15029ffdb4ea9c Mon Sep 17 00:00:00 2001 From: Sanja Date: Wed, 7 Feb 2024 11:08:21 -0800 Subject: [PATCH 047/216] Pass the processId into the Request Data --- .../js/components/templates/WizardHelperProcessModal.vue | 2 +- .../components/templates/mixins/wizardHelperProcessModal.js | 5 +++-- .../js/processes-catalogue/components/ProcessOptions.vue | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/js/components/templates/WizardHelperProcessModal.vue b/resources/js/components/templates/WizardHelperProcessModal.vue index d555c9c8a0..1402d351f8 100644 --- a/resources/js/components/templates/WizardHelperProcessModal.vue +++ b/resources/js/components/templates/WizardHelperProcessModal.vue @@ -31,7 +31,7 @@ import wizardHelperProcessModalMixin from "./mixins/wizardHelperProcessModal"; export default { mixins: [wizardHelperProcessModalMixin], components: { Modal, Task}, - props: ["wizardTemplateUuid"], + props: ["wizardTemplateUuid", "processLaunchpadId"], data() { return { helperProcessId: null, diff --git a/resources/js/components/templates/mixins/wizardHelperProcessModal.js b/resources/js/components/templates/mixins/wizardHelperProcessModal.js index 083105da3f..4ab8fca500 100644 --- a/resources/js/components/templates/mixins/wizardHelperProcessModal.js +++ b/resources/js/components/templates/mixins/wizardHelperProcessModal.js @@ -30,9 +30,10 @@ export default { triggerHelperProcessStartEvent() { const startEventId = this.startEvents[0].id; const url = `/process_events/${this.helperProcessId}?event=${startEventId}`; - // Start the helper process - window.ProcessMaker.apiClient.post(url).then((response) => { + window.ProcessMaker.apiClient.post(url, { + process_launchpad_id: this.processLaunchpadId ? this.processLaunchpadId : null + }).then((response) => { const processRequestId = response.data.id; this.getFirstTask(processRequestId); }).catch((error) => { diff --git a/resources/js/processes-catalogue/components/ProcessOptions.vue b/resources/js/processes-catalogue/components/ProcessOptions.vue index b61f629876..da7d184665 100644 --- a/resources/js/processes-catalogue/components/ProcessOptions.vue +++ b/resources/js/processes-catalogue/components/ProcessOptions.vue @@ -12,6 +12,7 @@ v-if="createdFromWizardTemplate" id="wizardHelperProcessModal" ref="wizardHelperProcessModal" + :processLaunchpadId="process.id" :wizardTemplateUuid="wizardTemplateUuid" /> From 5dd528cc059952e5bf0238c81e204e073264021a Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 7 Feb 2024 15:15:35 -0400 Subject: [PATCH 048/216] When columns is null show the default columns --- resources/js/requests/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/requests/index.js b/resources/js/requests/index.js index b370e815a5..00d6322f96 100644 --- a/resources/js/requests/index.js +++ b/resources/js/requests/index.js @@ -12,7 +12,7 @@ new Vue({ CounterCard, CounterCardGroup, RequestsListing }, data: { - columns: window.Processmaker.defaultColumns || [], + columns: window.Processmaker.defaultColumns || null, filter: "", pmql: "", urlPmql: "", From 397c482e5ce53b02a32d1d24967400edfe8d9c9a Mon Sep 17 00:00:00 2001 From: Gustavo Bascope Date: Wed, 7 Feb 2024 15:18:52 -0400 Subject: [PATCH 049/216] applied a method to initialy adjust the content with the column width --- resources/js/components/shared/EllipsisMenu.vue | 2 +- resources/js/components/shared/FilterTable.vue | 3 ++- resources/js/processes-catalogue/components/RequestTab.vue | 1 + resources/js/processes-catalogue/components/TaskTab.vue | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/js/components/shared/EllipsisMenu.vue b/resources/js/components/shared/EllipsisMenu.vue index 1329138430..e59d425e57 100644 --- a/resources/js/components/shared/EllipsisMenu.vue +++ b/resources/js/components/shared/EllipsisMenu.vue @@ -8,7 +8,7 @@ lazy right offset="0" - class="ellipsis-dropdown-main" + class="ellipsis-dropdown-main static-header" @show="onShow" @hide="onHide" diff --git a/resources/js/components/shared/FilterTable.vue b/resources/js/components/shared/FilterTable.vue index f3fc0b3be4..979c6e3dd6 100644 --- a/resources/js/components/shared/FilterTable.vue +++ b/resources/js/components/shared/FilterTable.vue @@ -174,6 +174,7 @@ export default { }, mounted() { this.$nextTick(() => { + this.calculateColumnWidth(); const ellipsisColumn = document.querySelectorAll(".pm-table-ellipsis-column"); ellipsisColumn.forEach((column) => { @@ -209,7 +210,7 @@ export default { let min = 40; const currentWidth = Math.max(min, this.startWidth + diff); const contentWidth = this.calculateContent(this.resizingColumnIndex); - if ((contentWidth - currentWidth) <= 60) { + if ((contentWidth - currentWidth) <= 80) { this.headers[this.resizingColumnIndex].width = currentWidth; } } diff --git a/resources/js/processes-catalogue/components/RequestTab.vue b/resources/js/processes-catalogue/components/RequestTab.vue index 7a848c6d6d..10e63071d9 100644 --- a/resources/js/processes-catalogue/components/RequestTab.vue +++ b/resources/js/processes-catalogue/components/RequestTab.vue @@ -7,6 +7,7 @@ - ${processTask.case_title_formatted || ""} + ${processTask.case_title_formatted || ""} hjgjhgjhg gjhghjg jhgjhghjg jhgjhghjg ghuhj `; }, formatParticipants(participants) { From ae0d8e8493913f8cf72170ea114db20720008e0c Mon Sep 17 00:00:00 2001 From: Gustavo Bascope Date: Wed, 7 Feb 2024 15:27:16 -0400 Subject: [PATCH 050/216] Clear test code --- resources/js/processes-catalogue/components/TaskTab.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/processes-catalogue/components/TaskTab.vue b/resources/js/processes-catalogue/components/TaskTab.vue index 0f55d97c2c..48e017383e 100644 --- a/resources/js/processes-catalogue/components/TaskTab.vue +++ b/resources/js/processes-catalogue/components/TaskTab.vue @@ -158,7 +158,7 @@ export default { return ` - ${processTask.case_title_formatted || ""} hjgjhgjhg gjhghjg jhgjhghjg jhgjhghjg ghuhj + ${processTask.case_title_formatted || ""} `; }, formatParticipants(participants) { From ad3991e5f338cb7b217d6d92c9b73ba5b3005b6b Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Wed, 7 Feb 2024 15:30:10 -0400 Subject: [PATCH 051/216] Fix code smells --- resources/views/requests/index.blade.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/views/requests/index.blade.php b/resources/views/requests/index.blade.php index b28bf8dd12..332af5df2b 100644 --- a/resources/views/requests/index.blade.php +++ b/resources/views/requests/index.blade.php @@ -91,7 +91,10 @@ function() use ($title) { return [__($title), null]; } diff --git a/resources/js/templates/components/ProcessTemplatesListing.vue b/resources/js/templates/components/ProcessTemplatesListing.vue index 980833bcea..1b5c926854 100644 --- a/resources/js/templates/components/ProcessTemplatesListing.vue +++ b/resources/js/templates/components/ProcessTemplatesListing.vue @@ -88,7 +88,7 @@
- {{ row[header.field] }} + {{ getNestedPropertyValue(row, header) }}
From df8f530afe015523466376a877782082688e7d2e Mon Sep 17 00:00:00 2001 From: Luciana Nunez Date: Thu, 8 Feb 2024 16:20:38 -0400 Subject: [PATCH 086/216] feature/FOUR-14031 --- resources/lang/en.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/lang/en.json b/resources/lang/en.json index 4d62bd0416..420b57c1ed 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1184,6 +1184,7 @@ "Search faster.": "Search faster.", "Search Here": "Search Here", "Search Processes": "Search Processes", + "Place your controls here.": "Place your controls here.", "PM Blocks": "PM Blocks", "Prev": "Prev", "Preview Desktop": "Preview Desktop", @@ -1797,6 +1798,7 @@ "Timeout": "Timeout", "Timing Control": "Timing Control", "Title": "Title", + "To begin creating a screen, drag and drop items from the Controls Menu on the left.": "To begin creating a screen, drag and drop items from the Controls Menu on the left.", "To change the current username and password please contact your administrator.": "To change the current username and password please contact your administrator.", "To Do Tasks": "To Do Tasks", "To Do": "To Do", From 86db49a17f658618e231ab7d3d1cb818c330c956 Mon Sep 17 00:00:00 2001 From: Luciana Nunez Date: Thu, 8 Feb 2024 16:35:30 -0400 Subject: [PATCH 087/216] feature/FOUR-14083 --- resources/lang/en.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/en.json b/resources/lang/en.json index 4d62bd0416..9164425c16 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1028,6 +1028,7 @@ "No new notifications at the moment.": "No new notifications at the moment.", "No Notifications Found": "No Notifications Found", "no problems to report": "no problems to report", + "No Processes Available": "No Processes Available", "No relevant data": "No relevant data", "No Request Data": "No Request Data", "No results.": "No results.", From 91d6ba9e4cd40e028700b38455718e6766065816 Mon Sep 17 00:00:00 2001 From: Alex Runyan Date: Thu, 8 Feb 2024 16:26:07 -0500 Subject: [PATCH 088/216] Cast "loggedin_at" to datetime always --- ProcessMaker/Listeners/LoginListener.php | 19 +++++++++++-------- ProcessMaker/Models/User.php | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ProcessMaker/Listeners/LoginListener.php b/ProcessMaker/Listeners/LoginListener.php index c308f80009..7d3b5fe9ee 100644 --- a/ProcessMaker/Listeners/LoginListener.php +++ b/ProcessMaker/Listeners/LoginListener.php @@ -2,24 +2,27 @@ namespace ProcessMaker\Listeners; -use Carbon\Carbon; +use ProcessMaker\Models\User; use Illuminate\Auth\Events\Login; class LoginListener { /** - * Handle the event. + * Updated the user's loggedin_at attribute + * + * @param \Illuminate\Auth\Events\Login $event * - * @param Illuminate\Auth\Events\Login $user * @return void */ - public function handle(Login $event) + public function handle(Login $event): void { - // Grab our user that was logged in $user = $event->user; - // Update the last_login - $user->timestamps = false; - $user->loggedin_at = Carbon::now(); + + if (!$user instanceof User) { + return; + } + + $user->setAttribute('loggedin_at', now()); $user->save(); } } diff --git a/ProcessMaker/Models/User.php b/ProcessMaker/Models/User.php index c1bc386e3d..670f9834fb 100644 --- a/ProcessMaker/Models/User.php +++ b/ProcessMaker/Models/User.php @@ -137,6 +137,7 @@ class User extends Authenticatable implements HasMedia 'is_administrator' => 'bool', 'meta' => 'object', 'active_at' => 'datetime', + 'loggedin_at' => 'datetime', 'schedule' => 'array', 'preferences_2fa' => 'array', ]; From ab7708133af2fdec32449a8dd679e47a1717cf92 Mon Sep 17 00:00:00 2001 From: David Callizaya Date: Thu, 8 Feb 2024 17:39:57 -0400 Subject: [PATCH 089/216] Control access to configure the Request and Task columns --- resources/views/requests/index.blade.php | 5 ++++- resources/views/tasks/index.blade.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/views/requests/index.blade.php b/resources/views/requests/index.blade.php index 398ccc175e..66d7a5edd4 100644 --- a/resources/views/requests/index.blade.php +++ b/resources/views/requests/index.blade.php @@ -90,7 +90,10 @@ function() use ($title) { return [__($title), null]; }
- Details + {{ $t('Details') }}
diff --git a/resources/js/components/shared/FilterTable.vue b/resources/js/components/shared/FilterTable.vue index 92fed23042..46aed20ef5 100644 --- a/resources/js/components/shared/FilterTable.vue +++ b/resources/js/components/shared/FilterTable.vue @@ -28,7 +28,7 @@ :style="{ width: column.width + 'px' }" > - {{ column.label }} + {{ $t(column.label) }}
diff --git a/resources/js/components/shared/SidebarNav.vue b/resources/js/components/shared/SidebarNav.vue index 1282a12afd..ace4ca8688 100644 --- a/resources/js/components/shared/SidebarNav.vue +++ b/resources/js/components/shared/SidebarNav.vue @@ -31,7 +31,7 @@ class="text-capitalize" @click="onClick(i)" > - {{ formatAssetName(page.title) }} + {{ formatAssetName($t(page.title)) }} diff --git a/resources/js/processes-catalogue/components/ProcessTab.vue b/resources/js/processes-catalogue/components/ProcessTab.vue index 8f8c84ea05..7ffed618ee 100644 --- a/resources/js/processes-catalogue/components/ProcessTab.vue +++ b/resources/js/processes-catalogue/components/ProcessTab.vue @@ -5,7 +5,7 @@ lazy >
-

{{ $root.operation }} Process: {{ processName }}

+

{{ $t($root.operation) }} {{ $t('Process') }}: {{ processName }}


-

{{ group.typeHumanPlural }}

+

{{ $t(group.typeHumanPlural) }}

-
{{ $root.operation }} Status: +
{{ $t($root.operation) }} {{ $t('Status') }}: - Full {{ $root.operation }} + {{ $t('Full') }} {{ $t($root.operation) }}
- All {{ group.typeHumanPlural }} will be included in this {{ $root.operation.toLowerCase() }}. + {{ $t('All') }} {{ $t(group.typeHumanPlural) }} will be included in this {{ $root.operation.toLowerCase() }}.
-
{{ $root.operation }} Status: +
{{ $t($root.operation) }} {{ $t('Status') }}: Not {{ $root.operation }}ing
- {{ group.typeHumanPlural }} will Not be included in this {{ $root.operation.toLowerCase() }}. + {{ $t(group.typeHumanPlural) }} will Not be included in this {{ $root.operation.toLowerCase() }}.
- Return to Summary + {{ $t('Return to Summary') }}

@@ -42,18 +42,18 @@