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

Not capturing commits with bitbucket branch source plugin with OAuth credentials #747

Open
ld-singh opened this issue Aug 8, 2023 · 11 comments
Labels

Comments

@ld-singh
Copy link

ld-singh commented Aug 8, 2023

Jenkins and plugins versions report

Environment
Jenkins: 2.401.1
OS: Linux - 6.1.25-37.47.amzn2023.x86_64
Java: 11.0.19 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5
authentication-tokens:1.53.v1c90fd9191a_b_
aws-credentials:191.vcb_f183ce58b_9
aws-java-sdk:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-cloudformation:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-codebuild:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-ec2:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-ecr:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-ecs:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-efs:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-elasticbeanstalk:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-iam:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-kinesis:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-logs:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-minimal:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-sns:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-sqs:1.12.481-392.v8b_291cfcda_09
aws-java-sdk-ssm:1.12.481-392.v8b_291cfcda_09
aws-secrets-manager-credentials-provider:1.202.ve0ec0c17611c
basic-branch-build-strategies:71.vc1421f89888e
bitbucket:223.vd12f2bca5430
bitbucket-build-status-notifier:1.4.2
blueocean:1.27.4
blueocean-bitbucket-pipeline:1.27.4
blueocean-commons:1.27.5
blueocean-config:1.27.5
blueocean-core-js:1.27.5
blueocean-dashboard:1.27.5
blueocean-display-url:2.4.2
blueocean-events:1.27.5
blueocean-git-pipeline:1.27.5
blueocean-github-pipeline:1.27.5
blueocean-i18n:1.27.5
blueocean-jwt:1.27.5
blueocean-personalization:1.27.5
blueocean-pipeline-api-impl:1.27.5
blueocean-pipeline-editor:1.27.5
blueocean-pipeline-scm-api:1.27.5
blueocean-rest:1.27.5
blueocean-rest-impl:1.27.5
blueocean-web:1.27.5
bootstrap5-api:5.3.0-1
bouncycastle-api:2.29
branch-api:2.1122.v09cb_8ea_8a_724
build-discarder:139.v05696a_7fe240
caffeine-api:3.1.6-115.vb_8b_b_328e59d8
checks-api:2.0.0
cloudbees-bitbucket-branch-source:800.va_b_b_9a_a_5035c1
cloudbees-folder:6.815.v0dd5a_cb_40e0e
cobertura:1.17
code-coverage-api:4.7.0
command-launcher:90.v669d7ccb_7c31
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-36.vc008c8fcda_7b_
config-file-provider:952.va_544a_6234b_46
configuration-as-code:1647.ve39ca_b_829b_42
credentials:1271.v54b_1c2c6388a_
credentials-binding:604.vb_64480b_c56ca_
data-tables-api:1.13.4-1
display-url-api:2.3.7
docker-commons:439.va_3cb_0a_6a_fb_29
docker-workflow:563.vd5d2e5c4007f
durable-task:510.v324450f8dca_4
ec2-fleet:2.5.2
echarts-api:5.4.0-5
email-ext:2.99
favorite:2.4.2
font-awesome-api:6.4.0-2
forensics-api:2.3.0
git:5.1.0
git-client:4.4.0
github:1.37.1
github-api:1.314-431.v78d72a_3fe4c3
github-branch-source:1728.v859147241f49
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
htmlpublisher:1.31
instance-identity:173.va_37c494ec4e5
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.2-350.v0c2f3f8fc595
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-8
jaxb:2.3.8-1
jdk-tool:63.v62d2fd4b_4793
jenkins-design-language:1.27.5
jjwt-api:0.11.5-77.v646c772fddb_0
job-dsl:1.83
jquery3-api:3.7.0-1
jsch:0.2.8-65.v052c39de79b_2
junit:1217.v4297208a_a_b_ce
mailer:457.v3f72cb_e015e5
matrix-auth:3.1.7
matrix-project:789.v57a_725b_63c79
mercurial:1260.vdfb_723cdcc81
mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_
mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_
multiple-scms:0.8
nodejs:1.6.0
okhttp-api:4.11.0-145.vcb_8de402ef81
pipeline-build-step:496.v2449a_9a_221f2
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7
pipeline-input-step:468.va_5db_051498a_4
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2144.v077a_d1928a_40
pipeline-model-definition:2.2131.vb_9788088fdb_5
pipeline-model-extensions:2.2144.v077a_d1928a_40
pipeline-rest-api:2.33
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40
pipeline-stage-view:2.32
pipeline-utility-steps:2.15.3
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.3.0
prism-api:1.29.0-7
publish-over:0.22
publish-over-ssh:1.24
pubsub-light:1.17
role-strategy:633.v836e5b_3e80a_5
saml:4.403.v423b_3195a_9ec
scm-api:676.v886669a_199a_a_
script-security:1251.vfe552ed55f8d
shiningpanda:0.24
skip-notifications-trait:148.v269dccfa_1426
slack:664.vc9a_90f8b_c24a_
snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4
sonar:2.15
sse-gateway:1.26
ssh-agent:333.v878b_53c89511
ssh-credentials:305.v8f4381501156
ssh-slaves:2.877.v365f5eb_a_b_eec
sshd:3.249.v2dc2ea_416e33
structs:324.va_f5d6774f3a_d
timestamper:1.25
token-macro:359.vb_cde11682e0c
trilead-api:2.84.v72119de229b_7
variant:59.vf075fe829ccb
workflow-aggregator:596.v8c21c963d92d
workflow-api:1213.v646def1087f9
workflow-basic-steps:1017.vb_45b_302f0cea_
workflow-cps:3691.v28b_14c465a_b_b_
workflow-durable-task-step:1246.v5524618ea_097
workflow-job:1308.v58d48a_763b_31
workflow-multibranch:746.v05814d19c001
workflow-scm-step:408.v7d5b_135a_b_d49
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c

What Operating System are you using (both controller, and any agents involved in the problem)?

Amazon Linux 2
OS: Linux - 6.1.25-37.47.amzn2023.x86_64

Reproduction steps

  1. Set up Multibranch Jenkins pipeline
  2. Choose bitbucket as source and for credentials provide bitbucket Outh credentials.
  3. Also set up webhook for triggering jobs with branch events.
  4. Add a commit to branch.
  5. Branch event should trigger a build.

But still no changes are logged.
Screenshot 2023-08-09 at 9 49 40 am

Expected Results

Commits should be captured.

Actual Results

No changes logged even when build is triggered due to branch event of commit.

Anything else?

No response

@ld-singh ld-singh added the bug label Aug 8, 2023
@ld-singh
Copy link
Author

ld-singh commented Aug 9, 2023

Is this not supposed to work with Outh Consumers?

@ryanewtaylor
Copy link

My organization is experiencing this (or a very similar issue) as well.

We are migrating from Bitbucket Server to Bitbucket Cloud and aside from migrating repositories and configuring an OAuth Consumer in Bitbucket Cloud and Jenkins we have not changed/updated Jenkins components.

Our Environment
Jenkins: 2.401.1
OS: Windows Server 2019 - 10.0
Java: 11.0.17 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
ace-editor:1.1
ant:487.vd79d090d4ea_e
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5
authentication-tokens:1.53.v1c90fd9191a_b_
basic-branch-build-strategies:71.vc1421f89888e
blueocean:1.27.4
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.27.4
blueocean-commons:1.27.4
blueocean-config:1.27.4
blueocean-core-js:1.27.4
blueocean-dashboard:1.27.4
blueocean-display-url:2.4.2
blueocean-events:1.27.4
blueocean-git-pipeline:1.27.4
blueocean-github-pipeline:1.27.4
blueocean-i18n:1.27.4
blueocean-jwt:1.27.4
blueocean-personalization:1.27.4
blueocean-pipeline-api-impl:1.27.4
blueocean-pipeline-editor:1.27.4
blueocean-pipeline-scm-api:1.27.4
blueocean-rest:1.27.4
blueocean-rest-impl:1.27.4
blueocean-web:1.27.4
bootstrap5-api:5.3.0-1
bouncycastle-api:2.28
branch-api:2.1109.vdf225489a_16d
build-timeout:1.31
caffeine-api:3.1.6-115.vb_8b_b_328e59d8
checks-api:2.0.0
cloudbees-bitbucket-branch-source:809.vc1d904b_30426
cloudbees-folder:6.815.v0dd5a_cb_40e0e
command-launcher:100.v2f6722292ee8
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-36.vc008c8fcda_7b_
credentials:1254.vb_96f366e7b_a_d
credentials-binding:604.vb_64480b_c56ca_
display-url-api:2.3.7
docker-commons:419.v8e3cd84ef49c
docker-workflow:563.vd5d2e5c4007f
dtkit-api:3.0.2
durable-task:507.v050055d0cb_dd
echarts-api:5.4.0-5
email-ext:2.99
favorite:2.4.2
font-awesome-api:6.4.0-1
git:5.1.0
git-client:4.4.0
github:1.37.1
github-api:1.314-431.v78d72a_3fe4c3
github-branch-source:1728.v859147241f49
gradle:2.8
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
htmlpublisher:1.31
instance-identity:173.va_37c494ec4e5
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.2-350.v0c2f3f8fc595
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.8-1
jdk-tool:66.vd8fa_64ee91b_d
jenkins-design-language:1.27.4
jjwt-api:0.11.5-77.v646c772fddb_0
jquery3-api:3.7.0-1
jsch:0.2.8-65.v052c39de79b_2
junit:1207.va_09d5100410f
ldap:682.v7b_544c9d1512
mailer:457.v3f72cb_e015e5
matrix-auth:3.1.8
matrix-project:789.v57a_725b_63c79
mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_
mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_
momentjs:1.1.1
okhttp-api:4.11.0-145.vcb_8de402ef81
pam-auth:1.10
pipeline-build-step:496.v2449a_9a_221f2
pipeline-github-lib:42.v0739460cda_c4
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7
pipeline-input-step:468.va_5db_051498a_4
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2141.v5402e818a_779
pipeline-model-definition:2.2141.v5402e818a_779
pipeline-model-extensions:2.2141.v5402e818a_779
pipeline-rest-api:2.33
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2141.v5402e818a_779
pipeline-stage-view:2.33
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.3.0
popper2-api:2.11.6-2
pubsub-light:1.17
resource-disposer:0.22
scm-api:676.v886669a_199a_a_
script-security:1251.vfe552ed55f8d
snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4
sonar:2.15
sse-gateway:1.26
ssh-credentials:305.v8f4381501156
ssh-slaves:2.877.v365f5eb_a_b_eec
sshd:3.303.vefc7119b_ec23
structs:324.va_f5d6774f3a_d
timestamper:1.25
token-macro:359.vb_cde11682e0c
trilead-api:2.84.v72119de229b_7
variant:59.vf075fe829ccb
workflow-aggregator:596.v8c21c963d92d
workflow-api:1215.v2b_ee3e1b_dd39
workflow-basic-steps:1017.vb_45b_302f0cea_
workflow-cps:3691.v28b_14c465a_b_b_
workflow-durable-task-step:1247.v7f9dfea_b_4fd0
workflow-job:1308.v58d48a_763b_31
workflow-multibranch:756.v891d88f2cd46
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.45
xunit:3.1.2

Reproduction Steps

  1. Configure an OAuth Consumer in Bitbucket Cloud
  2. Configure a Bitbucket Multibranch Pipeline Job in Jenkins
  3. Specify Bitbucket (cloud) as the source
  4. Use the OAuth Consumer credentials
  5. Create a Jenkinsfile with a changeset condition to trigger only when changes for a particular folder are detected
    when {
        beforeAgent true
        anyOf {
            buildingTag()
            changeset "client/**"
            triggeredBy cause: "UserIdCause"
        }
    }
  6. Commit and push changes to any branch (e.g., main) in the repo's client directory

Expected Results

  1. Jenkins is notified of a change by Bitbucket
  2. The job lists changes for the newly pushed commit(s) at
    https://jenkins.myorg.com/job/project/job/main/changes
  3. The stage with the when condition is triggered

Actual Results

  1. Jenkins is notified of a change by Bitbucket
  2. The job lists no changes for the newly pushed commit(s) at
    https://jenkins.myorg.com/job/project/job/main/changes
  3. The stage with the when condition is not triggered

Workaround

We have a temporary workaround which is to remove all when conditions that use the changeset condition. Therefor all our stages are built on any commit. However, this is not workable for all situations.

Anything Else

As noted our when conditions work fine with Bitbucket Server, Jenkins is picking up the list of changes upon each push when they come from Bitbucket Server. We are migrating all repos to Bitbucket Cloud and discovered that our stages with when conditions were not executing. Upon further investigation we noticed that while Jenkins is notified of a push no changes are ever detected.

@ryanewtaylor
Copy link

@lifeofguenter are you the primary maintainer of this repository? I might be able to assist fixing this if you could point me in the general direction as to where this issue may arise.

@liamjones
Copy link

Just hit this one myself. To be clear for those looking for a workaround; if you switch to a username/password combo in the interim it works correctly. The problem is specific to using OAuth credentials.

@ld-singh
Copy link
Author

I have replaced Oauth credentials with Bitbucket APP password which works fine

@stephenrhea
Copy link

Any progress on this? It's good to hear that an app password works, but those are still tied to a specific user, which is what we'd like to avoid in our CI/CD pipeline.

@ryanewtaylor
Copy link

Likewise, any updates? I am willing to put in the work for a patch if the owner can point me in the general direction for where this issue could be cropping up.

@ryanewtaylor
Copy link

I'm not sure what the etiquette is for tagging folks, my apologies in advance if this is not the recommended approach. @lifeofguenter, I see that you are a recent contributor. Are you the right point of contact for this plugin? Would you be able to point me in the right direction for resolving this, whether that be redirecting to the maintainer, or providing a general direction for resolving this myself and submitting a PR?

@rdrgporto
Copy link

Hi,

Any updates on this bug? Is there any intention to fix it?

@ryanewtaylor
Copy link

Still hoping for an update on this bug. Willing to help if someone could point me in the general direction of a fix. I am unfamiliar with Jenkins plugin development.

@bitwiseman bitwiseman changed the title Not capturing commits with bitbucket branch source plugin with Outh credentials Not capturing commits with bitbucket branch source plugin with OAuth credentials Jun 29, 2024
@ryanewtaylor
Copy link

Still hoping for a fix to this bug. As before I am willing to assist if someone can point me in the right direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants