From c632e1f5729672c641247fea27b507cc0455487d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Sat, 12 Aug 2023 17:41:54 +0300 Subject: [PATCH 01/19] fix: update BUILD condition in pr-deploy.yaml --- .github/workflows/pr-deploy.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 8b830ee73e361..8c52b8d5f7d3d 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -78,7 +78,8 @@ jobs: (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && ( (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || - github.event.inputs.build == 'true' + github.event.inputs.build == 'true' || + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') ) }} @@ -172,7 +173,7 @@ jobs: echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || github.event.inputs.build == 'true') }}" + echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || github.event.inputs.build == 'true' || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true')) }}" echo "GITHUB_REF=${{ github.ref }}" comment-pr: From 227e28e65c992be9ce611b1312e3dca0a343ded1 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sat, 12 Aug 2023 14:54:06 +0000 Subject: [PATCH 02/19] fixup! --- .github/workflows/pr-deploy.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 8c52b8d5f7d3d..695a45fb98b5f 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -75,11 +75,10 @@ jobs: NEW: ${{ steps.check_deployment.outputs.NEW }} BUILD: | ${{ - (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && + (github.event.inputs.build == 'true' || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) && ( (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || - github.event.inputs.build == 'true' || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') ) }} @@ -173,7 +172,7 @@ jobs: echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - echo "BUILD=${{ (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || github.event.inputs.build == 'true' || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true')) }}" + echo "BUILD=${{ (github.event.inputs.build == 'true' || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true')) }}" echo "GITHUB_REF=${{ github.ref }}" comment-pr: From e275df8900b5e959330ae241b1e647e6219db744 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 06:07:50 +0000 Subject: [PATCH 03/19] update --- .github/workflows/pr-deploy.yaml | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 695a45fb98b5f..0419cfb683f2b 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -75,10 +75,13 @@ jobs: NEW: ${{ steps.check_deployment.outputs.NEW }} BUILD: | ${{ - (github.event.inputs.build == 'true' || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) && + github.event.inputs.build == 'true' || + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || + (steps.check_deployment.outputs.NEW == 'false' && ( - (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') + steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || + github.event_name == 'push' + ) ) }} @@ -162,18 +165,18 @@ jobs: echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}" echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}" - - name: Print job outputs - run: | - set -euo pipefail - # Print all outputs of this job - echo "PR_NUMBER=${{ steps.pr_info.outputs.PR_NUMBER }}" - echo "PR_TITLE=${{ steps.pr_info.outputs.PR_TITLE }}" - echo "PR_URL=${{ steps.pr_info.outputs.PR_URL }}" - echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" - echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" - echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - echo "BUILD=${{ (github.event.inputs.build == 'true' || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true')) }}" - echo "GITHUB_REF=${{ github.ref }}" + # - name: Print job outputs + # run: | + # set -euo pipefail + # # Print all outputs of this job + # echo "PR_NUMBER=${{ steps.pr_info.outputs.PR_NUMBER }}" + # echo "PR_TITLE=${{ steps.pr_info.outputs.PR_TITLE }}" + # echo "PR_URL=${{ steps.pr_info.outputs.PR_URL }}" + # echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" + # echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" + # echo "NEW=${{ steps.check_deployment.outputs.NEW }}" + # echo "BUILD=${{ (github.event.inputs.build == 'true' || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true')) }}" + # echo "GITHUB_REF=${{ github.ref }}" comment-pr: needs: [check_pr, get_info] From 588ff7379192668365b4e10208fb19ec2ef3af4d Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 06:12:40 +0000 Subject: [PATCH 04/19] debug --- .github/workflows/pr-deploy.yaml | 33 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 0419cfb683f2b..c586a21c90e7f 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -77,11 +77,12 @@ jobs: ${{ github.event.inputs.build == 'true' || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || - (steps.check_deployment.outputs.NEW == 'false' && ( - steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || - github.event_name == 'push' - ) + steps.check_deployment.outputs.NEW == 'false' && + ( + steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || + github.event_name == 'push' + ) ) }} @@ -165,18 +166,18 @@ jobs: echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}" echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}" - # - name: Print job outputs - # run: | - # set -euo pipefail - # # Print all outputs of this job - # echo "PR_NUMBER=${{ steps.pr_info.outputs.PR_NUMBER }}" - # echo "PR_TITLE=${{ steps.pr_info.outputs.PR_TITLE }}" - # echo "PR_URL=${{ steps.pr_info.outputs.PR_URL }}" - # echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" - # echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" - # echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - # echo "BUILD=${{ (github.event.inputs.build == 'true' || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) && ((github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true')) }}" - # echo "GITHUB_REF=${{ github.ref }}" + - name: Print job outputs + run: | + set -euo pipefail + # Print all outputs of this job + echo "PR_NUMBER=${{ steps.pr_info.outputs.PR_NUMBER }}" + echo "PR_TITLE=${{ steps.pr_info.outputs.PR_TITLE }}" + echo "PR_URL=${{ steps.pr_info.outputs.PR_URL }}" + echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" + echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" + echo "NEW=${{ steps.check_deployment.outputs.NEW }}" + echo "BUILD=${{ github.event.inputs.build == 'true' || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || ( steps.check_deployment.outputs.NEW == 'false' && ( steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || github.event_name == 'push' )) }}" + echo "GITHUB_REF=${{ github.ref }}" comment-pr: needs: [check_pr, get_info] From 196f95a1305eb05d71c4a981dda13067c0ec6a3f Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:00:16 +0000 Subject: [PATCH 05/19] debug --- .github/workflows/pr-deploy.yaml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index c586a21c90e7f..e5f727df4f2ed 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -76,13 +76,17 @@ jobs: BUILD: | ${{ github.event.inputs.build == 'true' || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || ( - steps.check_deployment.outputs.NEW == 'false' && + github.event_name == 'workflow_dispatch' && ( - steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || - github.event_name == 'push' + steps.check_deployment.outputs.NEW == 'true' || + steps.filter.outputs.all_count > steps.filter.outputs.ignored_count ) + ) || + ( + steps.filter.outputs.all_count > steps.filter.outputs.ignored_count && + github.event_name == 'push' && + steps.check_deployment.outputs.NEW == 'false' ) }} @@ -166,18 +170,14 @@ jobs: echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}" echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}" - - name: Print job outputs + - name: Debug run: | set -euo pipefail - # Print all outputs of this job - echo "PR_NUMBER=${{ steps.pr_info.outputs.PR_NUMBER }}" - echo "PR_TITLE=${{ steps.pr_info.outputs.PR_TITLE }}" - echo "PR_URL=${{ steps.pr_info.outputs.PR_URL }}" - echo "CODER_BASE_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }}" - echo "CODER_IMAGE_TAG=${{ steps.set_tags.outputs.CODER_IMAGE_TAG }}" - echo "NEW=${{ steps.check_deployment.outputs.NEW }}" - echo "BUILD=${{ github.event.inputs.build == 'true' || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || ( steps.check_deployment.outputs.NEW == 'false' && ( steps.filter.outputs.all_count > steps.filter.outputs.ignored_count || github.event_name == 'push' )) }}" - echo "GITHUB_REF=${{ github.ref }}" + # Print all inputs of BUILD output + echo "build_input: ${{ github.event.inputs.build }}" + echo "github_event_name: ${{ github.event_name }}" + echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" + echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}" comment-pr: needs: [check_pr, get_info] From 8202fc15347054f8788f11de43d2512ba777de1d Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:05:46 +0000 Subject: [PATCH 06/19] testing --- .github/workflows/pr-deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index e5f727df4f2ed..243b529fa3a09 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -75,18 +75,18 @@ jobs: NEW: ${{ steps.check_deployment.outputs.NEW }} BUILD: | ${{ - github.event.inputs.build == 'true' || + github.event.inputs.build || ( github.event_name == 'workflow_dispatch' && ( - steps.check_deployment.outputs.NEW == 'true' || + steps.check_deployment.outputs.NEW || steps.filter.outputs.all_count > steps.filter.outputs.ignored_count ) ) || ( steps.filter.outputs.all_count > steps.filter.outputs.ignored_count && github.event_name == 'push' && - steps.check_deployment.outputs.NEW == 'false' + !steps.check_deployment.outputs.NEW ) }} From 9866ab0c283828eda31b109513a1b060d5c903ee Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:13:06 +0000 Subject: [PATCH 07/19] testing --- .github/workflows/pr-deploy.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 243b529fa3a09..4fe47c62a11ae 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -178,6 +178,8 @@ jobs: echo "github_event_name: ${{ github.event_name }}" echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}" + # The BUILD f this jon defined abobe using these inputs + echo "BUILD: ${{ github.event.inputs.build || (github.event_name == 'workflow_dispatch' && (steps.check_deployment.outputs.NEW || steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count && github.event_name == 'push' && !steps.check_deployment.outputs.NEW) }}" comment-pr: needs: [check_pr, get_info] From 5c28e369f0cae9e267c97b3bd0be6b4a60a7394a Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:22:22 +0000 Subject: [PATCH 08/19] more tests --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 4fe47c62a11ae..fed3d8dd7572e 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -179,7 +179,7 @@ jobs: echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}" # The BUILD f this jon defined abobe using these inputs - echo "BUILD: ${{ github.event.inputs.build || (github.event_name == 'workflow_dispatch' && (steps.check_deployment.outputs.NEW || steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count && github.event_name == 'push' && !steps.check_deployment.outputs.NEW) }}" + echo "BUILD: ${{ github.event.inputs.build || (github.event_name == 'workflow_dispatch' && (steps.check_deployment.outputs.NEW == 'true' || steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count && github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') }}" comment-pr: needs: [check_pr, get_info] From 3074bf5a1770a1932b8a6e76b1fb32f840e688bf Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:31:24 +0000 Subject: [PATCH 09/19] testing --- .github/workflows/pr-deploy.yaml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index fed3d8dd7572e..3bc986e1b68ea 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -76,18 +76,9 @@ jobs: BUILD: | ${{ github.event.inputs.build || - ( - github.event_name == 'workflow_dispatch' && - ( - steps.check_deployment.outputs.NEW || - steps.filter.outputs.all_count > steps.filter.outputs.ignored_count - ) - ) || - ( - steps.filter.outputs.all_count > steps.filter.outputs.ignored_count && - github.event_name == 'push' && - !steps.check_deployment.outputs.NEW - ) + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || + (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || + (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }} runs-on: "ubuntu-latest" @@ -179,7 +170,13 @@ jobs: echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}" # The BUILD f this jon defined abobe using these inputs - echo "BUILD: ${{ github.event.inputs.build || (github.event_name == 'workflow_dispatch' && (steps.check_deployment.outputs.NEW == 'true' || steps.filter.outputs.all_count > steps.filter.outputs.ignored_count)) || (steps.filter.outputs.all_count > steps.filter.outputs.ignored_count && github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false') }}" + echo "BUILD: | + ${{ + github.event.inputs.build == 'true' || + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || + (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || + (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) + }}" comment-pr: needs: [check_pr, get_info] From c01bb8f15327fe01ff6b0cbee037480b5cf1bfad Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:31:46 +0000 Subject: [PATCH 10/19] testing --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 3bc986e1b68ea..695adc3490686 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -172,7 +172,7 @@ jobs: # The BUILD f this jon defined abobe using these inputs echo "BUILD: | ${{ - github.event.inputs.build == 'true' || + github.event.inputs.build || (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) From 3f6ccc840998183e7a9bc615932fae4e18067948 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:35:00 +0000 Subject: [PATCH 11/19] more testing --- .github/workflows/pr-deploy.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 695adc3490686..f007887e8e068 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -76,9 +76,9 @@ jobs: BUILD: | ${{ github.event.inputs.build || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || - (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || - (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW) || + (github.event_name == 'push' && !steps.check_deployment.outputs.NEW && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || + (!steps.check_deployment.outputs.NEW && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }} runs-on: "ubuntu-latest" @@ -173,9 +173,9 @@ jobs: echo "BUILD: | ${{ github.event.inputs.build || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || - (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || - (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW) || + (github.event_name == 'push' && !steps.check_deployment.outputs.NEW && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || + (!steps.check_deployment.outputs.NEW && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" comment-pr: From d0364da8c1736106f8588962d3b4a1a7b49b1fb9 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:44:31 +0000 Subject: [PATCH 12/19] testing --- .github/workflows/pr-deploy.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index f007887e8e068..fc38420feb2c2 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -76,9 +76,9 @@ jobs: BUILD: | ${{ github.event.inputs.build || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW) || - (github.event_name == 'push' && !steps.check_deployment.outputs.NEW && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || - (!steps.check_deployment.outputs.NEW && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || + (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || + (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }} runs-on: "ubuntu-latest" @@ -168,14 +168,15 @@ jobs: echo "build_input: ${{ github.event.inputs.build }}" echo "github_event_name: ${{ github.event_name }}" echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" + echo "test_condition: ${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }} echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}" # The BUILD f this jon defined abobe using these inputs echo "BUILD: | ${{ github.event.inputs.build || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW) || - (github.event_name == 'push' && !steps.check_deployment.outputs.NEW && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || - (!steps.check_deployment.outputs.NEW && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) + (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || + (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || + (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" comment-pr: From 2a4b888c0d710d1c8dc228724b6a631103372e44 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:45:57 +0000 Subject: [PATCH 13/19] testing --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index fc38420feb2c2..ed5549913b904 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -168,7 +168,7 @@ jobs: echo "build_input: ${{ github.event.inputs.build }}" echo "github_event_name: ${{ github.event_name }}" echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" - echo "test_condition: ${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }} + echo "test_condition: ${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }}" echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}" # The BUILD f this jon defined abobe using these inputs echo "BUILD: | From 4c108c94988ffa656f741973e56351f1d14172fd Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:49:07 +0000 Subject: [PATCH 14/19] testing --- .github/workflows/pr-deploy.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index ed5549913b904..02b31e71d2d1d 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -168,9 +168,11 @@ jobs: echo "build_input: ${{ github.event.inputs.build }}" echo "github_event_name: ${{ github.event_name }}" echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" - echo "test_condition: ${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }}" echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}" - # The BUILD f this jon defined abobe using these inputs + echo "test_condition_1: ${{ github.event.inputs.build }}" + echo "test_condition_2: ${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }}" + echo "test_condition_3: ${{ (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" + echo "test_condition_4: ${{ (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" echo "BUILD: | ${{ github.event.inputs.build || From 066f3ee78900b5c951b3ebdf161936abe41f0080 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:55:37 +0000 Subject: [PATCH 15/19] more tests --- .github/workflows/pr-deploy.yaml | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 02b31e71d2d1d..ee9786cc5779e 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -73,13 +73,7 @@ jobs: CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }} CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }} NEW: ${{ steps.check_deployment.outputs.NEW }} - BUILD: | - ${{ - github.event.inputs.build || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || - (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || - (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) - }} + BUILD: ${{ steps.build_conditionals.outputs.build_condition_1 == 'true' || steps.build_conditionals.outputs.build_condition_2 == 'true' || steps.build_conditionals.outputs.build_condition_3 == 'true' || steps.build_conditionals.outputs.build_condition_4 == 'true' }} runs-on: "ubuntu-latest" steps: @@ -161,25 +155,14 @@ jobs: echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}" echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}" - - name: Debug + - name: Build conditionals + id: build_conditionals run: | set -euo pipefail - # Print all inputs of BUILD output - echo "build_input: ${{ github.event.inputs.build }}" - echo "github_event_name: ${{ github.event_name }}" - echo "files_changed: ${{ steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" - echo "new_deployment: ${{ steps.check_deployment.outputs.NEW }}" - echo "test_condition_1: ${{ github.event.inputs.build }}" - echo "test_condition_2: ${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }}" - echo "test_condition_3: ${{ (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" - echo "test_condition_4: ${{ (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" - echo "BUILD: | - ${{ - github.event.inputs.build || - (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || - (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) || - (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) - }}" + echo "build_condition_1=${{ github.event.inputs.build }}" >> $GITHUB_OUTPUT + echo "build_condition_2=${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }}" >> $GITHUB_OUTPUT + echo "build_condition_3=${{ (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" + echo "build_condition_4=${{ (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" comment-pr: needs: [check_pr, get_info] From ed7744f7e352333e44c6bdf3b80662fd3701ea9c Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 07:57:43 +0000 Subject: [PATCH 16/19] testing --- .github/workflows/pr-deploy.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index ee9786cc5779e..65300294e961c 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -160,9 +160,9 @@ jobs: run: | set -euo pipefail echo "build_condition_1=${{ github.event.inputs.build }}" >> $GITHUB_OUTPUT - echo "build_condition_2=${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') }}" >> $GITHUB_OUTPUT - echo "build_condition_3=${{ (github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" - echo "build_condition_4=${{ (steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count) }}" + echo "build_condition_2=${{ github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true' }}" >> $GITHUB_OUTPUT + echo "build_condition_3=${{ github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT + echo "build_condition_4=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT comment-pr: needs: [check_pr, get_info] From b5ebc203189d47894d463493ddfe20d54f8de177 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 08:03:07 +0000 Subject: [PATCH 17/19] fixed --- .github/workflows/pr-deploy.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 65300294e961c..a44df88ec2ff3 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -73,7 +73,7 @@ jobs: CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }} CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }} NEW: ${{ steps.check_deployment.outputs.NEW }} - BUILD: ${{ steps.build_conditionals.outputs.build_condition_1 == 'true' || steps.build_conditionals.outputs.build_condition_2 == 'true' || steps.build_conditionals.outputs.build_condition_3 == 'true' || steps.build_conditionals.outputs.build_condition_4 == 'true' }} + BUILD: ${{ steps.build_conditionals.outputs.build_condition_1 == 'true' || steps.build_conditionals.outputs.build_condition_2 == 'true' || steps.build_conditionals.outputs.build_condition_3 == 'true' }} runs-on: "ubuntu-latest" steps: @@ -159,10 +159,12 @@ jobs: id: build_conditionals run: | set -euo pipefail + # always build if the workflow is manually triggered with --build flag echo "build_condition_1=${{ github.event.inputs.build }}" >> $GITHUB_OUTPUT + # build if the workflow is manually triggered and the deployment doesn't exist echo "build_condition_2=${{ github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true' }}" >> $GITHUB_OUTPUT - echo "build_condition_3=${{ github.event_name == 'push' && steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT - echo "build_condition_4=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT + # build if the deployment alreday exist and there are changes in the files that we care about (this case covers PR updates) + echo "build_condition_3=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT comment-pr: needs: [check_pr, get_info] From 7b5c86b9a731939c7a5f2edf4fc336b9923071ef Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 08:10:19 +0000 Subject: [PATCH 18/19] simplify --- .github/workflows/pr-deploy.yaml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index a44df88ec2ff3..3db4f4c76aa20 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -73,7 +73,7 @@ jobs: CODER_BASE_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_BASE_IMAGE_TAG }} CODER_IMAGE_TAG: ${{ steps.set_tags.outputs.CODER_IMAGE_TAG }} NEW: ${{ steps.check_deployment.outputs.NEW }} - BUILD: ${{ steps.build_conditionals.outputs.build_condition_1 == 'true' || steps.build_conditionals.outputs.build_condition_2 == 'true' || steps.build_conditionals.outputs.build_condition_3 == 'true' }} + BUILD: ${{ steps.build_conditionals.outputs.first_or_force_build || steps.build_conditionals.outputs.automatic_rebuild }} runs-on: "ubuntu-latest" steps: @@ -159,12 +159,10 @@ jobs: id: build_conditionals run: | set -euo pipefail - # always build if the workflow is manually triggered with --build flag - echo "build_condition_1=${{ github.event.inputs.build }}" >> $GITHUB_OUTPUT - # build if the workflow is manually triggered and the deployment doesn't exist - echo "build_condition_2=${{ github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true' }}" >> $GITHUB_OUTPUT - # build if the deployment alreday exist and there are changes in the files that we care about (this case covers PR updates) - echo "build_condition_3=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT + # build if the workflow is manually triggered and the deployment doesn't exist (first build or force rebuild) + echo "first_or_force_build=${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || github.event.inputs.build }}" >> $GITHUB_OUTPUT + # build if the deployment alreday exist and there are changes in the files that we care about (automatic updates) + echo "automatic_rebuild=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT comment-pr: needs: [check_pr, get_info] From b43924f40ec40cc53eeda60ddd7c0f5743fef5aa Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Sun, 13 Aug 2023 08:13:01 +0000 Subject: [PATCH 19/19] always make true or false --- .github/workflows/pr-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-deploy.yaml b/.github/workflows/pr-deploy.yaml index 3db4f4c76aa20..4dd2446dcc9aa 100644 --- a/.github/workflows/pr-deploy.yaml +++ b/.github/workflows/pr-deploy.yaml @@ -160,7 +160,7 @@ jobs: run: | set -euo pipefail # build if the workflow is manually triggered and the deployment doesn't exist (first build or force rebuild) - echo "first_or_force_build=${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || github.event.inputs.build }}" >> $GITHUB_OUTPUT + echo "first_or_force_build=${{ (github.event_name == 'workflow_dispatch' && steps.check_deployment.outputs.NEW == 'true') || github.event.inputs.build == 'true' }}" >> $GITHUB_OUTPUT # build if the deployment alreday exist and there are changes in the files that we care about (automatic updates) echo "automatic_rebuild=${{ steps.check_deployment.outputs.NEW == 'false' && steps.filter.outputs.all_count > steps.filter.outputs.ignored_count }}" >> $GITHUB_OUTPUT