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-54401] NPE when parsing scm git revision date on PR branches #152

Merged
merged 2 commits into from
Nov 17, 2018
Merged

[JENKINS-54401] NPE when parsing scm git revision date on PR branches #152

merged 2 commits into from
Nov 17, 2018

Conversation

nfalco79
Copy link
Member

@nfalco79 nfalco79 commented Nov 5, 2018

Fix the retrieve of the commit informations for a HEAD source of a pullrequest branch.

This is a WIP because there are yet possible issues on commit informations when required by SCM traits.
The traits that decorate the source context with filters or prefilter are involved during the process of request before the revision factory is called. This means that no information will be available for a PR unless already present in the original response from bitbucket. Actually the client APIs need to be refactored to support callable that allow extra HTTP request in case some data are getted.
For example bitbucket for the pullrequests sends for both source and destination only the hash of head commit and the branch name. Actually BitbucketPullRequestValueDestination has the following fileds:

  • BitbucketCloudBranch that represents the full info for a branch and all HEAD commit info but only the branch name is available in a PR request
  • BitbucketCloudCommit that represent the full info of a commit revision but only the hash is available in a PR request
    it's easier point to a null value everywhere in the code.

In my opinion, for the future, could be a good idea move the client API code in a separate plugin Bitbucket Client API so can be shared across jenkins plugins.

@nfalco79
Copy link
Member Author

@Casz the fix is completed, I had try to cover all possible scenarios where commit informations are requested (postponing as possible the HTTP and only if needed).

Copy link
Member

@jetersen jetersen left a comment

Choose a reason for hiding this comment

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

Looks good, one minor improvement can be made

Copy link
Member

@jetersen jetersen left a comment

Choose a reason for hiding this comment

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

checkstyle.xml Outdated Show resolved Hide resolved
@jetersen
Copy link
Member

@nfalco79
Copy link
Member Author

nfalco79 commented Nov 10, 2018

Seems like checkstyle is scanning generated files 😢

https://ci.jenkins.io/blue/organizations/jenkins/Plugins%2Fbitbucket-branch-source-plugin/detail/PR-152/8/pipeline/#step-35-log-226

For this reason I have excluded resources (maybe could be setup only for properties files).
EDIT:
I had misunderstood what you wrote about jenkinsfile. Added checkstyle report generation to the Jenkinsfile as request

@nfalco79
Copy link
Member Author

@Casz any news?

@jetersen
Copy link
Member

Haven't gotten around to it because of sickness 😢 Will see what I can muster!

Copy link
Member

@jetersen jetersen left a comment

Choose a reason for hiding this comment

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

Looks fine except for the use of slf4j logger 😢 if you want the code base to switch logger, it should be done in a single PR.

Fix the retrieve of the commit informations for a HEAD source of a pullrequest branch. Add closures to branch implementation objects to make HEAD commit informations available when needed. Add unit test for PR from forked repositories.
@nfalco79
Copy link
Member Author

ok reverted

Copy link
Member

@jetersen jetersen left a comment

Choose a reason for hiding this comment

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

Your rebase allowed for missed checkstyle it seems 🤭

- new line at end of file
- import package order no grouping [a-z] and static import at bottom
@nfalco79
Copy link
Member Author

@Casz I do not understand, checkstyle is configured to check java and test sources. The build pass and checkstyle is performed on jenkins build:

[INFO] --- maven-checkstyle-plugin:3.0.0:check (default) @ cloudbees-bitbucket-branch-source ---

@jetersen
Copy link
Member

Well your latest commit corrects all that was wrong with the first at moment so all good 😅

@nfalco79
Copy link
Member Author

Well your latest commit corrects all that was wrong with the first at moment so all good 😅

ok so nothingelse to do

@jetersen jetersen merged commit c7b373f into jenkinsci:master Nov 17, 2018
@nickbroon
Copy link

Has 2.2.15 been published with this fix to https://updates.jenkins.io/ ?

@jetersen
Copy link
Member

I uploaded it yesterday, I guess Jenkins CI is having trouble.

@jetersen
Copy link
Member

@nickbroon
Copy link

nickbroon commented Nov 19, 2018

Where and how do I do that?
Do I use https://issues.jenkins-ci.org/? And if so, what is the component to submit the ticket against?

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.

3 participants