From ab921b6eed092c94fd483b7428fe35d9458c5e83 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Mon, 26 Sep 2022 15:32:06 -0700 Subject: [PATCH 01/11] Only test Java for CLI v2.5+ --- ...ment.yml => unset-environment-new-cli.yml} | 11 +-- .../workflows/unset-environment-old-cli.yml | 80 +++++++++++++++++++ pr-checks/checks/unset-environment.yml | 49 ------------ 3 files changed, 81 insertions(+), 59 deletions(-) rename .github/workflows/{__unset-environment.yml => unset-environment-new-cli.yml} (88%) create mode 100644 .github/workflows/unset-environment-old-cli.yml delete mode 100644 pr-checks/checks/unset-environment.yml diff --git a/.github/workflows/__unset-environment.yml b/.github/workflows/unset-environment-new-cli.yml similarity index 88% rename from .github/workflows/__unset-environment.yml rename to .github/workflows/unset-environment-new-cli.yml index 23d6ad2550..461e0dd9cb 100644 --- a/.github/workflows/__unset-environment.yml +++ b/.github/workflows/unset-environment-new-cli.yml @@ -1,9 +1,4 @@ -# Warning: This file is generated automatically, and should not be modified. -# Instead, please modify the template in the pr-checks directory and run: -# pip install ruamel.yaml && python3 sync.py -# to regenerate this file. - -name: PR Check - Test unsetting environment variables +name: PR Check - Test unsetting environment variables for CLI version > 2.5 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto @@ -25,10 +20,6 @@ jobs: strategy: matrix: include: - - os: ubuntu-latest - version: stable-20210308 - - os: ubuntu-latest - version: stable-20210319 - os: ubuntu-latest version: stable-20210809 - os: ubuntu-latest diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml new file mode 100644 index 0000000000..111452dd84 --- /dev/null +++ b/.github/workflows/unset-environment-old-cli.yml @@ -0,0 +1,80 @@ +name: PR Check - Test unsetting environment variables for CLI version < 2.5 +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GO111MODULE: auto +on: + push: + branches: + - main + - releases/v1 + - releases/v2 + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + workflow_dispatch: {} +jobs: + unset-environment: + strategy: + matrix: + include: + - os: ubuntu-latest + version: stable-20210308 + - os: ubuntu-latest + version: stable-20210319 + name: Test unsetting environment variables + timeout-minutes: 45 + runs-on: ${{ matrix.os }} + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Prepare test + id: prepare-test + uses: ./.github/prepare-test + with: + version: ${{ matrix.version }} + - uses: ./../action/init + with: + languages: csharp,cpp,go,javascript,python + db-location: ${{ runner.temp }}/customDbLocation + tools: ${{ steps.prepare-test.outputs.tools-url }} + env: + TEST_MODE: true + - name: Build code + shell: bash + run: env -i PATH="$PATH" HOME="$HOME" ./build.sh + - uses: ./../action/analyze + id: analysis + env: + TEST_MODE: true + - shell: bash + run: | + CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} + if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for CPP, or created it in the wrong location." + exit 1 + fi + CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }} + if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for C Sharp, or created it in the wrong location." + exit 1 + fi + GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }} + if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for Go, or created it in the wrong location." + exit 1 + fi + JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }} + if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for Javascript, or created it in the wrong location." + exit 1 + fi + PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }} + if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then + echo "Did not create a database for Python, or created it in the wrong location." + exit 1 + fi + env: + INTERNAL_CODEQL_ACTION_DEBUG_LOC: true diff --git a/pr-checks/checks/unset-environment.yml b/pr-checks/checks/unset-environment.yml deleted file mode 100644 index f5d03e0291..0000000000 --- a/pr-checks/checks/unset-environment.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: "Test unsetting environment variables" -description: "An end-to-end integration test that unsets some environment variables" -os: ["ubuntu-latest"] -steps: - - uses: ./../action/init - with: - db-location: "${{ runner.temp }}/customDbLocation" - tools: ${{ steps.prepare-test.outputs.tools-url }} - env: - TEST_MODE: true - - name: Build code - shell: bash - run: env -i PATH="$PATH" HOME="$HOME" ./build.sh - - uses: ./../action/analyze - id: analysis - env: - TEST_MODE: true - - shell: bash - run: | - CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} - if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for CPP, or created it in the wrong location." - exit 1 - fi - CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }} - if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for C Sharp, or created it in the wrong location." - exit 1 - fi - GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }} - if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Go, or created it in the wrong location." - exit 1 - fi - JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }} - if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Java, or created it in the wrong location." - exit 1 - fi - JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }} - if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Javascript, or created it in the wrong location." - exit 1 - fi - PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }} - if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Python, or created it in the wrong location." - exit 1 - fi From 81e0392571fdf413c1d27b3a2ae5cf7447871a46 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 10:14:48 -0700 Subject: [PATCH 02/11] Add explanation in PR check comment --- .github/workflows/unset-environment-new-cli.yml | 3 ++- .github/workflows/unset-environment-old-cli.yml | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unset-environment-new-cli.yml b/.github/workflows/unset-environment-new-cli.yml index 461e0dd9cb..6b5c7bfe9a 100644 --- a/.github/workflows/unset-environment-new-cli.yml +++ b/.github/workflows/unset-environment-new-cli.yml @@ -1,4 +1,5 @@ -name: PR Check - Test unsetting environment variables for CLI version > 2.5 +# See `unset-environment-old-cli.yml` for reasoning behind the separate tests. +name: PR Check - Test unsetting environment variables for CLI version >= 2.5.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index 111452dd84..96ed76a9c1 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -1,4 +1,8 @@ -name: PR Check - Test unsetting environment variables for CLI version < 2.5 +# There was a bug, fixed in CLI v2.5.1, that didn't propagate environment +# variables that the Java tracer needed. Here we test all languages +# except Java for these CLI versions. In `unset-environment-new-cli.yml` +# we test all languages for recent CLI versions. +name: PR Check - Test unsetting environment variables for CLI version < 2.5.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GO111MODULE: auto From 2bdcdfe50b6cc3dbdf3940993069906afe1c6196 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 10:46:42 -0700 Subject: [PATCH 03/11] Improve bash code style --- .../workflows/unset-environment-new-cli.yml | 42 +++++++++++-------- .../workflows/unset-environment-old-cli.yml | 35 +++++++++------- 2 files changed, 44 insertions(+), 33 deletions(-) diff --git a/.github/workflows/unset-environment-new-cli.yml b/.github/workflows/unset-environment-new-cli.yml index 6b5c7bfe9a..7d125d96b2 100644 --- a/.github/workflows/unset-environment-new-cli.yml +++ b/.github/workflows/unset-environment-new-cli.yml @@ -55,34 +55,40 @@ jobs: TEST_MODE: true - shell: bash run: | - CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} - if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for CPP, or created it in the wrong location." + CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for CPP, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CPP_DB }'" exit 1 fi - CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }} - if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for C Sharp, or created it in the wrong location." + CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for C Sharp, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CSHARP_DB }'" exit 1 fi - GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }} - if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Go, or created it in the wrong location." + GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${{ runner.temp }}/customDbLocation/*"" ]]; then + echo "Did not create a database for Go, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ GO_DB }'" exit 1 fi - JAVA_DB=${{ fromJson(steps.analysis.outputs.db-locations).java }} - if [[ ! -d $JAVA_DB ]] || [[ ! $JAVA_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Java, or created it in the wrong location." + JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}" + if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for Java, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVA_DB }'" exit 1 fi - JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }} - if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Javascript, or created it in the wrong location." + JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for Javascript, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVASCRIPT_DB }'" exit 1 fi - PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }} - if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Python, or created it in the wrong location." + PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for Python, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ PYTHON_DB }'" exit 1 fi env: diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index 96ed76a9c1..fa69427a0e 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -55,29 +55,34 @@ jobs: TEST_MODE: true - shell: bash run: | - CPP_DB=${{ fromJson(steps.analysis.outputs.db-locations).cpp }} - if [[ ! -d $CPP_DB ]] || [[ ! $CPP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for CPP, or created it in the wrong location." + CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for CPP, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CPP_DB }'" exit 1 fi - CSHARP_DB=${{ fromJson(steps.analysis.outputs.db-locations).csharp }} - if [[ ! -d $CSHARP_DB ]] || [[ ! $CSHARP_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for C Sharp, or created it in the wrong location." + CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for C Sharp, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CSHARP_DB }'" exit 1 fi - GO_DB=${{ fromJson(steps.analysis.outputs.db-locations).go }} - if [[ ! -d $GO_DB ]] || [[ ! $GO_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Go, or created it in the wrong location." + GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for Go, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ GO_DB }'" exit 1 fi - JAVASCRIPT_DB=${{ fromJson(steps.analysis.outputs.db-locations).javascript }} - if [[ ! -d $JAVASCRIPT_DB ]] || [[ ! $JAVASCRIPT_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Javascript, or created it in the wrong location." + JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for Javascript, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVASCRIPT_DB }'" exit 1 fi - PYTHON_DB=${{ fromJson(steps.analysis.outputs.db-locations).python }} - if [[ ! -d $PYTHON_DB ]] || [[ ! $PYTHON_DB == ${{ runner.temp }}/customDbLocation/* ]]; then - echo "Did not create a database for Python, or created it in the wrong location." + PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + echo "Did not create a database for Python, or created it in the wrong location." \ + "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ PYTHON_DB }'" exit 1 fi env: From 50fd69b9cd25a0b66dae1febcaad4c13735176e1 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 11:00:53 -0700 Subject: [PATCH 04/11] Bash syntax fixups --- .../workflows/unset-environment-new-cli.yml | 24 +++++++++---------- .../workflows/unset-environment-old-cli.yml | 20 ++++++++-------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/unset-environment-new-cli.yml b/.github/workflows/unset-environment-new-cli.yml index 7d125d96b2..1aa319c3a8 100644 --- a/.github/workflows/unset-environment-new-cli.yml +++ b/.github/workflows/unset-environment-new-cli.yml @@ -56,39 +56,39 @@ jobs: - shell: bash run: | CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" - if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for CPP, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CPP_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" - if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for C Sharp, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CSHARP_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CSHARP_DB}'" exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${{ runner.temp }}/customDbLocation/*"" ]]; then + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "$${RUNNER_TEMP}/customDbLocation/*"" ]]; then echo "Did not create a database for Go, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ GO_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" exit 1 fi JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}" - if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for Java, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVA_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVA_DB}'" exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" - if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for Javascript, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVASCRIPT_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" exit 1 fi PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" - if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for Python, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ PYTHON_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${PYTHON_DB}'" exit 1 fi env: diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index fa69427a0e..15a119ae33 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -56,33 +56,33 @@ jobs: - shell: bash run: | CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" - if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for CPP, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CPP_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" - if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for C Sharp, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ CSHARP_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CSHARP_DB}'" exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "$${RUNNER_TEMP}/customDbLocation/*"" ]]; then echo "Did not create a database for Go, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ GO_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" - if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for Javascript, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ JAVASCRIPT_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" exit 1 fi PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" - if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${{ runner.temp }}/customDbLocation/*" ]]; then + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for Python, or created it in the wrong location." \ - "Expected location was '${ runner.temp }'/customDbLocation/* but actual was '${ PYTHON_DB }'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${PYTHON_DB}'" exit 1 fi env: From bf48a18024ca851eb5e78c6858b229a509f652cb Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 11:58:20 -0700 Subject: [PATCH 05/11] Fix typo --- .github/workflows/unset-environment-old-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index 15a119ae33..de27d9b494 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -68,7 +68,7 @@ jobs: exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "$${RUNNER_TEMP}/customDbLocation/*"" ]]; then + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/*"" ]]; then echo "Did not create a database for Go, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" exit 1 From d22437240a0faf4d441c8141a2772e36655e4347 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 12:00:16 -0700 Subject: [PATCH 06/11] Print variables for debugging --- .github/workflows/unset-environment-old-cli.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index de27d9b494..c48eeb5537 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -58,7 +58,10 @@ jobs: CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for CPP, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" \ + "RUNNER_TEMP is '${RUNNER_TEMP}'" \ + "{runner.temp} is '${{ runner.temp }}'" \ + "CPP_DB" is '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" From 8374a4e64aca599fac729d4a6aa89db8b08091a5 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 12:15:33 -0700 Subject: [PATCH 07/11] Fix more bash typos --- .github/workflows/unset-environment-old-cli.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index c48eeb5537..7d128534c1 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -61,7 +61,7 @@ jobs: "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" \ "RUNNER_TEMP is '${RUNNER_TEMP}'" \ "{runner.temp} is '${{ runner.temp }}'" \ - "CPP_DB" is '${CPP_DB}'" + "CPP_DB is '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" @@ -71,7 +71,7 @@ jobs: exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/*"" ]]; then + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then echo "Did not create a database for Go, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" exit 1 From 80249381244afa36ff3a943a10371be7eb719bc9 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 12:28:37 -0700 Subject: [PATCH 08/11] Fix bash syntax bugs --- .github/workflows/unset-environment-new-cli.yml | 12 ++++++------ .github/workflows/unset-environment-old-cli.yml | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/unset-environment-new-cli.yml b/.github/workflows/unset-environment-new-cli.yml index 1aa319c3a8..fe3258fa31 100644 --- a/.github/workflows/unset-environment-new-cli.yml +++ b/.github/workflows/unset-environment-new-cli.yml @@ -56,37 +56,37 @@ jobs: - shell: bash run: | CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" - if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for CPP, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" - if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for C Sharp, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CSHARP_DB}'" exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "$${RUNNER_TEMP}/customDbLocation/*"" ]]; then + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for Go, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" exit 1 fi JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}" - if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for Java, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVA_DB}'" exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" - if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/"*]]; then echo "Did not create a database for Javascript, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" exit 1 fi PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" - if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for Python, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${PYTHON_DB}'" exit 1 diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index 7d128534c1..d7bdc46e91 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -56,7 +56,7 @@ jobs: - shell: bash run: | CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" - if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for CPP, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" \ "RUNNER_TEMP is '${RUNNER_TEMP}'" \ @@ -65,25 +65,25 @@ jobs: exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" - if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for C Sharp, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CSHARP_DB}'" exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for Go, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" - if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for Javascript, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" exit 1 fi PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" - if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/*" ]]; then + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "Did not create a database for Python, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${PYTHON_DB}'" exit 1 From 231835db370d22d8ed6a76bc6bb136eb40c789a3 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 12:31:32 -0700 Subject: [PATCH 09/11] Set Actions error messages --- .github/workflows/unset-environment-new-cli.yml | 12 ++++++------ .github/workflows/unset-environment-old-cli.yml | 15 ++++++--------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/unset-environment-new-cli.yml b/.github/workflows/unset-environment-new-cli.yml index fe3258fa31..e86f529a46 100644 --- a/.github/workflows/unset-environment-new-cli.yml +++ b/.github/workflows/unset-environment-new-cli.yml @@ -57,37 +57,37 @@ jobs: run: | CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for CPP, or created it in the wrong location." \ + echo "::error::Did not create a database for CPP, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for C Sharp, or created it in the wrong location." \ + echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CSHARP_DB}'" exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for Go, or created it in the wrong location." \ + echo "::error::Did not create a database for Go, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" exit 1 fi JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}" if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for Java, or created it in the wrong location." \ + echo "::error::Did not create a database for Java, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVA_DB}'" exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/"*]]; then - echo "Did not create a database for Javascript, or created it in the wrong location." \ + echo "::error::Did not create a database for Javascript, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" exit 1 fi PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for Python, or created it in the wrong location." \ + echo "::error::Did not create a database for Python, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${PYTHON_DB}'" exit 1 fi diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index d7bdc46e91..f26bbee3b2 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -57,34 +57,31 @@ jobs: run: | CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for CPP, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" \ - "RUNNER_TEMP is '${RUNNER_TEMP}'" \ - "{runner.temp} is '${{ runner.temp }}'" \ - "CPP_DB is '${CPP_DB}'" + echo "::error::Did not create a database for CPP, or created it in the wrong location." \ + "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for C Sharp, or created it in the wrong location." \ + echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CSHARP_DB}'" exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for Go, or created it in the wrong location." \ + echo "::error::Did not create a database for Go, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for Javascript, or created it in the wrong location." \ + echo "::error::Did not create a database for Javascript, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" exit 1 fi PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then - echo "Did not create a database for Python, or created it in the wrong location." \ + echo "::error::Did not create a database for Python, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${PYTHON_DB}'" exit 1 fi From e161371f4e8e268baf70d1e78a43aabf556eeeb0 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 12:46:59 -0700 Subject: [PATCH 10/11] Add whitespace Co-authored-by: Andrew Eisenberg --- .github/workflows/unset-environment-new-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unset-environment-new-cli.yml b/.github/workflows/unset-environment-new-cli.yml index e86f529a46..3ab59121a2 100644 --- a/.github/workflows/unset-environment-new-cli.yml +++ b/.github/workflows/unset-environment-new-cli.yml @@ -80,7 +80,7 @@ jobs: exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" - if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/"*]]; then + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then echo "::error::Did not create a database for Javascript, or created it in the wrong location." \ "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" exit 1 From 9d42ae7022664b38d360f8e4cd9549c547776d15 Mon Sep 17 00:00:00 2001 From: Angela P Wen Date: Tue, 27 Sep 2022 14:50:31 -0700 Subject: [PATCH 11/11] Replace `*` matching in bash script --- .../workflows/unset-environment-new-cli.yml | 24 +++++++++---------- .../workflows/unset-environment-old-cli.yml | 20 ++++++++-------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/unset-environment-new-cli.yml b/.github/workflows/unset-environment-new-cli.yml index 3ab59121a2..39da1b36c6 100644 --- a/.github/workflows/unset-environment-new-cli.yml +++ b/.github/workflows/unset-environment-new-cli.yml @@ -56,39 +56,39 @@ jobs: - shell: bash run: | CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" - if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then echo "::error::Did not create a database for CPP, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" - if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CSHARP_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'" exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then echo "::error::Did not create a database for Go, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'" exit 1 fi JAVA_DB="${{ fromJson(steps.analysis.outputs.db-locations).java }}" - if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$JAVA_DB" ]] || [[ ! "$JAVA_DB" == "${RUNNER_TEMP}/customDbLocation/java" ]]; then echo "::error::Did not create a database for Java, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVA_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/java' but actual was '${JAVA_DB}'" exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" - if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then echo "::error::Did not create a database for Javascript, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'" exit 1 fi PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" - if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then echo "::error::Did not create a database for Python, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${PYTHON_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'" exit 1 fi env: diff --git a/.github/workflows/unset-environment-old-cli.yml b/.github/workflows/unset-environment-old-cli.yml index f26bbee3b2..281ced054c 100644 --- a/.github/workflows/unset-environment-old-cli.yml +++ b/.github/workflows/unset-environment-old-cli.yml @@ -56,33 +56,33 @@ jobs: - shell: bash run: | CPP_DB="${{ fromJson(steps.analysis.outputs.db-locations).cpp }}" - if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$CPP_DB" ]] || [[ ! "$CPP_DB" == "${RUNNER_TEMP}/customDbLocation/cpp" ]]; then echo "::error::Did not create a database for CPP, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CPP_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/cpp' but actual was '${CPP_DB}'" exit 1 fi CSHARP_DB="${{ fromJson(steps.analysis.outputs.db-locations).csharp }}" - if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$CSHARP_DB" ]] || [[ ! "$CSHARP_DB" == "${RUNNER_TEMP}/customDbLocation/csharp" ]]; then echo "::error::Did not create a database for C Sharp, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${CSHARP_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/csharp' but actual was '${CSHARP_DB}'" exit 1 fi GO_DB="${{ fromJson(steps.analysis.outputs.db-locations).go }}" - if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$GO_DB" ]] || [[ ! "$GO_DB" == "${RUNNER_TEMP}/customDbLocation/go" ]]; then echo "::error::Did not create a database for Go, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${GO_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/go' but actual was '${GO_DB}'" exit 1 fi JAVASCRIPT_DB="${{ fromJson(steps.analysis.outputs.db-locations).javascript }}" - if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$JAVASCRIPT_DB" ]] || [[ ! "$JAVASCRIPT_DB" == "${RUNNER_TEMP}/customDbLocation/javascript" ]]; then echo "::error::Did not create a database for Javascript, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${JAVASCRIPT_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/javascript' but actual was '${JAVASCRIPT_DB}'" exit 1 fi PYTHON_DB="${{ fromJson(steps.analysis.outputs.db-locations).python }}" - if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/"* ]]; then + if [[ ! -d "$PYTHON_DB" ]] || [[ ! "$PYTHON_DB" == "${RUNNER_TEMP}/customDbLocation/python" ]]; then echo "::error::Did not create a database for Python, or created it in the wrong location." \ - "Expected location was '${RUNNER_TEMP}/customDbLocation/*' but actual was '${PYTHON_DB}'" + "Expected location was '${RUNNER_TEMP}/customDbLocation/python' but actual was '${PYTHON_DB}'" exit 1 fi env: