Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-67237] BuildTrigger waits until the dependency graph has been updated - 2nd attempt #6450

Merged
merged 7 commits into from
Apr 27, 2022

Conversation

Si-So
Copy link
Contributor

@Si-So Si-So commented Apr 8, 2022

See JENKINS-67237.

The first PR caused this regression. This PR is the 2nd attempt at solving JENKINS-67237 without causing a regression.

Proposed changelog entries

  • When triggering a new build while the build graph is currently being re-computed, jenkins waits for the re-computation to finish. This gurantees that recently updated build triggers are executed.

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change) and are in the imperative mood. Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadoc, as appropriate.
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@res0nance
@timja

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@Si-So
Copy link
Contributor Author

Si-So commented Apr 8, 2022

I created a TC to detect the regression. I expect that only the new TC will fail during the currently running build.

I have also prepared a fix for the regression that I will push once the currently running build is done.

@Si-So
Copy link
Contributor Author

Si-So commented Apr 11, 2022

As predicted only the newly added TC failed.

I have now pushed a fix for the regression and expect no failing unit tests during this run.


synchronized (dependencyGraphLock) {
//Wait for the currently running calculation to finish
if (calculatingFutureDependencyGraph != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Because of how this works, potentially a call to rebuildDependencyGraphAsync will block which defeats the original purpose of the function. This needs a rethink

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks yet again for your feedback. I just pushed a new commit.

I also noticed another bug: getFutureDependencyGraph does not return the most recent dependency graph if the most recent dependency graph has been calculated synchronously. This is problematic because BuildTrigger.execute assumes that getFutureDependencyGraph will always return the most recent dependency graph. To fix this problem calculatingFutureDependencyGraph is now set to null in scheduleCalculationOfFutureDependencyGraph after the calculation has finished.

@basil basil added the needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging label Apr 15, 2022
…ndencyGraph

1) scheduleCalculationOfFutureDependencyGraph does no longer potentially block rebuildDependencyGraphAsync
2) getFutureDependencyGraph returns the most recent dependency graph calculated by either rebuildDependencyGraphAsync or rebuildDependencyGraph
@Si-So Si-So requested a review from res0nance April 22, 2022 07:16
@basil basil added bug For changelog: Minor bug. Will be listed after features and removed needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging labels Apr 22, 2022
Copy link
Contributor

@res0nance res0nance left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

I pushed a minor commit to clean up the formatting. Thanks for taking care of this!


This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process. Thanks!

@basil basil added ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog labels Apr 25, 2022
@basil basil merged commit c350527 into jenkinsci:master Apr 27, 2022
@basil basil removed the skip-changelog Should not be shown in the changelog label May 4, 2022
@basil
Copy link
Member

basil commented May 4, 2022

The skip-changelog label was added by mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants