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

Enhanced project keys #60

Merged
merged 2 commits into from
May 21, 2015
Merged

Enhanced project keys #60

merged 2 commits into from
May 21, 2015

Conversation

scaytrase
Copy link
Member

Here is implementation for two options

  • Custom persist project key for a job (Fix Please provide per Jenkins-Project Key setting #36 )
  • Option to prepend parent project name for nested project (i.e maven subprojects). This helps to different jobs operating subprojects with same name to keep different notifications instead of overriding each other.

All changes should be BC as disabled on empty (by default). All changes built and tested on my own jenkins installation.

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@gruetter
Copy link
Member

Hey @scaytrase - thanks a bunch for your PR! Works great here. I'll review the code and merge later today.

@scaytrase
Copy link
Member Author

@gruetter Ok, tell me if I can do something more here

} catch (IOException e) {
logger.println("Unable to expand commit SHA value");
e.printStackTrace(logger);
return null;
Copy link
Member

Choose a reason for hiding this comment

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

if you return null here, you would set null as the value of the JSON key key in line 662 above, which doesn't check for a null value returned by this method. Instead, I propose to log an error message like you do but instead use the project name as a default key.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also see some forgotten copy-paste by me from here. I'll fix that.

@gruetter
Copy link
Member

Finished the review, @scaytrase . Besides the null issue, all minor findings.

@scaytrase
Copy link
Member Author

Thanks, @gruetter I'll try to fix all today or at least tomorrow morning

@scaytrase
Copy link
Member Author

well, cloudbees automerge now fails. should I rebase or something like?

}
}

String overriddenKey = (projectKey != null && projectKey.trim().length() > 0) ? projectKey : getDescriptor().getProjectKey();
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure it is the best way to check that parameter is not empty. Is this correct? projectKey is never set up at global configuration, so I can miss something due to I'm new to Jenkins API

Copy link
Member

Choose a reason for hiding this comment

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

I'm not much of a Jenkins pro either but your code looks good to me. I used the same approach and it has worked just fine in the past.

* Option to override project key for a certain project
* Option to prepend project key with parent project
@scaytrase
Copy link
Member Author

@gruetter Rebased.

I've updated logic to prepend parent key (if checked) even if override key logic selected. After your review I thought that this makes more sense.

@gruetter
Copy link
Member

Looks all good to me know. I'll merge. Thanks for following up @scaytrase . Great contribution.

gruetter added a commit that referenced this pull request May 21, 2015
@gruetter gruetter merged commit f920971 into jenkinsci:develop May 21, 2015
@scaytrase
Copy link
Member Author

Thank you for good plugin we can contribute to! 👍

@scaytrase scaytrase deleted the feature/enhanced-project-keys branch May 22, 2015 12:48
mdkf pushed a commit to mdkf/stashnotifier-plugin that referenced this pull request Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants