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-71616] Use full project name instead of related name for comparing job names #490

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,12 @@ private void cancelMatchingJobs(GerritTriggeredEvent event, String jobName, Caus
List<Queue.Item> itemsInQueue = Queue.getInstance().getItems((Queue.Task)getJob());
for (Queue.Item item : itemsInQueue) {
if (checkCausedByGerrit(event, item.getCauses())) {
if (jobName.equals(item.task.getName())) {
// Use transformed fullDisplayNameFor to avoid
// ambigous comparing between same name projects but located at different folders
// FolderName » jobName to FolderName/jobName
if (jobName.equals(item.task.getFullDisplayName().replace(" » ", "/"))) {
Copy link
Member

Choose a reason for hiding this comment

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

The problem here is that the displayName can be anything and change almost at any time and doesn't need to be anything like jobName that is gained from getName/getFullName

Copy link
Author

Choose a reason for hiding this comment

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

Another option is change the strict comparison between jobNames to regexp something like ".*jobName$"
But in this case we will have collision with projects located at the different projects folders with same names. This is quite less possible scenario, then I'm going to fix.
@rsandell what do you think is it ok to fix it this way?

Queue.getInstance().cancel(item);

}
}
}
Expand Down