You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing PR number in CiVisibilityRepoServices implementation #9295
It is expected that when running tests against a pull request, the PR metadata will be obtained from the Git provider and populated with all available data. In this case, the PR number is available (as demonstrated in the GithubActionsInfo implementation), so our expectation is that CiVisibilityRepoServices would obtain and use the same information. It appears an instance of CIProviderInfo is available in the execution context for use.
Reproduction Code
The code in CiVisibilityRepoServices explicitly sets the prNumber field to null via the PullRequestInfo constructor.
The buildUserPullRequestInfo method creates PR info from environment variables that are manually set by the users (DD_GIT_PULL_REQUEST_BASE_BRANCH and DD_GIT_PULL_REQUEST_BASE_BRACH_SHA). This is a workaround for the CI providers where PR info cannot be extracted automatically. We do not support manually providing PR number (although we probably should), hence the explicit null assignment in that method.
The caller of this method -buildPullRequestInfo - also calls ciProviderInfo.buildPullRequestInfo() to get PR information supplied by the CI provider. The results of the two calls are merged, with the manually provided info having higher priority.
The relevant change in the PR is done in the GithubActionsInfo class:
Double number = (Double) pullRequest.get("number");
if (number != null) {
prNumber = String.valueOf(number.intValue());
}
Activity
nikita-tkachenko-datadog commentedon Aug 1, 2025
Hi @mlschechter, thank you for reporting this issue. It is addressed in #9210 that will be released with v1.52.0 scheduled for the 4th of August
mlschechter commentedon Aug 1, 2025
@nikita-tkachenko-datadog - Thanks for the quick response!
I'm a bit confused as to how that PR (which was merged to
master) will fix the issue, as I am seeing the explicitnullassignment in the code there.Is there something I'm missing?
nikita-tkachenko-datadog commentedon Aug 1, 2025
The
buildUserPullRequestInfomethod creates PR info from environment variables that are manually set by the users (DD_GIT_PULL_REQUEST_BASE_BRANCHandDD_GIT_PULL_REQUEST_BASE_BRACH_SHA). This is a workaround for the CI providers where PR info cannot be extracted automatically. We do not support manually providing PR number (although we probably should), hence the explicitnullassignment in that method.The caller of this method -
buildPullRequestInfo- also callsciProviderInfo.buildPullRequestInfo()to get PR information supplied by the CI provider. The results of the two calls are merged, with the manually provided info having higher priority.The relevant change in the PR is done in the
GithubActionsInfoclass:mlschechter commentedon Aug 1, 2025
Got it - thanks for the clarification!
If I'm following correctly, that change is used here, and will overwrite the explicit
nullI found in the earlier generation ofuserInfo.Please let me know if I should close this issue out.
nikita-tkachenko-datadog commentedon Aug 4, 2025
Exactly, your understanding is correct!
I will go ahead and close the issue, feel free to reopen if the upcoming release doesn't fix it