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
|
|
|
|
test:
|
|
|
|
description: "Test name"
|
|
|
|
required: true
|
|
|
|
provider:
|
|
|
|
description: "CSP"
|
|
|
|
required: true
|
2024-01-25 09:32:19 -05:00
|
|
|
attestationVariant:
|
|
|
|
description: "Attestation variant"
|
|
|
|
required: false
|
2023-04-12 10:06:26 -04:00
|
|
|
refStream:
|
|
|
|
description: "RefStream of the run"
|
|
|
|
required: false
|
|
|
|
kubernetesVersion:
|
|
|
|
description: "Kubernetes version"
|
|
|
|
required: false
|
2023-12-15 04:37:29 -05:00
|
|
|
clusterCreation:
|
|
|
|
description: "How the infrastructure for the e2e test was created. One of [cli, self-managed, terraform]."
|
2024-01-29 05:52:41 -05:00
|
|
|
required: false
|
2023-04-12 10:06:26 -04:00
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Pick assignee
|
|
|
|
id: pick-assignee
|
|
|
|
uses: ./.github/actions/pick_assignee
|
|
|
|
|
2023-11-22 11:45:50 -05:00
|
|
|
- name: Get the current date
|
|
|
|
id: date
|
|
|
|
shell: bash
|
|
|
|
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
|
|
|
|
|
2024-01-23 02:32:02 -05:00
|
|
|
- name: Encode URI component
|
|
|
|
uses: Ablestor/encode-uri-component-action@v1.1
|
|
|
|
id: encode-uri-component
|
|
|
|
with:
|
|
|
|
string: ${{ inputs.test }}
|
|
|
|
|
2023-11-22 11:45:50 -05:00
|
|
|
- name: Create body template
|
|
|
|
id: body-template
|
2023-11-28 03:41:01 -05:00
|
|
|
shell: bash
|
2023-11-22 11:45:50 -05:00
|
|
|
run: |
|
|
|
|
# TODO(katexochen): add job number when possible
|
|
|
|
jobURL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
2024-01-10 03:49:47 -05:00
|
|
|
|
|
|
|
# OpenSearch instance details
|
|
|
|
instance=search-e2e-logs-y46renozy42lcojbvrt3qq7csm
|
|
|
|
region=eu-central-1
|
|
|
|
|
|
|
|
# UUID of index "logs-*"
|
|
|
|
a="(metadata:(indexPattern:'9004ee20-77cc-11ee-b137-27c60b9ad4a4',view:discover))"
|
|
|
|
|
|
|
|
# Default window: last 7 days
|
|
|
|
g='(time:(from:now-7d,to:now))'
|
|
|
|
|
2024-01-29 05:52:41 -05:00
|
|
|
# Query construction
|
|
|
|
# Omit empty fields since OpenSearch will otherwise only display results where the field is empty
|
|
|
|
queryGen() {
|
|
|
|
key=$1
|
|
|
|
val=$2
|
|
|
|
if [[ -n "${val}" ]]; then
|
|
|
|
printf "(query:(match_phrase:(%s:'%s')))," "${key}" "${val}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-01-10 03:49:47 -05:00
|
|
|
q=$(echo "(filters:!(
|
2024-01-29 05:52:41 -05:00
|
|
|
$(queryGen cloud.provider "${{ inputs.provider }}")
|
|
|
|
$(queryGen metadata.github.ref-stream "${{ inputs.refStream }}")
|
|
|
|
$(queryGen metadata.github.kubernetes-version "${{ inputs.kubernetesVersion }}")
|
|
|
|
$(queryGen metadata.github.attestation-variant "${{ inputs.attestationVariant }}")
|
|
|
|
$(queryGen metadata.github.cluster-creation "${{ inputs.clusterCreation }}")
|
|
|
|
$(queryGen metadata.github.e2e-test-payload "${{ steps.encode-uri-component.outputs.string }}")
|
2024-01-30 02:57:27 -05:00
|
|
|
(query:(match_phrase:(metadata.github.run-id:${{ github.run_id }})))
|
2024-01-10 03:49:47 -05:00
|
|
|
))" | tr -d "\t\n ")
|
|
|
|
|
|
|
|
# URL construction
|
|
|
|
opensearchURL="https://${instance}.${region}.es.amazonaws.com/_dashboards/app/data-explorer/discover/#?_a=${a}&_q=${q}&_g=${g}"
|
2023-11-22 11:45:50 -05:00
|
|
|
cat << EOF > header.md
|
|
|
|
|
|
|
|
## Metadata
|
|
|
|
|
|
|
|
* [Job URL](${jobURL})
|
2024-01-10 03:49:47 -05:00
|
|
|
* [OpenSearch URL](${opensearchURL})
|
2023-11-22 11:45:50 -05:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat header.md .github/failure_project_template.md > body.md
|
|
|
|
echo "BODY_PATH=$(pwd)/body.md" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- uses: ./.github/actions/gh_create_issue
|
|
|
|
id: gh_create_issue
|
|
|
|
with:
|
|
|
|
title: "${{ env.CURRENT_DATE }}"
|
|
|
|
body-file: ${{ env.BODY_PATH }}
|
|
|
|
repo: issues
|
|
|
|
label: "e2e failure"
|
|
|
|
assignee: ${{ steps.pick-assignee.outputs.assignee }}
|
|
|
|
project: Constellation bugs
|
|
|
|
fields: |
|
|
|
|
workflow: ${{ github.workflow }}
|
|
|
|
kubernetesVersion: ${{ inputs.kubernetesVersion }}
|
2024-01-30 02:57:27 -05:00
|
|
|
cloudProvider: ${{ inputs.provider }}
|
2024-01-25 09:32:19 -05:00
|
|
|
attestationVariant: ${{ inputs.attestationVariant }}
|
2023-12-15 04:37:29 -05:00
|
|
|
clusterCreation: ${{ inputs.clusterCreation }}
|
2023-11-22 11:45:50 -05:00
|
|
|
test: ${{ inputs.test }}
|
|
|
|
refStream: ${{ inputs.refStream }}
|
|
|
|
token: ${{ inputs.projectWriteToken }}
|
|
|
|
|
|
|
|
- name: Issue URL ${{ steps.gh_create_issue.outputs.issue-url }}
|
|
|
|
shell: bash
|
|
|
|
run: echo ${{ steps.gh_create_issue.outputs.issue-url }}
|