Skip to content

Commit d352470

Browse files
committed
Rename integration-patch-repair to autofix-integration-failures
1 parent 9888241 commit d352470

8 files changed

Lines changed: 371 additions & 332 deletions

File tree

Lines changed: 38 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: integration-patch-repair
1+
name: autofix
22

33
on:
44
workflow_run:
@@ -12,12 +12,11 @@ permissions:
1212

1313
env:
1414
TARGET_RUN_ID: ${{ github.event.workflow_run.id }}
15-
REPAIR_SCRIPT: ./tests/ci/integration/integration_patch_repair/repair.sh
15+
AUTOFIX_SCRIPT: ./tests/ci/integration/autofix_integration_failures/autofix.sh
1616

1717
jobs:
18-
19-
get-failing-targets:
20-
name: get-failing-targets
18+
get-failing-integrations:
19+
name: get-failing-integrations
2120
if: >-
2221
github.event.workflow_run.event == 'schedule' &&
2322
github.event.workflow_run.conclusion == 'failure'
@@ -36,37 +35,35 @@ jobs:
3635
env:
3736
GH_TOKEN: ${{ github.token }}
3837
run: |
39-
set -eo pipefail
40-
targets=$("$REPAIR_SCRIPT" get-failing-targets "$TARGET_RUN_ID")
38+
targets=$("$AUTOFIX_SCRIPT" get-failing-targets "$TARGET_RUN_ID")
4139
echo "Targets: $targets"
4240
echo "targets=$targets" >> "$GITHUB_OUTPUT"
4341
- name: Download each failing integration's logs
4442
env:
4543
GH_TOKEN: ${{ github.token }}
4644
TARGETS: ${{ steps.targets.outputs.targets }}
4745
run: |
48-
set -eo pipefail
49-
echo "$TARGETS" | jq -r '.[]' | while IFS='|' read -r integration version; do
50-
"$REPAIR_SCRIPT" fetch-logs "$TARGET_RUN_ID" "$integration" "$version"
46+
echo "$TARGETS" | jq -r '.[] | "\(.integration)\t\(.version)"' \
47+
| while IFS=$'\t' read -r integration version; do
48+
"$AUTOFIX_SCRIPT" fetch-logs "$TARGET_RUN_ID" "$integration" "$version"
5149
done
5250
- uses: actions/upload-artifact@v4
5351
if: always()
5452
with:
55-
name: patch-repair-logs
56-
# Upload the whole tree so the <slug>/logs/ structure is preserved on
57-
# download; reason restores it to the same path repair.sh reads from.
58-
path: .integration-patch-repair/
53+
name: autofix-logs
54+
# Save the logs folder so the `reason` job find the logs.
55+
path: .autofix/
5956
if-no-files-found: ignore
6057

6158
reason:
62-
name: reason (${{ matrix.target }})
63-
needs: get-failing-targets
64-
if: needs.get-failing-targets.outputs.targets != '[]' && needs.get-failing-targets.outputs.targets != ''
59+
name: reason (${{ matrix.target.dir }})
60+
needs: get-failing-integrations
61+
if: needs.get-failing-integrations.outputs.targets != '[]' && needs.get-failing-integrations.outputs.targets != ''
6562
strategy:
6663
fail-fast: false
6764
max-parallel: 5
6865
matrix:
69-
target: ${{ fromJSON(needs.get-failing-targets.outputs.targets) }}
66+
target: ${{ fromJSON(needs.get-failing-integrations.outputs.targets) }}
7067
runs-on:
7168
- codebuild-aws-lc-ci-github-actions-${{ github.run_id }}-${{ github.run_attempt }}
7269
image:linux-5.0
@@ -84,7 +81,7 @@ jobs:
8481
persist-credentials: false
8582
- uses: ./.github/actions/configure-aws-credentials
8683
with:
87-
roleName: AwsLcGitHubActionPatchRepairReasoningRole
84+
roleName: AwsLcGitHubActionAutofixReasoningRole
8885
- name: Install Claude Code
8986
run: npm install -g @anthropic-ai/claude-code@2.1.161
9087
- name: Install Bash sandbox deps
@@ -94,43 +91,32 @@ jobs:
9491
- name: Download pre-fetched logs
9592
uses: actions/download-artifact@v4
9693
with:
97-
name: patch-repair-logs
98-
path: .integration-patch-repair/
94+
name: autofix-logs
95+
path: .autofix/
9996
continue-on-error: true
100-
# Turn the target (e.g. "openvpn|release/2.6") into a slug with no | or /
101-
# (e.g. "openvpn-release-2.6"), safe for artifact names and matching the
102-
# work dir repair.sh writes to.
103-
- name: Derive target slug
104-
id: slug
105-
env:
106-
TARGET: ${{ matrix.target }}
107-
run: |
108-
slug=${TARGET//[|\/]/-}
109-
slug=${slug%-}
110-
echo "dir=$slug" >> "$GITHUB_OUTPUT"
111-
- name: Repair the patch
97+
- name: Autofix the patch
11298
env:
113-
TARGET: ${{ matrix.target }}
99+
INTEGRATION: ${{ matrix.target.integration }}
100+
VERSION: ${{ matrix.target.version }}
114101
run: |
115-
set -exo pipefail
116-
IFS='|' read -r integration version <<< "$TARGET"
117-
"$REPAIR_SCRIPT" reason "$TARGET_RUN_ID" "$integration" "$version"
102+
set -x
103+
"$AUTOFIX_SCRIPT" reason "$TARGET_RUN_ID" "$INTEGRATION" "$VERSION"
118104
- uses: actions/upload-artifact@v4
119105
if: always()
120106
with:
121-
name: patch-repair-${{ steps.slug.outputs.dir }}
122-
path: .integration-patch-repair/${{ steps.slug.outputs.dir }}/
107+
name: autofix-${{ matrix.target.dir }}
108+
path: .autofix/${{ matrix.target.dir }}/
123109
if-no-files-found: ignore
124110

125111
upload:
126-
name: upload (${{ matrix.target }})
127-
needs: [get-failing-targets, reason]
128-
if: ${{ always() && needs.get-failing-targets.outputs.targets != '[]' && needs.get-failing-targets.outputs.targets != '' }}
112+
name: upload (${{ matrix.target.dir }})
113+
needs: [get-failing-integrations, reason]
114+
if: ${{ always() && needs.get-failing-integrations.outputs.targets != '[]' && needs.get-failing-integrations.outputs.targets != '' }}
129115
strategy:
130116
fail-fast: false
131117
max-parallel: 5
132118
matrix:
133-
target: ${{ fromJSON(needs.get-failing-targets.outputs.targets) }}
119+
target: ${{ fromJSON(needs.get-failing-integrations.outputs.targets) }}
134120
runs-on:
135121
- codebuild-aws-lc-ci-github-actions-${{ github.run_id }}-${{ github.run_attempt }}
136122
image:linux-5.0
@@ -141,26 +127,19 @@ jobs:
141127
persist-credentials: false
142128
- uses: ./.github/actions/configure-aws-credentials
143129
with:
144-
roleName: AwsLcGitHubActionPatchRepairUploadRole
145-
- name: Derive target slug
146-
id: slug
147-
env:
148-
TARGET: ${{ matrix.target }}
149-
run: |
150-
slug=${TARGET//[|\/]/-}
151-
slug=${slug%-}
152-
echo "dir=$slug" >> "$GITHUB_OUTPUT"
130+
roleName: AwsLcGitHubActionAutofixUploadRole
153131
- name: Download results from reason job
154132
uses: actions/download-artifact@v4
155133
with:
156-
name: patch-repair-${{ steps.slug.outputs.dir }}
157-
path: .integration-patch-repair/${{ steps.slug.outputs.dir }}/
134+
name: autofix-${{ matrix.target.dir }}
135+
path: .autofix/${{ matrix.target.dir }}/
158136
continue-on-error: true
159137
- name: Upload results to S3
160138
env:
161-
TARGET: ${{ matrix.target }}
139+
INTEGRATION: ${{ matrix.target.integration }}
140+
VERSION: ${{ matrix.target.version }}
162141
run: |
163-
set -exo pipefail
164-
export PATCH_REPAIR_BUCKET="${AWS_ACCOUNT_ID}-aws-lc-integration-patch-repair"
165-
IFS='|' read -r integration version <<< "$TARGET"
166-
"$REPAIR_SCRIPT" upload "$TARGET_RUN_ID" "$integration" "$version"
142+
set -x
143+
# Suffix must match S3_FOR_AUTOFIX_INTEGRATION_FAILURES in tests/ci/cdk/util/metadata.py
144+
export AUTOFIX_BUCKET="${AWS_ACCOUNT_ID}-aws-lc-autofix-integration-failures"
145+
"$AUTOFIX_SCRIPT" upload "$TARGET_RUN_ID" "$INTEGRATION" "$VERSION"

.github/workflows/integration_omnibus.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,7 @@ jobs:
438438
# that are purely informational and breakages are accepted.
439439
- name: Mark integration failure
440440
if: always() && steps.integration-test.outcome == 'failure' && github.event_name == 'schedule' && !matrix.allow_failure
441-
# Figure out which integration failed. The script filename
442-
# (run_postgres_integration.sh -> postgres) is the real name.
443-
# matrix.name ("postgresql") is just a label and can differ.
444-
# The script's argument is the version: libgit2 -> v1.9.4, openvpn -> release/2.6.
441+
445442
env:
446443
INTEGRATION_RUNNER_COMMAND: ${{ matrix.run }}
447444
run: |
@@ -453,7 +450,9 @@ jobs:
453450
454451
# Strip the path, run_ prefix, and _integration.sh suffix to get the
455452
# bare integration name (e.g. .../run_postgres_integration.sh -> postgres).
456-
integration=$(sed -E 's#.*/run_(.+)_integration\.sh#\1#' <<< "$script_path")
453+
integration=${script_path##*/} # .../run_postgres_integration.sh -> run_postgres_integration.sh
454+
integration=${integration#run_} # -> postgres_integration.sh
455+
integration=${integration%_integration.sh} # -> postgres
457456
version=${version//[\'\"]/} # strip quotes (e.g. pyopenssl '25.3.0')
458457
echo -e "${integration}\t${version}" > integration-failure.txt
459458

tests/ci/cdk/cdk/aws_lc_github_oidc_stack.py

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
aws_ecr as ecr,
88
aws_iam as iam,
99
aws_s3 as s3,
10-
Duration,
11-
RemovalPolicy,
1210
Stack,
1311
Environment,
1412
)
1513
from cdk.aws_lc_devicefarm_ci_stack import DeviceFarmCiProps
1614
from constructs import Construct
1715

1816
from util.metadata import (
19-
ECR_REPOS, GITHUB_REPO_OWNER, GITHUB_REPO_NAME, AWS_LC_METRIC_NS, IMAGE_STAGING_REPO, PRE_PROD_ACCOUNT, STAGING_GITHUB_REPO_NAME)
17+
ECR_REPOS, GITHUB_REPO_OWNER, GITHUB_REPO_NAME, AWS_LC_METRIC_NS, IMAGE_STAGING_REPO, PRE_PROD_ACCOUNT, STAGING_GITHUB_REPO_NAME, S3_FOR_AUTOFIX_INTEGRATION_FAILURES)
2018

2119

2220
class AwsLcGitHubOidcStack(Stack):
@@ -77,21 +75,20 @@ def __init__(
7775
self.docker_image_build_role.grant_assume_role(
7876
self.minimal_oidc_role)
7977

80-
81-
self.patch_repair_bucket = s3.Bucket(
82-
self, "aws-lc-integration-patch-repair",
83-
bucket_name=f"{env.account}-aws-lc-integration-patch-repair",
78+
self.autofix_bucket = s3.Bucket(
79+
self, "aws-lc-autofix-integration-failures",
80+
bucket_name=f"{env.account}-{S3_FOR_AUTOFIX_INTEGRATION_FAILURES}",
8481
block_public_access=s3.BlockPublicAccess.BLOCK_ALL,
8582
)
8683

87-
self.patch_repair_reasoning_role = create_patch_repair_reasoning_role(
88-
self, "AwsLcGitHubActionPatchRepairReasoningRole", env, self.minimal_oidc_role)
89-
self.patch_repair_reasoning_role.grant_assume_role(self.minimal_oidc_role)
84+
self.autofix_reasoning_role = create_autofix_reasoning_role(
85+
self, "AwsLcGitHubActionAutofixReasoningRole", env, self.minimal_oidc_role)
86+
self.autofix_reasoning_role.grant_assume_role(self.minimal_oidc_role)
9087

91-
self.patch_repair_upload_role = create_patch_repair_upload_role(
92-
self, "AwsLcGitHubActionPatchRepairUploadRole", self.minimal_oidc_role,
93-
self.patch_repair_bucket)
94-
self.patch_repair_upload_role.grant_assume_role(self.minimal_oidc_role)
88+
self.autofix_upload_role = create_autofix_upload_role(
89+
self, "AwsLcGitHubActionAutofixUploadRole", self.minimal_oidc_role,
90+
self.autofix_bucket)
91+
self.autofix_upload_role.grant_assume_role(self.minimal_oidc_role)
9592

9693

9794
def create_device_farm_role(scope: Construct, id: str,
@@ -300,11 +297,9 @@ def create_standard_github_actions_role(scope: Construct, id: str,
300297
return role
301298

302299

303-
def create_patch_repair_reasoning_role(scope: Construct, id: str,
300+
def create_autofix_reasoning_role(scope: Construct, id: str,
304301
env: typing.Union[Environment, typing.Dict[str, typing.Any]],
305302
principal: iam.IPrincipal) -> iam.Role:
306-
# The reasoning job runs the sandboxed agent. It needs Bedrock only -- no
307-
# write access anywhere, so a prompt-injected agent cannot reach S3 or the repo.
308303
return iam.Role(scope, id, role_name=id,
309304
assumed_by=iam.SessionTagsPrincipal(principal),
310305
inline_policies={
@@ -327,11 +322,9 @@ def create_patch_repair_reasoning_role(scope: Construct, id: str,
327322
})
328323

329324

330-
def create_patch_repair_upload_role(scope: Construct, id: str,
325+
def create_autofix_upload_role(scope: Construct, id: str,
331326
principal: iam.IPrincipal,
332327
bucket: s3.IBucket) -> iam.Role:
333-
# The upload job runs no agent -- it only copies the produced files to S3.
334-
# It gets PutObject on this one bucket and nothing else (no Bedrock).
335328
return iam.Role(scope, id, role_name=id,
336329
assumed_by=iam.SessionTagsPrincipal(principal),
337330
inline_policies={

tests/ci/cdk/util/metadata.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,9 @@
7070
"S3_FOR_WIN_DOCKER_IMG_BUILD", "aws-lc-windows-docker-image-build-s3"
7171
)
7272

73+
S3_FOR_AUTOFIX_INTEGRATION_FAILURES = EnvUtil.get(
74+
"S3_FOR_AUTOFIX_INTEGRATION_FAILURES", "aws-lc-autofix-integration-failures"
75+
)
76+
7377
GITHUB_PUSH_CI_BRANCH_TARGETS = r"(main|fips-\d{4}-\d{2}-\d{2}.*)"
7478
SCRUTINICE_PRINCIPAL_ROLE_ARN = "arn:aws:iam::222961743098:role/scrutini-ecr"

0 commit comments

Comments
 (0)