ci: install upstream ddtrace wheel during PR-triggered unit tests#813
Open
purple4reina wants to merge 1 commit intomainfrom
Open
ci: install upstream ddtrace wheel during PR-triggered unit tests#813purple4reina wants to merge 1 commit intomainfrom
purple4reina wants to merge 1 commit intomainfrom
Conversation
6 tasks
Contributor
Author
|
Confirmed the connection is working between this and dd-trace-py. PR used the latest from main in this pipeline https://gitlab.ddbuild.io/DataDog/datadog-lambda-python/-/jobs/1650520618 |
Contributor
Author
|
Tests are failing because we haven't yet merged #812 |
4df314b to
cd985ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Plumbs
UPSTREAM_PIPELINE_ID(set by dd-trace-py'sserverless lambda testsjob when it triggers this repo's pipeline) into the unit-test, lint, and publish-pypi jobs so they exercise the dd-trace-py PR's wheel instead of the released ddtrace.scripts/_spec_ddtrace_dep.sh— shared helper that rewritespyproject.toml's ddtrace dep based onDD_TRACE_COMMIT>DD_TRACE_COMMIT_BRANCH>DD_TRACE_WHEEL>UPSTREAM_PIPELINE_ID(in that precedence). For the S3 path it tries the smallerddtrace_serverlesswheel first and falls back toddtrace.scripts/setup_python_env.sh— replaces the inline.python-before-scriptanchor. Backs uppyproject.toml, sources the helper, rewrites the dep, thenpip install .[dev]resolves the whole graph in one pass.scripts/build_layers.sh— drops 60+ lines of inline duplicated logic and sources the same helper.ci/input_files/build.yaml.tpl— removes.python-before-scriptanchor;lint python,unit-test,publish-pypi-packagenow callsetup_python_env.sh.Motivation
dd-trace-py's
serverless lambda testsjob triggers this repo's CI on every dd-trace-py PR, passingUPSTREAM_PIPELINE_ID.build_layers.shcorrectly used that ID to pull the PR's wheel for the layer build, but theunit-testjob ranpip install .[dev]against the released ddtrace — so dd-trace-py PRs that broke lambda-python imports went undetected.That's how dd-trace-py v4.8.0 shipped and required emergency hotfix #811 (
fix: pin ddtrace to <4.8.0 to avoid import errors).Testing Guidelines
UPSTREAM_PIPELINE_ID→spec_ddtrace_depis a no-op → released ddtrace is used → tests pass.UPSTREAM_PIPELINE_IDset to a recent dd-trace-py main pipeline ID; theunit-testjob should fetch the upstream wheel from S3 and exercise it.Additional Notes
pyproject.tomlbeforepip install .[dev](rather thanpip install --force-reinstall-ing the wheel afterward) lets pip surface conflicts as install errors instead of test-time surprises if a dd-trace-py PR adds new deps or tightens version pins.build_layers.shusedddtrace_serverlessas the dep name on the git/file paths, but the dockerpip installruns withoutDD_SERVERLESS_BUILD=1and produces addtrace-named dist that wouldn't have matched. The new helper usesddtraceconsistently for the git paths; theddtrace_serverlessname is only used when actually pulling a serverless-built wheel from S3.DD_TRACE_COMMIT/DD_TRACE_COMMIT_BRANCHbuild ddtrace from source and require cargo + cmake + a C/C++ toolchain — intended for local repro / git-bisect, not CI.Types of Changes
Check all that apply