2023-11-15 02:48:13 -05:00
|
|
|
name: notify e2e failure
|
2023-04-12 10:06:26 -04:00
|
|
|
description: "Post a failure message to project board and teams"
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
projectWriteToken:
|
|
|
|
description: "Token to write to the project board"
|
|
|
|
required: true
|
|
|
|
teamsWebhookUri:
|
|
|
|
description: "URI to send a message to the teams channel"
|
|
|
|
required: true
|
|
|
|
test:
|
|
|
|
description: "Test name"
|
|
|
|
required: true
|
|
|
|
provider:
|
|
|
|
description: "CSP"
|
|
|
|
required: true
|
|
|
|
refStream:
|
|
|
|
description: "RefStream of the run"
|
|
|
|
required: false
|
|
|
|
kubernetesVersion:
|
|
|
|
description: "Kubernetes version"
|
|
|
|
required: false
|
2023-10-30 09:33:58 -04:00
|
|
|
selfManagedInfra:
|
|
|
|
description: "Use self-managed infrastructure instead of infrastructure created by the Constellation CLI."
|
|
|
|
default: "false"
|
2023-04-12 10:06:26 -04:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Pick assignee
|
|
|
|
id: pick-assignee
|
|
|
|
uses: ./.github/actions/pick_assignee
|
|
|
|
|
|
|
|
- name: Create project card in case of failure
|
|
|
|
id: create-project-card
|
|
|
|
continue-on-error: true
|
|
|
|
shell: bash
|
|
|
|
env:
|
|
|
|
GHH_TOKEN: ${{ inputs.projectWriteToken }}
|
|
|
|
run: |
|
|
|
|
# TODO(katexochen): add job number when possible
|
|
|
|
jobURL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
2023-10-30 09:33:58 -04:00
|
|
|
# TODO(msanft): Add Self-managed param once logcollection is fixed.
|
2023-09-26 07:17:59 -04:00
|
|
|
opensearchURL="https://search-e2e-logs-y46renozy42lcojbvrt3qq7csm.eu-central-1.es.amazonaws.com/_dashboards/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:now-7d,to:now))&_a=(columns:!(metadata.name,systemd.unit,kubernetes.pod_name,message),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'74517cf0-6442-11ed-acf1-47dda8fdfbbb',key:metadata.github.e2e-test-provider,negate:!f,params:(query:${{ inputs.provider }}),type:phrase),query:(match_phrase:(metadata.github.e2e-test-provider:${{ inputs.provider }}))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'74517cf0-6442-11ed-acf1-47dda8fdfbbb',key:metadata.github.run-id,negate:!f,params:(query:${{ github.run_id }}),type:phrase),query:(match_phrase:(metadata.github.run-id:${{ github.run_id }}))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'74517cf0-6442-11ed-acf1-47dda8fdfbbb',key:metadata.github.ref-stream.keyword,negate:!f,params:(query:'${{ inputs.refStream }}'),type:phrase),query:(match_phrase:(metadata.github.ref-stream.keyword:'${{ inputs.refStream }}'))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'74517cf0-6442-11ed-acf1-47dda8fdfbbb',key:metadata.github.kubernetes-version.keyword,negate:!f,params:(query:'${{ inputs.kubernetesVersion }}'),type:phrase),query:(match_phrase:(metadata.github.kubernetes-version.keyword:'${{ inputs.kubernetesVersion }}'))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'74517cf0-6442-11ed-acf1-47dda8fdfbbb',key:metadata.github.e2e-test-payload,negate:!f,params:(query:'${{ inputs.test }}'),type:phrase),query:(match_phrase:(metadata.github.e2e-test-payload:'${{ inputs.test }}')))),index:'74517cf0-6442-11ed-acf1-47dda8fdfbbb',interval:auto,query:(language:kuery,query:''),sort:!())"
|
2023-04-12 10:06:26 -04:00
|
|
|
cat << EOF > header.md
|
|
|
|
|
|
|
|
## Metadata
|
|
|
|
|
|
|
|
* [Job URL](${jobURL})
|
2023-09-28 10:31:22 -04:00
|
|
|
* [OpenSearch URL](${opensearchURL// /%20})
|
2023-04-12 10:06:26 -04:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat header.md .github/failure_project_template.md > body.md
|
|
|
|
cp .github/failure_project_metadata.json metadata.json
|
|
|
|
DATE=$(date '+%F %a %T %Z') yq -iP '.issueTitle = env(DATE)' metadata.json
|
|
|
|
yq -iP '.assignees += [ "${{ steps.pick-assignee.outputs.assignee }}" ]' metadata.json
|
|
|
|
yq -iP '.fields.cloudProvider = "${{ inputs.provider }}"' metadata.json
|
2023-10-30 09:33:58 -04:00
|
|
|
if [[ ${{ inputs.selfManagedInfra }} == 'true' ]]; then
|
|
|
|
yq -iP '.fields.test = "${{ inputs.test }} (Self-managed infrastructure)"' metadata.json
|
|
|
|
else
|
|
|
|
yq -iP '.fields.test = "${{ inputs.test }}"' metadata.json
|
|
|
|
fi
|
2023-04-12 10:06:26 -04:00
|
|
|
yq -iP '.fields.workflow = "${{ github.workflow }}"' metadata.json
|
|
|
|
if [[ -n "${{ inputs.kubernetesVersion }}" ]]; then
|
|
|
|
yq -iP '.fields.kubernetesVersion = "${{ inputs.kubernetesVersion }}"' metadata.json
|
|
|
|
fi
|
|
|
|
if [[ -n "${{ inputs.refStream }}" ]]; then
|
|
|
|
yq -iP '.fields.refStream = "${{ inputs.refStream }}"' metadata.json
|
|
|
|
fi
|
2023-10-30 09:33:58 -04:00
|
|
|
|
2023-04-12 10:06:26 -04:00
|
|
|
cat metadata.json
|
|
|
|
|
|
|
|
issueURL=$(
|
2023-05-19 09:36:54 -04:00
|
|
|
bazel run //bazel/ci:ghh -- create-project-issue \
|
2023-04-12 10:06:26 -04:00
|
|
|
--body body.md \
|
|
|
|
--metadata metadata.json \
|
|
|
|
-v
|
|
|
|
)
|
|
|
|
|
|
|
|
echo "jobURL=${jobURL}" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
echo "opensearchURL=${opensearchURL}" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
echo "issueURL=${issueURL}" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
|
2023-11-15 02:48:13 -05:00
|
|
|
- name: Create notification fields
|
|
|
|
id: create-fields
|
2023-04-12 10:06:26 -04:00
|
|
|
continue-on-error: true
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-11-15 02:48:13 -05:00
|
|
|
echo '[ { "title": "CloudProvider", "value": "${{ inputs.provider }}" }, { "title": "Test", "value": "${{ inputs.test }}" } ]' > facts.json
|
2023-04-12 10:06:26 -04:00
|
|
|
if [[ -n "${{ inputs.kubernetesVersion }}" ]]; then
|
2023-11-15 02:48:13 -05:00
|
|
|
yq -oj -iP '. += [ { "title": "KubernetesVersion", "value": "${{ inputs.kubernetesVersion }}" } ]' facts.json
|
2023-04-12 10:06:26 -04:00
|
|
|
fi
|
|
|
|
if [[ -n "${{ inputs.refStream }}" ]]; then
|
2023-11-15 02:48:13 -05:00
|
|
|
yq -oj -iP '. += [ { "title": "RefStream", "value": "${{ inputs.refStream }}" } ]' facts.json
|
2023-04-12 10:06:26 -04:00
|
|
|
fi
|
2023-07-05 09:37:38 -04:00
|
|
|
|
2023-11-15 02:48:13 -05:00
|
|
|
buttons='[
|
|
|
|
{
|
|
|
|
"type": "Action.OpenUrl",
|
|
|
|
"title": "Project board issue",
|
|
|
|
"url": "${{ steps.create-project-card.outputs.issueURL }}",
|
|
|
|
"style": "positive"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "Action.OpenUrl",
|
|
|
|
"title": "OpenSearch logs",
|
|
|
|
"url": "${{ steps.create-project-card.outputs.opensearchURL }}",
|
|
|
|
"style": "positive"
|
|
|
|
}
|
|
|
|
]'
|
|
|
|
|
|
|
|
echo "additionalFields=$(cat facts.json)" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
echo "additionalButtons=$buttons" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
|
|
|
|
- name: Notify teams channel
|
|
|
|
continue-on-error: true
|
|
|
|
uses: ./.github/actions/notify_teams
|
|
|
|
with:
|
|
|
|
teamsWebhookURI: ${{ inputs.teamsWebhookUri }}
|
|
|
|
title: "Constellation E2E test failed"
|
|
|
|
assignee: ${{ steps.pick-assignee.outputs.assignee }}
|
|
|
|
additionalFields: ${{ steps.create-fields.outputs.additionalFields }}
|
|
|
|
additionalButtons: ${{ steps.create-fields.outputs.additionalButtons }}
|