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

Add the missing forward slash to run relative url #369

Merged

Conversation

gbhat618
Copy link
Contributor

@gbhat618 gbhat618 commented Feb 13, 2025

A Run object URL in Jenkins should end with a forward slash. Pipeline stage view run object is not attaching the forward slash - Jenkins has a mechanism to automatically redirect from the non forward slash to with forward slash so it is not a visible problem to the user.

Redirection happening in Jenkins core

However as we can see it still wastes a network call.

Description Screenshot
Notice a first request returned with 302, and then the proper request comes with 200 image

This issue was found via the CBCI high availability controller we noticed it was flagged for builds currently in execution (these kind of cases are deliberately caught so to fix in the upstream source).

Fixing it in here would be the correct fix, as it also reduces one network call to the server.

Testing

  • fixed the automated test failures
  • manual testing
Screenshots before and after
Description Before Screenshot After Screenshot
Hoverover the run id to see the resolved full URL image image
Browser inspect show the relative URL correctly fixed image image
Opening a run page does have redirects anymore - see single call image image

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 demonstrates feature works or fixes the issue

@gbhat618 gbhat618 requested a review from a team as a code owner February 13, 2025 15:22
@gbhat618
Copy link
Contributor Author

gbhat618 commented Feb 13, 2025

(looking at the test failure -- Edit: fixed)

@gbhat618 gbhat618 marked this pull request as draft February 13, 2025 15:38
@gbhat618 gbhat618 force-pushed the add-forward-slash-to-run-relative-url branch from 955ed8d to dd87c38 Compare February 13, 2025 16:38
@gbhat618 gbhat618 force-pushed the add-forward-slash-to-run-relative-url branch from dd87c38 to 2c92a4e Compare February 13, 2025 16:38
@gbhat618 gbhat618 marked this pull request as ready for review February 13, 2025 16:51
@@ -43,7 +43,7 @@
<td class="stage-start">
<div class="cell-color">
<div class="cell-box">
<div class="jobName"><span class="badge"><a href="{{this.id}}">{{this.name}}</a></span></div>
<div class="jobName"><span class="badge"><a href="{{#if this.id}}{{this.id}}/{{/if}}">{{this.name}}</a></span></div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

instead of just doing "{{this.id}}/" I have added the #if... because in the test fixtures there are blanks expected;

I am not sure if it is correct or not; how the runId can be null or empty 🤔 while the run name is there..

I thought I would simply update the blank href to corresponding runIds, and also fix the fixture json files;
but then I wasn't sure if it was deliberately made like this..

@jglick jglick added the bug label Feb 13, 2025
@jglick jglick merged commit d99b569 into jenkinsci:master Feb 13, 2025
16 checks passed
@jglick
Copy link
Member

jglick commented Feb 13, 2025

@olamy please release, or better yet https://www.jenkins.io/doc/developer/publishing/releasing-cd/

@gbhat618 gbhat618 deleted the add-forward-slash-to-run-relative-url branch February 14, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants