From acbc46433e1b076bc3587f18afff49ecc3e77be3 Mon Sep 17 00:00:00 2001 From: Chamath Samarawickrama Date: Fri, 16 Jun 2023 10:28:50 +0530 Subject: [PATCH 1/3] add capability to download product from a provided URL in the OIDC conformance suite --- .github/workflows/oidc-conformance-test.yml | 41 +++++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/.github/workflows/oidc-conformance-test.yml b/.github/workflows/oidc-conformance-test.yml index da94f8812d..657ba26b56 100644 --- a/.github/workflows/oidc-conformance-test.yml +++ b/.github/workflows/oidc-conformance-test.yml @@ -14,6 +14,9 @@ on: description: 'product-is tag name' required: true default: 'v5.12.0-alpha9' + download-url: + description: 'URL to download product-is' + required: false send-email: description: 'Send test results to email' required: true @@ -46,25 +49,31 @@ jobs: - name: Download IS zip run: | - owner="wso2" - repo="product-is" - INPUT_TAG=${{github.event.inputs.tag}} - if [[ -z "${INPUT_TAG}" ]]; then - tag=${GITHUB_REF:10} - tag_trimmed=${tag// } + INPUT_URL=${{github.event.inputs.download-url}} + if [[ -z "${INPUT_URL}" ]]; then + owner="wso2" + repo="product-is" + INPUT_TAG=${{github.event.inputs.tag}} + if [[ -z "${INPUT_TAG}" ]]; then + tag=${GITHUB_REF:10} + tag_trimmed=${tag// } + else + tag=${{github.event.inputs.tag}} + tag_trimmed=${tag// } + fi + + artifact="wso2is-${tag_trimmed:1}.zip" + echo "Tag=$tag" + echo "Artifact=$artifact" + list_asset_url="https://api.github.com/repos/${owner}/${repo}/releases/tags/${tag_trimmed}" + asset_url=$(curl "${list_asset_url}" | jq ".assets[] | select(.name==\"${artifact}\") | .url" | sed 's/\"//g') + curl -vLJO -H 'Accept: application/octet-stream' \ + "${asset_url}" else - tag=${{github.event.inputs.tag}} - tag_trimmed=${tag// } + curl -vLJO -H 'Accept: application/octet-stream' \ + "${INPUT_URL}" fi - artifact="wso2is-${tag_trimmed:1}.zip" - echo "Tag=$tag" - echo "Artifact=$artifact" - list_asset_url="https://api.github.com/repos/${owner}/${repo}/releases/tags/${tag_trimmed}" - asset_url=$(curl "${list_asset_url}" | jq ".assets[] | select(.name==\"${artifact}\") | .url" | sed 's/\"//g') - curl -vLJO -H 'Accept: application/octet-stream' \ - "${asset_url}" - - name: Clone conformance suite run: | CONFORMANCE_SUITE_VERSION=v4.1.42 From d1fcf3d1fdf916ec09d5c28c17454a176a299af4 Mon Sep 17 00:00:00 2001 From: Chamath Samarawickrama Date: Fri, 16 Jun 2023 10:37:48 +0530 Subject: [PATCH 2/3] make either the git tag or the download required --- .github/workflows/oidc-conformance-test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/oidc-conformance-test.yml b/.github/workflows/oidc-conformance-test.yml index 657ba26b56..5d1f6cf635 100644 --- a/.github/workflows/oidc-conformance-test.yml +++ b/.github/workflows/oidc-conformance-test.yml @@ -12,8 +12,7 @@ on: inputs: tag: description: 'product-is tag name' - required: true - default: 'v5.12.0-alpha9' + required: false download-url: description: 'URL to download product-is' required: false @@ -50,10 +49,14 @@ jobs: - name: Download IS zip run: | INPUT_URL=${{github.event.inputs.download-url}} + INPUT_TAG=${{github.event.inputs.tag}} + if [[ -z "${INPUT_URL}" ]] && [[ -z "${INPUT_TAG}" ]]; then + echo "Either 'tag' or 'download-url' must be provided." + exit 1 + fi if [[ -z "${INPUT_URL}" ]]; then owner="wso2" repo="product-is" - INPUT_TAG=${{github.event.inputs.tag}} if [[ -z "${INPUT_TAG}" ]]; then tag=${GITHUB_REF:10} tag_trimmed=${tag// } @@ -61,7 +64,7 @@ jobs: tag=${{github.event.inputs.tag}} tag_trimmed=${tag// } fi - + artifact="wso2is-${tag_trimmed:1}.zip" echo "Tag=$tag" echo "Artifact=$artifact" From 58da54e5a12f9f5140af7af134f478d18b5a37c3 Mon Sep 17 00:00:00 2001 From: Chamath Samarawickrama Date: Fri, 16 Jun 2023 12:03:11 +0530 Subject: [PATCH 3/3] update the Send Email and Send Chat Message jobs --- .github/workflows/oidc-conformance-test.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/oidc-conformance-test.yml b/.github/workflows/oidc-conformance-test.yml index 5d1f6cf635..425e5e8b5e 100644 --- a/.github/workflows/oidc-conformance-test.yml +++ b/.github/workflows/oidc-conformance-test.yml @@ -152,7 +152,11 @@ jobs: echo "Sending Email" echo "=============" CONFORMANCE_SUITE_URL=https://localhost:8443 - python3 ./product-is/oidc-conformance-tests/send_email.py $CONFORMANCE_SUITE_URL $GITHUB_RUN_NUMBER ${{job.status}} ${{github.repository}} ${{github.run_id}} ${{secrets.SENDER_EMAIL}} ${{secrets.PASSWORD}} ${{secrets.RECEIVER_LIST}} ${{github.event.inputs.tag}} + RESOURCE=${{github.event.inputs.download-url}} + if [[ -z "${RESOURCE}" ]]; then + RESOURCE=${{github.event.inputs.tag}} + fi + python3 ./product-is/oidc-conformance-tests/send_email.py $CONFORMANCE_SUITE_URL $GITHUB_RUN_NUMBER ${{job.status}} ${{github.repository}} ${{github.run_id}} ${{secrets.SENDER_EMAIL}} ${{secrets.PASSWORD}} ${{secrets.RECEIVER_LIST}} $RESOURCE elif [ $SEND_EMAIL == "NO" ]; then echo "========================================" echo "Skipped Sending Email" @@ -167,20 +171,20 @@ jobs: if: always() run: | INPUT=${{github.event.inputs.send-chat}} - TAG=${{github.event.inputs.tag}} + RESOURCE=${{github.event.inputs.download-url}} + if [[ -z "${RESOURCE}" ]]; then + RESOURCE=${{github.event.inputs.tag}} + fi if [[ -z "${INPUT}" ]]; then INPUT="yes" fi - if [[ -z "${TAG}" ]]; then - TAG=${GITHUB_REF:10} - fi SEND_CHAT=${INPUT^^} if [ $SEND_CHAT == "YES" ]; then echo "===========================" echo "Sending Google Chat Message" echo "===========================" CONFORMANCE_SUITE_URL=https://localhost:8443 - python3 ./product-is/oidc-conformance-tests/send_chat.py "$CONFORMANCE_SUITE_URL" "$GITHUB_RUN_NUMBER" "${{job.status}}" "${{github.repository}}" "${{github.run_id}}" "${{secrets.GOOGLE_CHAT_WEBHOOK_OIDC_TEST}}" "$TAG" + python3 ./product-is/oidc-conformance-tests/send_chat.py "$CONFORMANCE_SUITE_URL" "$GITHUB_RUN_NUMBER" "${{job.status}}" "${{github.repository}}" "${{github.run_id}}" "${{secrets.GOOGLE_CHAT_WEBHOOK_OIDC_TEST}}" "$RESOURCE" elif [ $SEND_CHAT == "NO" ]; then echo "========================================" echo "Skipped Sending Google Chat Message"