Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
The pull request must only fix one issue at the time.
The pull request must update the test suite to demonstrate the changed functionality.
After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.
What does this PR do?
Update BuildData creation logic: when a new instance is created, a check is made to see whether the associated run already refers to another instance that was created and updated during previous pipeline stages.
If there is a previously created instance, it is used to populate Git values in the new instance, in case they are missing.
For instance, if there are environment variables that are set inside a pipeline stage (e.g. Git branch and repo URL that are set during SCM checkout), these variables will only be available during that stage: later stages will not be able to use them.
The fallback mechanism ensures that these variables are propagated whenever a new BuildData instance is created at some later point.
Requirements for Contributing to this repository
What does this PR do?
Update
BuildData
creation logic: when a new instance is created, a check is made to see whether the associated run already refers to another instance that was created and updated during previous pipeline stages. If there is a previously created instance, it is used to populate Git values in the new instance, in case they are missing.For instance, if there are environment variables that are set inside a pipeline stage (e.g. Git branch and repo URL that are set during SCM checkout), these variables will only be available during that stage: later stages will not be able to use them. The fallback mechanism ensures that these variables are propagated whenever a new
BuildData
instance is created at some later point.This fixes https://datadoghq.atlassian.net/browse/AGENT-10162
Description of the Change
Alternate Designs
Possible Drawbacks
Verification Process
Verified manually using a dockerized Jenkins instance.
Additional Notes
Release Notes
Review checklist (to be filled by reviewers)
changelog/
label attached. If applicable it should have thebackward-incompatible
label attached.do-not-merge/
label attached.kind/
andseverity/
labels attached at least.