nishio-dens / bitbucket-pullrequest-builder-plugin

Bitbucket Pull Request Builder Plugin for Jenkins
Other
125 stars 145 forks source link

Ambiguity in configuration documentation #216

Open bpstahlman opened 4 years ago

bpstahlman commented 4 years ago

According to the README...

Select and configure Git SCM Add Repository URL, git@bitbucket.org:${repositoryOwner}/${repositoryName}.git

But the sample configuration call...

bitbucketpr(projectPath:'<BIT_BUCKET_PATH>', ...)

...doesn't set a key called "Repository URL". The closest thing I see is "projectPath", whose value is listed as <BIT_BUCKET_PATH>. But what exactly is this path? The Bitbucket base URL, or the full URL for the project? Does the plugin append the repositoryOwner and repositoryName to projectPath? E.g., something like...

<BIT_BUCKET_PATH>/rest/api/1.0/projects/${repositoryOwner}/repos/${repositoryName}

Also, how does the configuration performed via bitbucketpr(...) interact with the connection information stored in the Bitbucket endpoint (configured apart from any specific project)? IOW, is it possible to "piggyback" off the connection/credentials information used to checkout the project?

Can this plugin use an SSH key, or is http(s) required? (I'm currently using SSH to checkout the project, but I have a username/password account I could use instead.)

In an attempt to find answers to some of these questions, I searched for the terms "projectPath", "repositoryName", etc. within the plugin's source on GitHub, but those terms weren't even found. Any insights you can provide would be appreciated...

bpstahlman commented 4 years ago

To make things a bit more concrete... The following configuration doesn't appear to work: specifically, builds aren't triggered when I make a commit on a PR branch.

bitbucketpr(projectPath: 'https://bitbucket.si.lan/bit/scm/foo/bar.git',
    cron: '* * * * *',
    credentialsId: '',
    username: 'someuser',
    password: 'password',
    repositoryOwner: 'foo',
    repositoryName: 'bar',
    branchesFilter: '',
    branchesFilterBySCMIncludes: false,
    ciKey: '',
    ciName: '',
    ciSkipPhrases: '',
    checkDestinationCommit: true,
    approveIfSuccess: false,
    cancelOutdatedJobs: true,
    buildChronologically: true,
    commentTrigger: ''
)

I can get builds to trigger when I use the Jenkins pollSCM() trigger, but nothing I add to the bitbucketpr(...) call seems to have any effect. Am I missing necessary configuration?

bpstahlman commented 4 years ago

Since making the previous comments, I've discovered (through use of Jenkins' "Pipeline Syntax" feature) that I need to set "bitbucketServer" not the "projectPath" parameter specified in the project README. I wasted a lot of time trying to make things work with "projectPath" before stumbling onto the correct parameter. The README should probably be fixed to spare others the wasted time and frustration...

CodeMonk commented 4 years ago

Thank you so much for going through the documentation.

I'm happy to incorporate any edits that you think we need. I haven't looked at that file in a long time (if EVER!!!).

Sorry you had so many issues getting it configured, but, I'm glad you worked it out!

-Dave

On Thu, Feb 6, 2020 at 10:32 AM Brett Stahlman notifications@github.com wrote:

Since making the previous comments, I've discovered (through use of Jenkins' "Pipeline Syntax" feature) that I need to set "bitbucketServer" not the "projectPath" parameter specified in the project README. I wasted a lot of time trying to make things work with "projectPath" before stumbling onto the correct parameter. The README should probably be fixed to spare others the wasted time and frustration...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nishio-dens/bitbucket-pullrequest-builder-plugin/issues/216?email_source=notifications&email_token=AAA72VTFFOGN32QC33ITNNLRBRCUHA5CNFSM4KPM2QS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELACXTA#issuecomment-583019468, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA72VRZKQNOVOT573OQ3ILRBRCUHANCNFSM4KPM2QSQ .

bpstahlman commented 4 years ago

No problem. I may propose some edits for the README after I've finalized my setup. As it stands now, a commit on a PR triggers a pipeline build, but for some reason, the Jenkins built-in changeRequest() seems to return False for such builds. I'm thinking maybe I need to create a condition that examines one of the env vars set by the plugin, though the Jenkins documentation on changeRequest() suggests that it should return True whenever a build is kicked off due to a pull request...

Perhaps changeRequest() works only when Jenkins' SCM polling logic detects a new commit on a PR. Since I'm having this plugin do the polling, I've disabled periodic polling by Jenkins, so Jenkins' SCM polling logic probably never even runs...

Thanks, Brett Stahlman

On Fri, Feb 7, 2020 at 10:21 AM David Frascone notifications@github.com wrote:

Thank you so much for going through the documentation.

I'm happy to incorporate any edits that you think we need. I haven't looked at that file in a long time (if EVER!!!).

Sorry you had so many issues getting it configured, but, I'm glad you worked it out!

-Dave

On Thu, Feb 6, 2020 at 10:32 AM Brett Stahlman notifications@github.com wrote:

Since making the previous comments, I've discovered (through use of Jenkins' "Pipeline Syntax" feature) that I need to set "bitbucketServer" not the "projectPath" parameter specified in the project README. I wasted a lot of time trying to make things work with "projectPath" before stumbling onto the correct parameter. The README should probably be fixed to spare others the wasted time and frustration...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/nishio-dens/bitbucket-pullrequest-builder-plugin/issues/216?email_source=notifications&email_token=AAA72VTFFOGN32QC33ITNNLRBRCUHA5CNFSM4KPM2QS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELACXTA#issuecomment-583019468 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAA72VRZKQNOVOT573OQ3ILRBRCUHANCNFSM4KPM2QSQ

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nishio-dens/bitbucket-pullrequest-builder-plugin/issues/216?email_source=notifications&email_token=AAXOSQE5S5P77K5656ABLODRBWDABA5CNFSM4KPM2QS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELDTHEI#issuecomment-583480209, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXOSQFW4HTSWC4HGXT5L53RBWDABANCNFSM4KPM2QSQ .

hilafish commented 4 years ago

@bpstahlman can you share your configuration? I tried setting the plugin but it's not triggered at all, not upon a PR creation and not as is (I would expect the build to run every minute if I've set cron: ' *'). I tried both projectPath and bitbucketServer, and nothing seems to work, so sharing your final configuration would be a great help.