diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index fa0c8a7ce..ec5c3423b 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -22,11 +22,6 @@ on: required: false type: boolean default: false - l3Ref: - description: aws/agentcore-l3-cdk-constructs ref the Box tests deploy with (branch, tag, or commit) - required: false - type: string - default: box-integration region: description: AWS region to deploy and test in; empty uses the E2E_REGION variable, else us-east-1 required: false @@ -49,10 +44,6 @@ on: description: Run E2E tests only on Linux type: boolean default: false - l3Ref: - description: aws/agentcore-l3-cdk-constructs ref the Box tests deploy with (branch, tag, or commit) - type: string - default: box-integration region: description: AWS region to deploy and test in; empty uses the E2E_REGION variable, else us-east-1 type: string @@ -199,40 +190,15 @@ jobs: - name: Allow user namespaces for box if: matrix.name == 'Linux-arm64' run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - # No released @aws/agentcore-cdk deploys a Box project yet, so on the runners that run the Box - # tests, they deploy with one built from aws/agentcore-l3-cdk-constructs at inputs.l3Ref. That - # repository is private and this job's GITHUB_TOKEN reads only this one, so the token comes - # from the repository's GitHub App, scoped to the L3 repository and read-only. - - name: Generate a read token for the L3 constructs - if: matrix.name == 'macOS' || matrix.name == 'Linux-arm64' - id: l3-token - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 - with: - app-id: ${{ vars.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: aws - repositories: agentcore-l3-cdk-constructs - permission-contents: read - - name: Check out the L3 constructs - if: matrix.name == 'macOS' || matrix.name == 'Linux-arm64' - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: aws/agentcore-l3-cdk-constructs - ref: ${{ inputs.l3Ref || 'box-integration' }} - token: ${{ steps.l3-token.outputs.token }} - path: .l3-cdk - # Leave no token in .l3-cdk/.git for later steps. - persist-credentials: false - # Packed onto the runner only: nothing is published. The Box tests install it into each Box - # project's agentcore/cdk (AGENTCORE_E2E_BOX_CDK in e2eTest/project/templates.test.ts). - - name: Pack the L3 constructs for the Box tests + # The Box tests that deploy install the @aws/agentcore-cdk release that the CLI pins for new + # projects in src/assets/cdk/package.json (AGENTCORE_E2E_BOX_CDK in + # e2eTest/project/templates.test.ts), which deploys Box projects since 1.5.0. + - name: Use the pinned L3 constructs for the Box tests if: matrix.name == 'macOS' || matrix.name == 'Linux-arm64' - working-directory: .l3-cdk + shell: bash run: | - npm ci --no-audit --no-fund - npm run build - TARBALL=$(npm pack --ignore-scripts --pack-destination "$RUNNER_TEMP" | tail -n 1) - echo "AGENTCORE_E2E_BOX_CDK=file:${RUNNER_TEMP}/${TARBALL}" >> "$GITHUB_ENV" + VERSION=$(node -p 'require("./src/assets/cdk/package.json").dependencies["@aws/agentcore-cdk"]') + echo "AGENTCORE_E2E_BOX_CDK=${VERSION}" >> "$GITHUB_ENV" - name: Build CLI if: inputs.npmVersion == '' run: bun run build diff --git a/e2eTest/README.md b/e2eTest/README.md index 83398f23d..b854ca948 100644 --- a/e2eTest/README.md +++ b/e2eTest/README.md @@ -31,15 +31,13 @@ Linux arm64 runner (`ubuntu-24.04-arm`) have one: each installs the box that `src/core/project/backends/boxRelease.json` pins. `create` also installs the agent's dependencies and the CDK app's, which `dev` and `deploy` use, so the tests don't pass `--skip-install`. -The tests that deploy also need `AGENTCORE_E2E_BOX_CDK`: the pinned `@aws/agentcore-cdk` release -cannot deploy a Box project yet. Set it to an `@aws/agentcore-cdk` version or a `file:` tarball -that can, for example one packed from the `box-integration` branch of +The tests that deploy also need `AGENTCORE_E2E_BOX_CDK`: an `@aws/agentcore-cdk` version, or a +`file:` tarball, that deploys Box projects, which every release since 1.5.0 does. The tests install +it in the `agentcore/cdk` of each Box project that deploys. Without it, they skip. In CI, the macOS +and Linux arm64 runners set it to the version that `src/assets/cdk/package.json` pins. To test an +unreleased build, pack one from [agentcore-l3-cdk-constructs](https://github.com/aws/agentcore-l3-cdk-constructs) with -`npm run build && npm pack --ignore-scripts`. The tests install it in the `agentcore/cdk` of each -Box project that deploys. Without it, they skip. In CI, the macOS and Linux arm64 runners set it to -a tarball they build from agentcore-l3-cdk-constructs at the workflow's `l3Ref` input (default -`box-integration`), checked out with a read-only token from the repository's GitHub App. Remove -those steps once a released `@aws/agentcore-cdk` deploys Box projects and the pin is bumped. CI +`npm run build && npm pack --ignore-scripts` and set `AGENTCORE_E2E_BOX_CDK=file:`. CI also skips `agent_python_langchain_box` in the deploy tests: its AgentCore Runtime logs hold OpenTelemetry's `Failed to detach context` at ERROR level, which the log check refuses. @@ -51,7 +49,7 @@ listens on the protocol's fixed port (8080, 8000 or 9000), so the `dev` tests ru and need those ports free: ```sh -AGENTCORE_E2E_BOX_CDK=file:/path/to/aws-agentcore-cdk-1.1.0.tgz bun run test:e2e -- --tagsFilter='box' +AGENTCORE_E2E_BOX_CDK=1.5.0 bun run test:e2e -- --tagsFilter='box' ``` That runs each Box template on its default Python. The CodeZip box template on Python 3.10 to 3.13 diff --git a/e2eTest/project/templates.test.ts b/e2eTest/project/templates.test.ts index bd25a39b2..6e5bb49fb 100644 --- a/e2eTest/project/templates.test.ts +++ b/e2eTest/project/templates.test.ts @@ -1506,7 +1506,7 @@ async function createTemplateProject( await writeFile(specPath, `${JSON.stringify(spec, null, 2)}\n`); } if (deploys && runtime.box && BOX_CDK) { - // The pinned @aws/agentcore-cdk cannot deploy a Box project yet; use the opted-in build. + // Install the opted-in @aws/agentcore-cdk: in CI the pinned release, else one under test. const installed = await runCommand( "npm", ["install", "--no-audit", "--no-fund", `@aws/agentcore-cdk@${BOX_CDK}`],