From 6a08c5797db3ca4869334ce991f9cc624974d52b Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Thu, 20 Jun 2024 15:28:44 -0700 Subject: [PATCH 01/14] Created e2etest.yaml Used the existing file template from this PR: https://github.com/EVerest/everest-demo/pull/23 -------- Currently testing only with ubuntu-latest OS. The demo scripts used are: - demo-automated-testing.sh I have commented out the existing /demo-iso15118-2-ac-plus-ocpp201.sh since as per the Readme.md it requires arguments to be passed and I am unsure which set of arguments need to be passed for the purpose of the workflow. https://github.com/EVerest/everest-demo#step-1-run-the-demo ----- Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/e2etest.yaml diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml new file mode 100644 index 00000000..0ca6dcf0 --- /dev/null +++ b/.github/workflows/e2etest.yaml @@ -0,0 +1,47 @@ +name: e2etest + +on: + pull_request: + branches: + - main + push: + branches: + - main + + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '5 4 * * *' + +jobs: + pull-and-run-tests: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + # os: [macos-latest] + os: [ubuntu-latest] + + steps: + - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew. + id: docker-install + if: matrix.os == 'macos-latest' + uses: douglascamata/setup-docker-macos-action@v1-alpha # Uses an action in the root directory + + - name: Verify install for both macOS and Ubuntu + id: docker-verify + shell: bash + run: | + docker --version + docker compose version + if [ "$RUNNER_OS" == "macOS" ]; then + colima --version + mkdir -p /var/folders + + - name: Download and launch automated-testing.sh + id: curl-download-and-launch-automated-testing + shell: bash + timeout-minutes: 30 + run: | + curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-automated-testing.sh | bash + # curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-ac-plus-ocpp201.sh | bash + \ No newline at end of file From 8c76a63c2fa05977752a9d11fcaac5545b3fac42 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Thu, 20 Jun 2024 15:42:51 -0700 Subject: [PATCH 02/14] Changed branches to run workflow on Not running on main since I will be making code pushes to my feature-branch: automate-tests-actions. Also, created a new branch automate-tests-merge that will be used to test workflow runs whenever a PR is created. This will simulate creating a PR for merging code changes into main in the parent repo. Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index 0ca6dcf0..92946871 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -2,11 +2,9 @@ name: e2etest on: pull_request: - branches: - - main + branches: [ automate-tests-merge ] push: - branches: - - main + branches: [ automate-tests-actions, automate-tests-merge ] schedule: # * is a special character in YAML so you have to quote this string From 729d4b517217ef467ca330feac3ac86efdc31f12 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Thu, 20 Jun 2024 15:47:03 -0700 Subject: [PATCH 03/14] Added 'fi' to end if block in run command Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index 92946871..08b87525 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -34,6 +34,7 @@ jobs: if [ "$RUNNER_OS" == "macOS" ]; then colima --version mkdir -p /var/folders + fi - name: Download and launch automated-testing.sh id: curl-download-and-launch-automated-testing From 387daf087d3fe658de0653fab177f73727c1d362 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Fri, 21 Jun 2024 10:23:15 -0700 Subject: [PATCH 04/14] Adding macos OS to matrix.os list Trying out workflow execution for both Ubuntu and MacOS. Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index 08b87525..0aef4ccb 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -17,7 +17,7 @@ jobs: strategy: matrix: # os: [macos-latest] - os: [ubuntu-latest] + os: [ubuntu-latest, macos-latest] steps: - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew. From 6c45589e8fc62c8481a2afa15b4940e425ea2cbd Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Fri, 21 Jun 2024 13:08:32 -0700 Subject: [PATCH 05/14] Changed macOS version + Added fail-fast property to matrix strategy The macOS job was failing as the docker setup action is not suited for macOS ARM64 based images. https://github.com/douglascamata/setup-docker-macos-action?tab=readme-ov-file#arm64-processors-m1-m2-m3-series-used-on-macos-14-images-are-unsupported Hence, now using "macos-latest-large" (macOS 14 as of this commit) image as per the official runner images here: https://github.com/actions/runner-images/tree/main ----------- Also, this failure led to that specific job failing and all other jobs being cancelled including the job for ubuntu OS due to the "fail-fast" property being set to true as default. Hence to allow other jobs to go through, setting the fail-fast property to false: - https://github.com/orgs/community/discussions/27192#discussioncomment-3254964 - https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index 0aef4ccb..ba283aed 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -15,9 +15,10 @@ jobs: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: # os: [macos-latest] - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest-large] steps: - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew. From 6d014355b9b3c08fd744df2cd1e7ba4acd6cbeb5 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Fri, 21 Jun 2024 13:13:18 -0700 Subject: [PATCH 06/14] Changed macOS to version 13 The run failed again but not due to ARM64 architecture but probably due to macos-14 not supported by GitHub action. The GitHub action for docker setup on MacOS mentions that only macos-12 and macos-13 versions are supported: https://github.com/douglascamata/setup-docker-macos-action#currently-supported-public-runner-images Hence, trying to change macOS to version 13 now. Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index ba283aed..e85fd2bf 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: # os: [macos-latest] - os: [ubuntu-latest, macos-latest-large] + os: [ubuntu-latest, macos-13] steps: - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew. From bd593a1d19be7159e47d46fe9ec4a52cfa2292b2 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Fri, 21 Jun 2024 13:27:08 -0700 Subject: [PATCH 07/14] Add a step to print outputs from docker setup GitHub action for MacOS Previous run failed yet again at the docker-verify state with error: ``` shell: /bin/bash --noprofile --norc -e -o pipefail {0} /Users/runner/work/_temp/f2669228-43bc-4f11-9c38-82bd32c1e3b4.sh: line 1: docker: command not found Error: Process completed with exit code 127. ``` Hence printing outputs as mentioned in the action Readme.md. ----- Ah! I see the step to install from the docker action was skipped as I had missed changing the macos version to v 13 in the if condition. Let's see if it works now. Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index e85fd2bf..f7d55f12 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -17,14 +17,19 @@ jobs: strategy: fail-fast: false matrix: - # os: [macos-latest] os: [ubuntu-latest, macos-13] steps: - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew. id: docker-install - if: matrix.os == 'macos-latest' + if: matrix.os == 'macos-13' uses: douglascamata/setup-docker-macos-action@v1-alpha # Uses an action in the root directory + + - name: Print action outputs containing docker version + id: print-outputs + run: | + echo "Docker client version: ${{ steps.docker-install.outputs.docker-client-version}}" + echo "Docker compose version: ${{ steps.docker-install.outputs.docker-compose-version}}" - name: Verify install for both macOS and Ubuntu id: docker-verify From 9ce30abf030c207e2c437996a0a5f7b2d5d5a3b9 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Fri, 21 Jun 2024 14:02:15 -0700 Subject: [PATCH 08/14] Increasing timeout to 60 minutes MacOS docker setup passed finally. Increasing the timeout since the Downloading and Extracting steps themselves have taken about 20 minutes in the macOS runner. But right now even for the demo-automated-tests.sh on MacOS its taking close to 30 minutes just for the download + extraction to complete. As seen in the commit history, when Shankari changed the timeout to 30 minutes, it was because the demo-iso15118-2-ac script itself was taking close to 30 minutes. https://github.com/EVerest/everest-demo/pull/23/commits/05528d4e76c1dc69f764bfb83459c88624613d3c Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index f7d55f12..e65f80ff 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -24,12 +24,6 @@ jobs: id: docker-install if: matrix.os == 'macos-13' uses: douglascamata/setup-docker-macos-action@v1-alpha # Uses an action in the root directory - - - name: Print action outputs containing docker version - id: print-outputs - run: | - echo "Docker client version: ${{ steps.docker-install.outputs.docker-client-version}}" - echo "Docker compose version: ${{ steps.docker-install.outputs.docker-compose-version}}" - name: Verify install for both macOS and Ubuntu id: docker-verify @@ -45,7 +39,7 @@ jobs: - name: Download and launch automated-testing.sh id: curl-download-and-launch-automated-testing shell: bash - timeout-minutes: 30 + timeout-minutes: 60 run: | curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-automated-testing.sh | bash # curl https://raw.githubusercontent.com/everest/everest-demo/main/demo-iso15118-2-ac-plus-ocpp201.sh | bash From 027cba7994c3ced0265fd3d85f5930c0b1fe69a1 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Fri, 21 Jun 2024 23:17:31 -0700 Subject: [PATCH 09/14] Adding workflow_dispatch event trigger In cicd.yaml: - Added my feature branches as well to test triggering of workflows during development. Added a TODO to remove these later. - Commented outsteps of docker-build-and-push-images job since it would fail if version TAG is unchanged from existing pushed image. - Added a POST request to trigger workflow_dispatch to e2etest.yml via GitHub REST API. In e2etest.yml: - Set the trigger to only workflow_dispatch and removed push, pull_request triggers since we want the tests to run on the latest pushed images only which will happen when first workflow completes successfully. - But also to note that the first workflow pushes image only on certain conditions. - Need to handle this as well. - For now, I've done this by checking if event type is not PR (same check done in cicd.yaml). Detailed discussion on this in PR for this development. Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/cicd.yaml | 165 ++++++++++++++++++--------------- .github/workflows/e2etest.yaml | 20 +++- 2 files changed, 107 insertions(+), 78 deletions(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 9ed5de47..5aa32cb3 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -1,12 +1,11 @@ name: cicd on: + # TODO: Remove [automate-tests-actions, automate-tests-merge] branch once changes are final pull_request: - branches: - - main + branches: [ main, automate-tests-merge ] push: - branches: - - main + branches: [ main, automate-tests-actions, automate-tests-merge ] tags: - 'v[0-9]+.[0-9]+.[0-9]+' @@ -31,75 +30,93 @@ jobs: image_name: nodered context: ./nodered + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + + # - name: Ensure Docker image version is not referencing an existing release + # id: docker-image-version-check + # shell: bash + # run: | + # if ! [[ -s '.env' ]]; then + # echo 'Error: No .env file found.' + # exit 1 + # fi + + # if ! grep -qE '^TAG=' .env; then + # echo 'Error: .env must contain a TAG variable.' + # exit 1 + # fi + + # source .env + + # # Fail if any previous Docker image version value matches the one in + # # this PR (excluding the current image version). + # for commit in $(git --no-pager log --first-parent --format=%H -- .env | tail -n +2); do + # if git --no-pager grep -hF "${TAG}" $commit -- .env | grep -qx ${TAG}; then + # echo 'Error: The version in .env matches an' + # echo ' earlier version on main. Please update the value in' + # echo ' .env to a new version.' + # exit 1 + # fi + # done + + # if git show-ref --tags --verify --quiet "refs/tags/v${TAG}"; then + # echo "Error: The tag 'v${TAG}' is already a GitHub release." + # echo ' Please update the version in .env' + # exit 1 + # else + # echo "TAG=${TAG}" >> "${GITHUB_OUTPUT}" + # fi + + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 + + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 + + # - name: Set Docker image metadata + # id: meta + # uses: docker/metadata-action@v5 + # with: + # images: ${{ matrix.host_namespace }}/${{ matrix.image_name }} + # tags: | + # type=semver,pattern={{version}},value=v${{ steps.docker-image-version-check.outputs.TAG }} + + # - name: Log into GitHub container registry + # if: github.event_name != 'pull_request' + # uses: docker/login-action@v3 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GITHUB_TOKEN }} + + # - name: Build and push + # uses: docker/build-push-action@v5 + # with: + # context: ${{ matrix.context }} + # push: ${{ github.event_name != 'pull_request' }} + # tags: ${{ steps.meta.outputs.tags }} + # labels: ${{ steps.meta.outputs.labels }} + # cache-from: type=gha,scope=${{ matrix.image_name }} + # cache-to: type=gha,mode=max,scope=${{ matrix.image_name }} + + dispatch: + needs: docker-build-and-push-images + runs-on: ubuntu-latest + steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Ensure Docker image version is not referencing an existing release - id: docker-image-version-check - shell: bash + + - name: Trigger e2etest workflow + # TODO: Change repo owner from MukuFlash03 to EVerest; branch ref to main; once changes are final run: | - if ! [[ -s '.env' ]]; then - echo 'Error: No .env file found.' - exit 1 - fi - - if ! grep -qE '^TAG=' .env; then - echo 'Error: .env must contain a TAG variable.' - exit 1 - fi - - source .env - - # Fail if any previous Docker image version value matches the one in - # this PR (excluding the current image version). - for commit in $(git --no-pager log --first-parent --format=%H -- .env | tail -n +2); do - if git --no-pager grep -hF "${TAG}" $commit -- .env | grep -qx ${TAG}; then - echo 'Error: The version in .env matches an' - echo ' earlier version on main. Please update the value in' - echo ' .env to a new version.' - exit 1 - fi - done - - if git show-ref --tags --verify --quiet "refs/tags/v${TAG}"; then - echo "Error: The tag 'v${TAG}' is already a GitHub release." - echo ' Please update the version in .env' - exit 1 - else - echo "TAG=${TAG}" >> "${GITHUB_OUTPUT}" - fi - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Set Docker image metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ matrix.host_namespace }}/${{ matrix.image_name }} - tags: | - type=semver,pattern={{version}},value=v${{ steps.docker-image-version-check.outputs.TAG }} - - - name: Log into GitHub container registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: ${{ matrix.context }} - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha,scope=${{ matrix.image_name }} - cache-to: type=gha,mode=max,scope=${{ matrix.image_name }} + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/MukuFlash03/everest-demo/actions/workflows/e2etest.yaml/dispatches \ + -d '{"ref":"automate-tests-actions", "inputs": {"parent_workflow": "cicd.yaml", }}' + -d '{"ref":"automate-tests-actions", "inputs": {"parent_workflow": "cicd.yaml", "event_name": "${{ github.event_name }}" }}' diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index e65f80ff..80afd988 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -1,10 +1,15 @@ name: e2etest on: - pull_request: - branches: [ automate-tests-merge ] - push: - branches: [ automate-tests-actions, automate-tests-merge ] + # Adding this to indicate that this workflow will be triggered from another workflow + workflow_dispatch: + inputs: + parent_workflow: + description: "Name of the parent workflow that triggered this workflow" + required: true + event_name: + description: "Type of event that triggered this workflow (e.g. push, pull_request)" + required: true schedule: # * is a special character in YAML so you have to quote this string @@ -12,6 +17,7 @@ on: jobs: pull-and-run-tests: + if: github.event.inputs.parent_workflow == 'cicd.yaml' && github.event.inputs.event_name != 'pull_request' runs-on: ${{ matrix.os }} strategy: @@ -20,6 +26,12 @@ jobs: os: [ubuntu-latest, macos-13] steps: + + - name: Verify parent workflow name + id: verify-parent-workflow + run: | + echo "Workflow triggered by parent workflow: ${{ github.event.inputs.parent_workflow }}" + - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew. id: docker-install if: matrix.os == 'macos-13' From 0db1117f44394c36f95b33fe37f76122ba2876c5 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Fri, 21 Jun 2024 23:27:15 -0700 Subject: [PATCH 10/14] Added temporary step to ensure workflow doesn't fail Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/cicd.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 5aa32cb3..d7313f27 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -30,7 +30,11 @@ jobs: image_name: nodered context: ./nodered - # steps: + steps: + - name: Temporary step to pass the job + id: temporary-step + run: echo "Temporary step to ensure the job completes and workflow doesn't fail" + # - name: Checkout # uses: actions/checkout@v4 # with: From cf5c9758dfb6801205fe3602ef87d88b57be2b3f Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Fri, 21 Jun 2024 23:28:22 -0700 Subject: [PATCH 11/14] Corrected curl POST request Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/cicd.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index d7313f27..bcfdf2a5 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -122,5 +122,4 @@ jobs: -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/repos/MukuFlash03/everest-demo/actions/workflows/e2etest.yaml/dispatches \ - -d '{"ref":"automate-tests-actions", "inputs": {"parent_workflow": "cicd.yaml", }}' -d '{"ref":"automate-tests-actions", "inputs": {"parent_workflow": "cicd.yaml", "event_name": "${{ github.event_name }}" }}' From b7c4c8442d88f3a5315b882d892bdd093637763c Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Sat, 22 Jun 2024 01:29:13 -0700 Subject: [PATCH 12/14] Test commit to trigger workflow Previous run was able to dispatch the e2etest workflow but the macos runner didn't have all the tests pass. Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/cicd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index bcfdf2a5..1d1a2046 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -33,7 +33,7 @@ jobs: steps: - name: Temporary step to pass the job id: temporary-step - run: echo "Temporary step to ensure the job completes and workflow doesn't fail" + run: echo "Temporary step to ensure job completes and workflow doesn't fail" # - name: Checkout # uses: actions/checkout@v4 From d6440bc0e5abbcd95404820f5b776361d1e582f3 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Sat, 22 Jun 2024 18:46:43 -0700 Subject: [PATCH 13/14] Test commit to trigger workflow MacOS runner abruptly failed in the docker setup step just after 7 minutes. Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index 80afd988..52240ae8 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -8,7 +8,7 @@ on: description: "Name of the parent workflow that triggered this workflow" required: true event_name: - description: "Type of event that triggered this workflow (e.g. push, pull_request)" + description: "Event type that triggered this workflow (e.g. push, pull_request)" required: true schedule: From cc0e9fa1849ff1863af4f332179a6f7d59061f30 Mon Sep 17 00:00:00 2001 From: "Mahadik, Mukul Chandrakant" Date: Mon, 24 Jun 2024 13:41:32 -0700 Subject: [PATCH 14/14] Fix for failure pointed by Codacy for using ${{...}} Failure message: ``` Using variable interpolation `${{...}}` with `github` context data in a `run:` step could allow an attacker to inject their own code into the runner. ``` Found a fix which mentions using environment variables instead of directly accessing Github context variables directly in executable statements like the `run` statement: https://github.com/cisagov/client-cert-update/pull/53#issuecomment-1819409062 Signed-off-by: Mahadik, Mukul Chandrakant --- .github/workflows/e2etest.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2etest.yaml b/.github/workflows/e2etest.yaml index 52240ae8..9c49ca49 100644 --- a/.github/workflows/e2etest.yaml +++ b/.github/workflows/e2etest.yaml @@ -20,6 +20,10 @@ jobs: if: github.event.inputs.parent_workflow == 'cicd.yaml' && github.event.inputs.event_name != 'pull_request' runs-on: ${{ matrix.os }} + env: + PARENT_WORKFLOW_NAME: ${{ github.event.inputs.parent_workflow }} + TRIGGER_EVENT_TYPE: ${{ github.event.inputs.event_name }} + strategy: fail-fast: false matrix: @@ -27,10 +31,11 @@ jobs: steps: - - name: Verify parent workflow name - id: verify-parent-workflow + - name: Verify parent workflow and trigger event type + id: verify-parent-workflow-and-trigger-event run: | - echo "Workflow triggered by parent workflow: ${{ github.event.inputs.parent_workflow }}" + echo "Workflow triggered by parent workflow: $PARENT_WORKFLOW_NAME" + echo "Trigger event type: $TRIGGER_EVENT_TYPE" - name: Setup Docker on macOS using Colima, Lima-VM, and Homebrew. id: docker-install