Skip to content
Open
54 changes: 52 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ env:
${{ github.workspace }}/packages/ember/*.d.ts
${{ github.workspace }}/packages/gatsby/*.d.ts

# Avoid '*' here: upload-artifact flattens paths after the first wildcard (drops the packages/ prefix).
CACHED_BUILD_LAYER_PATHS: |
${{ github.workspace }}/packages/aws-serverless/build/aws

BUILD_CACHE_TARBALL_KEY: tarball-${{ github.event.inputs.commit || github.sha }}

# GH will use the first restore-key it finds that matches
Expand Down Expand Up @@ -164,6 +168,40 @@ jobs:
changed_browser_integration:
${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected,
'@sentry-internal/browser-integration-tests') }}
changed_aws_serverless:
${{ needs.job_get_metadata.outputs.changed_ci == 'true' || contains(steps.checkForAffected.outputs.affected,
'@sentry/aws-serverless') }}

job_build_layer:
name: Build Lambda layer
needs: [job_get_metadata, job_build]
if: needs.job_build.outputs.changed_aws_serverless == 'true' || github.event_name != 'pull_request'
Comment thread
sentry[bot] marked this conversation as resolved.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E2E test fails when layer artifact is missing

Medium Severity

The job_build_layer condition checks only if @sentry/aws-serverless is in the Nx affected list, but the E2E matrix includes aws-serverless whenever any Sentry dependency of the test app is affected. The aws-serverless E2E app also depends on @sentry-internal/test-utils. If a PR changes only test-utils, job_build_layer is skipped (no build-layer-output artifact uploaded), yet the aws-serverless E2E test is still included in the matrix and attempts to download the missing artifact, causing a CI failure.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f1e1d97. Configure here.

timeout-minutes: 10
runs-on: ubuntu-24.04
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v6
with:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Build Lambda layer
run: yarn build:layer

- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: build-layer-output
path: ${{ env.CACHED_BUILD_LAYER_PATHS }}
retention-days: 4
compression-level: 6
overwrite: true

job_check_branches:
name: Check PR branches
Expand Down Expand Up @@ -298,7 +336,7 @@ jobs:

job_artifacts:
name: Upload Artifacts
needs: [job_get_metadata, job_build]
needs: [job_get_metadata, job_build, job_build_layer]
runs-on: ubuntu-24.04
# Build artifacts are only needed for releasing workflow.
if: needs.job_get_metadata.outputs.is_release == 'true'
Expand All @@ -316,6 +354,11 @@ jobs:
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Restore build layer artifacts
uses: actions/download-artifact@v7
with:
name: build-layer-output
Comment thread
cursor[bot] marked this conversation as resolved.

Comment thread
sentry[bot] marked this conversation as resolved.
- name: Pack tarballs
run: yarn build:tarball

Expand Down Expand Up @@ -902,7 +945,7 @@ jobs:
# See: https://github.com/actions/runner/issues/2205
if:
always() && needs.job_e2e_prepare.result == 'success' && needs.job_e2e_prepare.outputs.matrix != '{"include":[]}'
needs: [job_get_metadata, job_build, job_e2e_prepare]
needs: [job_get_metadata, job_build, job_build_layer, job_e2e_prepare]
Comment thread
sentry[bot] marked this conversation as resolved.
runs-on: ubuntu-24.04
timeout-minutes: 15
env:
Expand Down Expand Up @@ -948,6 +991,12 @@ jobs:
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Restore build layer artifacts
uses: actions/download-artifact@v7
if: matrix.test-application == 'aws-serverless'
with:
name: build-layer-output
Comment thread
sentry[bot] marked this conversation as resolved.
Comment thread
sentry[bot] marked this conversation as resolved.

- name: Restore tarball cache
uses: actions/cache/restore@v5
id: restore-tarball-cache
Expand Down Expand Up @@ -1134,6 +1183,7 @@ jobs:
job_check_lockfile,
job_check_format,
job_circular_dep_check,
job_build_layer,
job_size_check,
]
# Always run this, even if a dependent job failed
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"private": true,
"scripts": {
"build": "node ./scripts/verify-packages-versions.js && nx run-many -t build:transpile build:types build:bundle build:layer",
"build": "node ./scripts/verify-packages-versions.js && nx run-many -t build:transpile build:types build:bundle",
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
"build:bundle": "nx run-many -t build:bundle",
"build:layer": "nx run-many -t build:layer",
"build:dev": "nx run-many -t build:types build:transpile",
"build:dev:filter": "nx run-many -t build:dev -p",
"build:transpile": "nx run-many -t build:transpile",
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-serverless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@vercel/nft": "^1.3.0"
},
"scripts": {
"build": "run-p build:transpile build:types build:extension && run-s build:layer",
"build": "run-p build:transpile build:types build:extension",
"build:extension": "rollup -c rollup.lambda-extension.config.mjs && yarn ts-node scripts/buildLambdaExtension.ts",
"build:layer": "rimraf build/aws && yarn ts-node scripts/buildLambdaLayer.ts",
"build:dev": "run-p build:transpile build:types",
Expand Down
Loading