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-45748 Wrong organization URL on PR build notifications #8

Merged
merged 3 commits into from Jul 25, 2017

Conversation

i386
Copy link
Contributor

@i386 i386 commented Jul 25, 2017

@i386 i386 requested a review from imeredith July 25, 2017 01:55
@i386
Copy link
Contributor Author

i386 commented Jul 25, 2017

Passing locally here but not on CI :/

@i386 i386 removed the request for review from imeredith July 25, 2017 06:47
@alvarolobato
Copy link
Member

@i386 I think that the failure may be related to a null org or something similar. I had this code for this problem but didn't have time to test it well https://github.com/alvarolobato/blueocean-display-url-plugin/tree/JENKINS-45748 I'll have a look at what is failing on your PR.

@alvarolobato
Copy link
Member

Nevermind it seems to have been something related to git and the CI it is working for me locally too.

@alvarolobato
Copy link
Member

@i386 I've been testing this and there seems to be something wrong.

I've created a PR and the link goes to:
/blue/organizations/alvaro-team/org-base-folder%2Fcloudbees%2Ftest-mvn-app/detail/alvarolobato-patch-1/1/pipeline

instead of

/blue/organizations/alvaro-team/cloudbees%2Ftest-mvn-app/detail/alvarolobato-patch-1/1/pipeline

Notice the org-base-folder I think this is because the base of the organization is being taken from the root of jenkins instead of the real base of the org.

Let me find where this is happening.

Copy link
Member

@alvarolobato alvarolobato left a comment

Choose a reason for hiding this comment

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

The url resolution when the organization is not on the root, doesn't seem to be working.

}

private String getJobURL(BlueOrganization organization, Job<?, ?> job) {
String jobPath = job.getParent() instanceof MultiBranchProject ? job.getParent().getFullName() : job.getFullName();
Copy link
Member

Choose a reason for hiding this comment

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

So this is where I think the problem is. Instead of getFullName it should be using:

Functions.getRelativeNameFrom(item, group);

where group is the org.getGroup

Like here:

https://github.com/jenkinsci/blueocean-plugin/blob/8fb7b65591aeca64512c7b6e022befcb20cd6aa6/blueocean-rest-impl/src/main/java/io/jenkins/blueocean/service/embedded/rest/AbstractPipelineImpl.java#L177-L194


return getRoot() + "organizations/jenkins/" + jobPath + "/";
private String getJobURL(BlueOrganization organization, MultiBranchProject<?, ?> project) {
return String.format("%sorganizations/%s/%s/", getRoot(), Util.rawEncode(organization.getName()), Util.rawEncode(project.getFullName()));
Copy link
Member

Choose a reason for hiding this comment

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

The same happens here

@alvarolobato
Copy link
Member

@i386 I've created a PR with a proposal to improve your PR, feel free to change whatever you want.

#9

Thanks

@i386 i386 merged commit d76814f into master Jul 25, 2017
@i386 i386 deleted the bug/JENKINS-45748 branch July 25, 2017 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants