Skip to content

Redirect to new build on rebuild#854

Merged
timja merged 12 commits intojenkinsci:mainfrom
lewisbirks:update-next-build-link
Jun 19, 2025
Merged

Redirect to new build on rebuild#854
timja merged 12 commits intojenkinsci:mainfrom
lewisbirks:update-next-build-link

Conversation

@lewisbirks
Copy link
Contributor

@lewisbirks lewisbirks commented Jun 17, 2025

Closes #638

It does not appear to be currently possible to display a link in the notification which would be the ideal place to put a link to the scheduled build. Instead we just redirect to the new build once it is available.

The flow is:

  • Hit rebuild
  • Notification appears
  • Polling for build starts
  • Redirection once build is available

Testing done

Manual testing with simple use cases, no delays in launching a build or anything like that.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
@timja timja added the enhancement New feature or request label Jun 17, 2025
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
@lewisbirks lewisbirks marked this pull request as ready for review June 18, 2025 14:35
@lewisbirks lewisbirks requested a review from a team as a code owner June 18, 2025 14:35
Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
@lewisbirks lewisbirks changed the title Update next build link Redirect to new build on rebuild Jun 18, 2025
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

One question, rest looks good

Comment on lines +409 to +412
int offset = ((int) Math.log10(run.getNumber()) + 1) + 1 + URL_NAME.length() + 1 + 9;
String original = req.getRequestURI();
String prefix = original.substring(0, original.length() - offset);
String url = prefix + nextRun.getNumber() + "/" + URL_NAME + "/";
Copy link
Member

Choose a reason for hiding this comment

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

What is all this?

Can't you just do something like?

nextRun.getUrl() + "/" + URL_NAME + "/"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, of course 🤦

Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

LGTM!

@timja timja merged commit 0f7702e into jenkinsci:main Jun 19, 2025
17 checks passed
@lewisbirks lewisbirks deleted the update-next-build-link branch June 19, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add link to started build

2 participants