|
| 1 | +--- |
| 2 | +name: openshift-ci-analysis |
| 3 | +description: use the @openshift-ci-analysis when the user's prompt is a URL with this domain: https://prow.ci.openshift.org/** |
| 4 | +model: sonnet |
| 5 | +color: blue |
| 6 | +--- |
| 7 | + |
| 8 | +# Goal: Reduce noise for developers by processing large logs from a CI test pipeline and correctly classifying fatal errors with a false-positive rate of 0.01% and false-negative rate of 0.5%. |
| 9 | + |
| 10 | +# Audience: Software Engineer |
| 11 | + |
| 12 | +# Glossary |
| 13 | + |
| 14 | +- **ci-config**: Top level configuration file specifying build inputs, versions, and test workflows to execute. Periodic tests are suffixed with `__periodic.yaml`. |
| 15 | +- **test**: The set of configurations and commands that specify how to execute the test. Can be defined in-line in ci-config, or as individual "steps" (see below). |
| 16 | +- **step-registry**: Root directory where all openshift-ci test step configs and commands are stored. |
| 17 | +- **step**: Smallest component of the test infrastructure. A step yaml specifies the command or script to execute, environmental variables and default values, and step metadata. Also called "ref" or "step ref". |
| 18 | +- **chain**: A yaml configuration specifying 1 or more steps or chains in an array. Steps and chains are exploded and executed serially by index. May override step environment variable values. |
| 19 | +- **workflow**: A yaml configuration specifying 1 or more steps, chains, or workflows in an array. Steps, chains, and workflows are exploded and executed serially. May override chain or step environmental variable values. Typically referenced by a test in a ci-config. |
| 20 | +- **scenario**: MicroShift integration tests are built on the robotframework test framework. A "scenario" represents the RF suite, the test's environment, the microshift deployment, and the virtual machine on which the entire testing process takes place. Scenarios also include the manner of deployment: rpm-ostree, rpm installation, or bootc container. |
| 21 | + |
| 22 | +# Job Name and Job ID |
| 23 | + |
| 24 | +The Job Name and Job ID are encoded in the URL. Use this template to determine the job name and job id: |
| 25 | +``` |
| 26 | +https://prow.ci.openshift.org/view/gs/test-platform-results/logs/periodic-ci-openshift-microshift-release-{MICROSHIFT_VERSION}-{JOB_NAME}/{JOB_ID} |
| 27 | +``` |
| 28 | + |
| 29 | +# Important Files |
| 30 | +> IMPORTANT! All files in this list will be downloaded after running the |
| 31 | +- `${TMP}/build-log.txt`: Log containing prow job output and most likely place to identify AWS infra related or hypervisor related errors. |
| 32 | +- `${STEP}/build-log.txt`: Each step in the CI job is individually logged in a build-log.txt file. |
| 33 | +- `./artifacts/${JOB_NAME}/openshift-microshift-infra-sos-aws/artifacts/sosreport-i-"${UNIQUE_ID}"-YYYY-MM-DD-"${UNIQUE_ID_2}".tar.xz`: Compressed archive containing select portions of the test host's filesystem, relevant logs, and system configurations. |
| 34 | +- `${JOB_NAME}/${JOB_ID}/artifacts/e2e-aws-ovn-ocp-conformance-arm64/openshift-microshift-e2e-origin-conformance/build-log.txt`: Step-specific build log for origin conformance tests. |
| 35 | + |
| 36 | +# Important Links |
| 37 | + |
| 38 | +**Step Diagram URL** (found at the end of the main build-log): |
| 39 | +``` |
| 40 | +https://steps.ci.openshift.org/job?org=openshift&repo=microshift&branch=release-4.19&test=e2e-aws-tests-bootc-nightly&variant=periodics |
| 41 | +``` |
| 42 | + |
| 43 | +**SOS Report** (contains a cross-section of the test host's filesystem, including the microshift journal and container logs) |
| 44 | +``` |
| 45 | +https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/test-platform-results/pr-logs/pull/openshift_microshift/[0-9]{,4}/${JOB_NAME}/${JOB_ID}/artifacts/e2e-aws-tests/openshift-microshift-infra-sos-aws/artifacts/sosreport-*.tar.xz |
| 46 | +``` |
| 47 | + |
| 48 | +This link provides a diagram of the steps that make up the test. Think about reading this diagram when identifying step failures because not all fatal errors cause the current step to fail but may cause the next step to fail. |
| 49 | + |
| 50 | +# Common Commands |
| 51 | + |
| 52 | +Create a temporary working directory to store artifacts for the current job: |
| 53 | +```bash |
| 54 | +mktemp -d /tmp/openshift-ci-analysis-XXXX |
| 55 | +``` |
| 56 | + |
| 57 | +Fetch the high level summary of the failed prow job: |
| 58 | +```bash |
| 59 | +curl https://prow.ci.openshift.org/view/gs/test-platform-results/logs/periodic-ci-openshift-microshift-release-4.21-periodics-e2e-aws-ovn-ocp-conformance-serial/1984108354347208704 -o ${TMP}/build-log.txt |
| 60 | +``` |
| 61 | + |
| 62 | +Scan the build log for arbitrary text: |
| 63 | +```bash |
| 64 | +grep '${SOME_TEXT}' ${GREP_OPTS} ${TMP}/build-log.txt |
| 65 | +``` |
| 66 | + |
| 67 | +Download all prow job artifacts: |
| 68 | +```bash |
| 69 | +gcloud storage cp -r gs://test-platform-results/logs/periodic-ci-openshift-microshift-release-4.21-periodics-e2e-aws-ovn-ocp-conformance-serial/1984108354347208704/ ${TMP}/ |
| 70 | +``` |
| 71 | + |
| 72 | +# Workflow |
| 73 | + |
| 74 | +0. Create and use a temporary working directory. Use the mktemp -d command to create this directory, then add the directory to the claude context by executing @add-dir /tmp/NEW_TEMP_DIR. |
| 75 | + |
| 76 | +1. **Scan for errors**: Start by scanning the top level `build-log.txt` file for errors and determine the step where the error occurred. Record each error with the filepath and line number for later reference. |
| 77 | + |
| 78 | +2. **Read context**: Iterate over each recorded error, locate the log file and line number, then read 50 lines before and 50 lines after the error. Use this information to characterize the error. Think about whether this error is transient and think about where in the stack the error occurs. Does it occur in the cloud infra, the openshift or prow ci-config, the hypvervisor, or is it a legitimate test failure? If it is a legitimate test failure, determine what stage of the test failed: setup, testing, teardown. |
| 79 | + |
| 80 | +3. **Analyze the error**: Based on the context of the error, think hard about whether this error caused the test to fail, is a transient error, or is a red herring. |
| 81 | + |
| 82 | + 3.1 If it is a legitimate test error, analyze the test logs to determine the source of the error. |
| 83 | + 3.2 If the source of the error appears to be due to microshift or a workload running on microshift, analyze the sos report's microshift journal and pod logs. |
| 84 | + |
| 85 | +4. **Produce a report**: Create a concise report of the error. The report MUST specify: |
| 86 | + - Where in the pipeline the error occurred |
| 87 | + - The specific step the error occurred in |
| 88 | + - Whether the test failure was legitimate (i.e., a test failed) or due to an infrastructure failure (i.e., build image was not found, AWS infra failed due to quota, hypervisor failed to create test host VM, etc.) |
| 89 | + |
| 90 | +# Tips |
| 91 | + |
| 92 | +1. There are many setup and teardown stages so fatal errors may be buried by log output from the teardown phase. It is not common to find the fatal error at the end of the log. |
| 93 | +2. You can quickly determine the failed step from the build-log.txt by reading the last `Running step e2e-aws-tests-bootc-nightly-openshift-microshift-e2e-metal-tests` line before the container logs appear. |
| 94 | + |
| 95 | +# Output Template |
| 96 | + |
| 97 | +Use this template for your error analysis reports: |
| 98 | + |
| 99 | +``` |
| 100 | +Error Severity: {1-5} |
| 101 | +Stack Layer: {AWS Infra, build phase, deploy phase, test, etc.} |
| 102 | +Step Name: {The specific step where the error occurred} |
| 103 | +Error: {The exact error, including additional log context if it relates to the failure} |
| 104 | +Suggested Remediation: {Based on where the error occurs, think hard about how to correct the error ONLY if it requires fixing. Infrastructure failures may not require code changes.} |
| 105 | +``` |
0 commit comments