Skip to content

build: fix dd-trace-py git overrides and filter publish layer check#824

Open
joeyzhao2018 wants to merge 2 commits intomainfrom
joey/enhance-build-scripts
Open

build: fix dd-trace-py git overrides and filter publish layer check#824
joeyzhao2018 wants to merge 2 commits intomainfrom
joey/enhance-build-scripts

Conversation

@joeyzhao2018
Copy link
Copy Markdown
Contributor

@joeyzhao2018 joeyzhao2018 commented May 8, 2026

Summary

Two small build-script fixes I hit while trying to build a single layer from a dd-trace-py feature branch:

  1. scripts/build_layers.shDD_TRACE_COMMIT and DD_TRACE_COMMIT_BRANCH were broken. Both paths build dd-trace-py from a git checkout, but the script wrote ddtrace_serverless = { git = ... } into pyproject.toml. Source checkouts publish project metadata as ddtrace, not ddtrace_serverless — the ddtrace_serverless variant only exists as pre-built wheels from dd-trace-py's CI (consumed via UPSTREAM_PIPELINE_ID). pip rejected the install with:

    Requested ddtrace from git+...@ has inconsistent name: expected 'ddtrace-serverless', but metadata has 'ddtrace'

    Fix: hard-code ddtrace as the package name in the two git-override branches. DD_TRACE_WHEEL and UPSTREAM_PIPELINE_ID paths are unchanged, so the release pipeline is unaffected.

  2. scripts/publish_layers.sh — the pre-flight check looped over the full hard-coded LAYER_PATHS (14 entries) and bailed if any zip was missing, even when LAYERS was set to a single layer. So you couldn't publish one layer without first building all 14 zips. Moved the check to after LAYERS is resolved, and only verify files for layers we'll actually publish. When LAYERS is unset it still resolves to all available layers, so the default behavior (and the release pipeline that builds all layers) is unchanged.

Backwards compatibility

  • DD_TRACE_WHEEL / UPSTREAM_PIPELINE_ID / no-override default → unchanged.
  • LAYERS unset → still requires all 14 zips, identical to before.
  • Only relaxes one check and unbreaks two previously-broken env-var paths; nothing tightens.

Test plan

  • DD_TRACE_COMMIT_BRANCH=<branch> PYTHON_VERSION=12 ./scripts/build_layers.sh produces datadog_lambda_py-{amd64,arm64}-3.12.zip.
  • VERSION=N REGIONS=us-east-2 LAYERS=Datadog-Python312 ./scripts/publish_layers.sh proceeds past the existence check with only the 3.12 amd64 zip built.
  • Existing release-pipeline invocations (UPSTREAM_PIPELINE_ID=..., no LAYERS filter) continue to work.

- build_layers.sh: force the `ddtrace` package name when overriding via
  DD_TRACE_COMMIT or DD_TRACE_COMMIT_BRANCH. Git source builds always
  produce the `ddtrace` package; the `ddtrace_serverless` variant only
  exists as pre-built S3 wheels from dd-trace-py CI, so the previous
  `${wheel_basename}` substitution caused pip to reject the install
  with a name/metadata mismatch.
- publish_layers.sh: only require layer zips for the layers in LAYERS,
  rather than unconditionally requiring all 14 entries in LAYER_PATHS.
  When LAYERS is unset it still defaults to all layers, so release
  pipelines that build everything are unaffected.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@joeyzhao2018 joeyzhao2018 requested review from a team as code owners May 8, 2026 03:13
@rithikanarayan
Copy link
Copy Markdown
Contributor

I'm not sure if I'm mixing up two things here, but problem 1 might be getting solved by DataDog/dd-trace-py#17964?

@joeyzhao2018
Copy link
Copy Markdown
Contributor Author

I'm not sure if I'm mixing up two things here, but problem 1 might be getting solved by DataDog/dd-trace-py#17964?

@rithikanarayan Yeah, probably. We can close this pr if that one get merged and working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants