Skip to content

Commit

Permalink
Creating regex logic for build autotriager (#3576)
Browse files Browse the repository at this point in the history
This change allows us to guess at the cause for each failure, 
enabling rapid prioritisation when triaging.

Also includes various fixes, comments, and a new readme.

Signed-off-by: Adam Farley <adfarley@redhat.com>
  • Loading branch information
adamfarley authored Dec 22, 2023
1 parent 383de60 commit 1390320
Show file tree
Hide file tree
Showing 4 changed files with 287 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-autotriage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
Label:
runs-on: ubuntu-latest
name: Run Build Triage
if: github.repository == 'adoptium/temurin-build'
steps:
- uses: actions/checkout@v3
- name: "Run Build Auto Triage"
run: bash "${PWD}/${TRIAGE_SCRIPT}" jdk8u jdk11u jdk17u jdk21u jdk22head
run: bash "${PWD}/${TRIAGE_SCRIPT}" jdk8u jdk11u jdk17u jdk21u jdk22 jdk23head

- name: Create Issue From File
env:
Expand Down
57 changes: 57 additions & 0 deletions tooling/build_autotriage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Readme for Build Auto-Triage Tool

## Summary

This tool generates links to all of the latest build failures for Eclipse Temurin™ at Adoptium.

It also includes the likely cause of each failure, allowing for efficient triage.

## Details

When passed one or more jdk major versions, this script identifies the latest attempts to build Eclipse Temurin™ at
the Adoptium project, and it returns links and triage information for all the failed/aborted-state builds.

Benefits of using this script include:

- The ability to efficiently focus your time on failures that are the most important to you.
- The ability to share a community-wide view of the current build health.
- The ability to quickly identify and resolve failures.
- The ability to spot missing platforms for a specific major version (see the "Script Issues" section in the created issue/file).
- Conversely, the ability to know when you're building platforms you shouldn't be building.
- The ability to quickly identify the latest Temurin pipelines

## Instructions

bash build_autotriage.sh jdk8u jdk11u jdk17u jdk21u jdk22head

## Output

This script generates a file in Markdown format.

The output is designed to be used by a git action to populate a new GitHub issue.

## Developer tips

Developers should add the following temporary code snippet into the build-autotriage.yml file while developing a change:

```YAML
push:
paths:
- '**build-autotriage.yml'
- '**build_autotriage.sh'
- '**autotriage_regexes.sh'
```
This should begin at the line immediately after the cron command.
This temporary change will automatically run the GitHub action every time you push a change set, allowing easy testing.
For this to work, you need to have GitHub actions and issues enabled in your repository.
*Make sure to remove this before pushing your change upstream.*
## Associated file breakdown
- build_autotriage.sh: This is the main script, containing most of the logic.
- autotriage_regexes.sh: This contains all of the regular expressions used to identify failures.
- build-autotriage.yml: This is the git action that runs the main script and generates an issue from the output.
136 changes: 132 additions & 4 deletions tooling/build_autotriage/autotriage_regexes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,136 @@
#
################################################################################

# declare -a arrayOfRegexes
# declare -a arrayOfRegexMetadata
# declare -a arrayOfRegexPreventability
# Regular expressions to match a single line of jenkins job console output.
declare -a arrayOfRegexes
# A short description of the sort of error we're dealing with. Can contain URLs. Markdown format.
declare -a arrayOfRegexMetadata
# 0 = This issue was preventable, and 1 = This issue was not preventable.
declare -a arrayOfRegexPreventability
# 0 = This issue was probably a build failure, and 1 = This issue was probably a test failure.
declare -a arrayOfFailureSources

# TODO.
storeInArrays() {
arrayOfRegexes+=("${1}")
arrayOfRegexMetadata+=("${2}")
arrayOfRegexPreventability+=("${3}")
arrayOfFailureSources+=("${4}")
}

echo "Generating regex arrays to match against failures."

r="SIGSEGV"
m="Segmentation error."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="No.space.left.on.device"
m="Out of disk space."
p="0"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="(insufficient.memory|Out.of.system.resources|Out.?of.?Memory.?Error)"
m="Out of memory."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="Read\-only\sfile\ssystem"
m="Read-only file system."
p="0"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="(was.marked.offline\:.Connection.was.broken|Unexpected.termination.of.the.channel)"
m="Lost connection to machine."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="(Failed.to.connect.to.github\.com|archive.is.not.a.ZIP.archive)"
m="Download failed."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="(Program.*timed.out|Agent.[0-9]+.timed.out.with.a.timeout.of)"
m="Timeout."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="there.are.rogue.processes.kicking.about"
m="ProcessCatch found something."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="No.such.device"
m="No such device."
p="0"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="Build.Test_openjdk.*completed\:.(FAILURE|ABORTED)"
m="Post-build AQATest subjob failed."
p="1"
s="1"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="Build.*SmokeTests.*completed\:.(FAILURE|ABORTED)"
m="Smoke test failed."
p="1"
s="1"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="Build.*create_installer.*\#[0-9]+.completed\:.(FAILURE|ABORTED)"
m="Installer subjob failed."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="Build.*\sign\_.*.\#[0-9].completed\:.(FAILURE|ABORTED)"
m="Signing subjob failed."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="Build.*\#[0-9].completed\:.(FAILURE|ABORTED)"
m="Subjob failed. It was not a test, installer, or signing job."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="(permission.denied|AccessDeniedException)"
m="AccessDeniedException or Permission Denied"
p="0"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="Error.creating.temporary.file"
m="Error creating temporary file."
p="0"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="(Unable.to.delete|Could.not.create.(file|directory))"
m="Error creating/deleting a file"
p="0"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="return\scode\s[1-9]+"
m="."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

r="(Error\:\s|Exception\:\s)"
m="Error/exception found."
p="1"
s="0"
storeInArrays "${r}" "${m}" "${p}" "${s}"

echo "Regex arrays ready."
Loading

0 comments on commit 1390320

Please sign in to comment.