BitBucket Cloud Push not triggering Pipeline with same repository URL
simone201 opened this issue · comments
I've created a new Jenkins Pipeline (really simple) with the Jenkinsfile taken from a repository on master branch. I've also declared in the pipeline the following trigger:
properties([
pipelineTriggers([
[
$class: 'BitBucketPPRTrigger',
triggers: [
[
$class: 'BitBucketPPRRepositoryTriggerFilter',
actionFilter: [
$class: 'BitBucketPPRRepositoryPushActionFilter',
triggerAlsoIfNothingChanged: true,
triggerAlsoIfTagPush: false,
triggerOnlyIfTagPush: true,
allowedBranches: "",
isToApprove: false
]
]
]
]
])
])
as per plugin documentation.
I've tried enabling the webhooks in the same repository as the Jenkinsfile, also ran manually the pipeline a couple of times to let it enable the trigger (checked in its configuration) but on TAG PUSH is not triggering the pipeline at all, neither on any other kind of trigger.
Here's the log of the plugin taken from Jenkins:
Received input stream over Bitbucket hook notification: redacted entirely for brevity
Dec 21, 2020 10:54:09 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver doIndex
Received x-event-key: repo:push from Bitbucket
Dec 21, 2020 10:54:09 AM FINEST io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver
the payload is: {"push":{"changes":[{"forced":false,"links":{"commits":{"href":"https://api.bitbucket.org/2.0/repositories/redacted/test_hook/commits?include\redacted"}},"truncated":false,"created":true,"closed":false,"new":{"type":"tag","name":"test1","target":{"hash":"redacted","links":{"html":{"href":"https://bitbucket.org/redacted/test_hook/commits/redacted"},"self":{"href":"https://api.bitbucket.org/2.0/repositories/redacted/test_hook/commit/redacted"}}}}}]},"repository":{"scm":"git","name":"test_hook","links":{"html":{"href":"https://bitbucket.org/redacted/test_hook"},"self":{"href":"https://api.bitbucket.org/2.0/repositories/redacted/test_hook"}},"project":{"links":{"html":{"href":"https://bitbucket.org/redacted/workspace/projects/UT"},"self":{"href":"https://api.bitbucket.org/2.0/workspaces/redacted/projects/UT"}},"type":"project","uuid":"{redacted}","key":"UT","name":"utilities"},"owner":{"type":"team","display_name":"redacted","uuid":"{redacted}","links":{"html":{"href":"https://bitbucket.org/redacted/"},"self":{"href":"https://api.bitbucket.org/2.0/teams/redacted"}}},"type":"repository","is_private":true,"uuid":"{redacted}"},"actor":{"display_name":"Simone Renzo","account_id":"redacted","type":"user","links":{"html":{"href":"https://bitbucket.org/redacted/"},"self":{"href":"https://api.bitbucket.org/2.0/users/redacted"}},"nickname":"Simone Renzo","uuid":"{redacted}"}}
Dec 21, 2020 10:54:09 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.processor.BitBucketPPRPayloadProcessorFactory createProcessor
Create BitBucketPPRRepositoryCloudPayloadProcessor
Dec 21, 2020 10:54:09 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.observer.BitBucketPPRObserverFactory createObservable
Add BitBucketPPRPushCloudObserver for BitBucketPPREvent [event=repo, action=push]
Dec 21, 2020 10:54:09 AM FINEST io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver
the selected payload processor is: io.jenkins.plugins.bitbucketpushandpullrequest.processor.BitBucketPPRRepositoryCloudPayloadProcessor@7e540607
Dec 21, 2020 10:54:09 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.processor.BitBucketPPRRepositoryCloudPayloadProcessor buildActionForJobs
Instantiate BitBucketPPRRepositoryAction
Dec 21, 2020 10:54:09 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.action.BitBucketPPRRepositoryAction
Received commit hook notification for branch: test1
Dec 21, 2020 10:54:09 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.action.BitBucketPPRRepositoryAction
Received commit hook type: tag
Dec 21, 2020 10:54:09 AM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
Considering remote [https://bitbucket.org/redacted/test_hook]
Dec 21, 2020 10:54:09 AM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
Considering candidate job Bitbucket-Webhook-Test
Dec 21, 2020 10:54:09 AM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRJobProbe
Considering to poke Bitbucket-Webhook-Test
Dec 21, 2020 10:54:09 AM FINEST io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver
Sending response.
Dec 21, 2020 10:54:09 AM INFO io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRHookReceiver doIndex
Response sent.
Dec 21, 2020 10:55:05 AM FINE io.jenkins.plugins.bitbucketpushandpullrequest.BitBucketPPRTrigger
Created new file bitbucket-polling.log for logging in the directory /var/jenkins_home/jobs/Bitbucket-Webhook-Test.
Any idea why is not triggering the pipeline as expected?
Jenkins Version: 2.263.1
Plugin Version: 2.6.4
Hi @simone201, is the problem still there?
Hi @cdelmonte-zg,
yes the problem is still there.
The only way to circumvent it now is create a normal Job, enable the trigger on it with Git configured with the proper repository, and then make the Job trigger the Pipeline as its action. I don't think is the proper way to make it work though...
Could you test without the isToApprove
argument (which makes no sense for push):
properties([
pipelineTriggers([
bitBucketTrigger([
[
$class: 'BitBucketPPRRepositoryTriggerFilter',
actionFilter: [
$class: 'BitBucketPPRRepositoryPushActionFilter',
allowedBranches: '',
triggerAlsoIfNothingChanged: true,
triggerAlsoIfTagPush: false,
triggerOnlyIfTagPush: true
]
]
])
])
])
What is really strange (if the posted logs are complete) is that the last log is from BitBucketPPRJobProbe::triggerScm
line 105
and it never seems to reach the loop in line 113:
private void triggerScm(Job<?, ?> job, List<URIish> remotes, BitBucketPPRAction bitbucketAction,
BitBucketPPRObservable observable) {
logger.log(Level.FINE, "Considering to poke {0}", job.getFullDisplayName());
BitBucketPPRTrigger bitbucketTrigger = getBitBucketTrigger(job);
if (bitbucketTrigger != null) {
List<SCM> scmTriggered = new ArrayList<>();
Optional<SCMTriggerItem> item = Optional.ofNullable(SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job));
item.ifPresent(i -> i.getSCMs().stream().forEach(scmTrigger -> {
logger.log(Level.FINE, "Considering to use trigger {0}", scmTrigger.toString());
// ...
@cdelmonte-zg we might need to correct docs if the error results from there.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.