name: notify e2e failure 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 attestationVariant: description: "Attestation variant" required: false refStream: description: "RefStream of the run" required: false kubernetesVersion: description: "Kubernetes version" required: false clusterCreation: description: "How the infrastructure for the e2e test was created. One of [cli, terraform]." required: false runs: using: "composite" steps: - name: Pick assignee id: pick-assignee uses: ./.github/actions/pick_assignee - name: Get the current date id: date shell: bash run: echo "CURRENT_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV - name: Create body template id: body-template shell: bash run: | # TODO(katexochen): add job number when possible jobURL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" # 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))' # 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 } e2eTestPayload=$(echo "${{ inputs.test }}" | jq -R -r @uri) q=$(echo "(filters:!( $(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 "${e2eTestPayload}") (query:(match_phrase:(metadata.github.run-id:${{ github.run_id }}))) ))" | tr -d "\t\n ") # URL construction opensearchURL="https://${instance}.${region}.es.amazonaws.com/_dashboards/app/data-explorer/discover/#?_a=${a}&_q=${q}&_g=${g}" cat << EOF > header.md ## Metadata * [Job URL](${jobURL}) * [OpenSearch URL](${opensearchURL}) 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 }} cloudProvider: ${{ inputs.provider }} attestationVariant: ${{ inputs.attestationVariant }} clusterCreation: ${{ inputs.clusterCreation }} 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 }}