-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only set Functional Test Run as passing if all subtests pass #7303
Changes from 14 commits
b1e8469
3c0680c
0cbc65b
e355b49
b7b1546
8789e90
22fe0bb
842c5e1
03a9f0d
7f55bf1
f0c6dd2
a3b417a
af2d313
fb13222
81f4381
0057432
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,8 @@ env: | |
ACTION_LINK: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}' | ||
# Server where terraform test modules are deployed | ||
TF_RECIPE_MODULE_SERVER_URL: "http://tf-module-server.radius-test-tf-module-server.svc.cluster.local" | ||
# The functional test GitHub app id | ||
FUNCTIONAL_TEST_APP_ID: 425843 | ||
|
||
jobs: | ||
build: | ||
|
@@ -79,7 +81,6 @@ jobs: | |
env: | ||
DE_IMAGE: 'ghcr.io/radius-project/deployment-engine' | ||
DE_TAG: 'latest' | ||
FUNCTIONAL_TEST_APP_ID: 425843 | ||
outputs: | ||
REL_VERSION: ${{ steps.gen-id.outputs.REL_VERSION }} | ||
UNIQUE_ID: ${{ steps.gen-id.outputs.UNIQUE_ID }} | ||
|
@@ -90,7 +91,7 @@ jobs: | |
DE_IMAGE: ${{ steps.gen-id.outputs.DE_IMAGE }} | ||
DE_TAG: ${{ steps.gen-id.outputs.DE_TAG }} | ||
steps: | ||
- name: Login as the GitHub App | ||
- name: Get GitHub app token | ||
uses: tibdex/github-app-token@v1 | ||
id: get_installation_token | ||
with: | ||
|
@@ -324,9 +325,8 @@ jobs: | |
BICEP_RECIPE_TAG_VERSION: ${{ needs.build.outputs.REL_VERSION }} | ||
DE_IMAGE: ${{ needs.build.outputs.DE_IMAGE }} | ||
DE_TAG: ${{ needs.build.outputs.DE_TAG }} | ||
FUNCTIONAL_TEST_APP_ID: 425843 | ||
steps: | ||
- name: Login as the GitHub App | ||
- name: Get GitHub app token | ||
uses: tibdex/github-app-token@v1 | ||
id: get_installation_token | ||
with: | ||
|
@@ -352,7 +352,6 @@ jobs: | |
with: | ||
repository: radius-project/samples | ||
ref: refs/heads/edge | ||
token: ${{ secrets.GH_RAD_CI_BOT_PAT }} | ||
path: samples | ||
- name: Set up Go ${{ env.GOVER }} | ||
uses: actions/setup-go@v3 | ||
|
@@ -414,7 +413,7 @@ jobs: | |
# AZURE_OIDC_ISSUER | ||
eval "export $(echo "${{ secrets.FUNCTEST_AZURE_OIDC_JSON }}" | jq -r 'to_entries | map("\(.key)=\(.value)") | @sh')" | ||
|
||
AUTHKEY=$(echo -n "${{ github.actor }}:${{ secrets.GH_RAD_CI_BOT_PAT }}" | base64) | ||
AUTHKEY=$(echo -n "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" | base64) | ||
echo "{\"auths\":{\"ghcr.io\":{\"auth\":\"${AUTHKEY}\"}}}" > "./ghcr_secret.json" | ||
|
||
# Create KinD cluster with OIDC Issuer keys | ||
|
@@ -628,6 +627,40 @@ jobs: | |
append: true | ||
message: | | ||
:x: ${{ matrix.name }} functional test cancelled. Please check [the logs](${{ env.ACTION_LINK }}) for more details | ||
report-test-results: | ||
name: Report test results | ||
needs: [build, tests] | ||
runs-on: ubuntu-latest | ||
if: always() | ||
env: | ||
CHECKOUT_REF: ${{ needs.build.outputs.CHECKOUT_REF }} | ||
steps: | ||
- name: Get GitHub app token | ||
uses: tibdex/github-app-token@v1 | ||
id: get_installation_token | ||
with: | ||
app_id: ${{ env.FUNCTIONAL_TEST_APP_ID }} | ||
private_key: ${{ secrets.FUNCTIONAL_TEST_APP_PRIVATE_KEY }} | ||
- name: Get tests job status | ||
id: get_test_status | ||
run: | | ||
# from: https://github.com/orgs/community/discussions/26526#discussioncomment-3252209 | ||
ALL_JOBS_STATUS=$(curl -X GET -s -u "admin:${{ steps.get_installation_token.outputs.token }}" https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs | jq ".jobs[] | {job_status: .conclusion}") | ||
echo "All jobs status: $ALL_JOBS_STATUS" | ||
TEST_STATUS="success" | ||
for job_status in $(echo "$ALL_JOBS_STATUS" | jq -r '.[]'); do | ||
echo "Job Status: $job_status" | ||
if [[ "$job_status" == "failure" ]]; then | ||
echo "Found failed test. Setting test status to failure" | ||
TEST_STATUS="failure" | ||
break | ||
elif [[ "$job_status" == "cancelled" ]]; then | ||
echo "Found cancelled test. Setting test status to cancelled" | ||
TEST_STATUS="cancelled" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also have a break here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a break for the failure but not the cancelled because I think it's better to report "tests failed" instead of "tests cancelled" if both occur. If all tests pass but some are cancelled, we will still report the status as cancelled because we only set as "success" if we don't go in this conditional. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
fi | ||
done | ||
echo "Test Status: $TEST_STATUS" | ||
echo "test_status=$TEST_STATUS" >> $GITHUB_OUTPUT | ||
- uses: LouisBrunner/[email protected] | ||
if: always() | ||
with: | ||
|
@@ -636,7 +669,7 @@ jobs: | |
repo: ${{ github.repository }} | ||
sha: ${{ env.CHECKOUT_REF }} | ||
status: completed | ||
conclusion: ${{ job.status }} | ||
conclusion: ${{ steps.get_test_status.outputs.test_status }} | ||
output: | | ||
{"summary":"Functional Test run completed. See links for more information.","title":"Functional Test Run"} | ||
details_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? What's this token being used for? I would expect the github token to no longer be valid once the test run is over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can remove this - only had it there for fork testing.