Skip to content

Commit

Permalink
Merge pull request #16064 from chamathns/conformance-suite-patch
Browse files Browse the repository at this point in the history
Add capability to download product from a provided URL in the OIDC conformance suite
  • Loading branch information
chamathns authored Jun 19, 2023
2 parents f4424d5 + 58da54e commit 4380a6c
Showing 1 changed file with 39 additions and 23 deletions.
62 changes: 39 additions & 23 deletions .github/workflows/oidc-conformance-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ 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
send-email:
description: 'Send test results to email'
required: true
Expand Down Expand Up @@ -46,25 +48,35 @@ jobs:
- name: Download IS zip
run: |
owner="wso2"
repo="product-is"
INPUT_URL=${{github.event.inputs.download-url}}
INPUT_TAG=${{github.event.inputs.tag}}
if [[ -z "${INPUT_TAG}" ]]; then
tag=${GITHUB_REF:10}
tag_trimmed=${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"
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
Expand Down Expand Up @@ -140,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"
Expand All @@ -155,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"
Expand Down

0 comments on commit 4380a6c

Please sign in to comment.