jenkinsci / bitbucket-branch-source-plugin

Bitbucket Branch Source Plugin
https://plugins.jenkins.io/cloudbees-bitbucket-branch-source
MIT License
215 stars 354 forks source link

Issue: Can not determine Jenkins root URL or Jenkins URL, but Jenkins URL is set #643

Open ilyataskaev opened 2 years ago

ilyataskaev commented 2 years ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.361.1 OS: Linux - 5.10.0-17-amd64 --- Office-365-Connector:4.17.0 ace-editor:1.1 allure-jenkins-plugin:2.30.2 ansicolor:1.0.1 ant:475.vf34069fef73c antisamy-markup-formatter:2.7 apache-httpcomponents-client-4-api:4.5.13-1.0 artifactory:3.16.2 atlassian-jira-software-cloud:2.0.2 authentication-tokens:1.4 authorize-project:1.4.0 aws-credentials:191.vcb_f183ce58b_9 aws-java-sdk-ec2:1.12.215-339.vdc07efc5320c aws-java-sdk-minimal:1.12.215-339.vdc07efc5320c azure-ad:218.v90f6a_980b_a_61 azure-sdk:106.v552de1e64d56 bitbucket-build-status-notifier:1.4.2 bitbucket-pullrequest-builder:1.5.0 bitbucket-push-and-pull-request:2.8.3 blueocean:1.25.5 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.25.5 blueocean-commons:1.25.5 blueocean-config:1.25.5 blueocean-core-js:1.25.5 blueocean-dashboard:1.25.5 blueocean-display-url:2.4.1 blueocean-events:1.25.5 blueocean-git-pipeline:1.25.5 blueocean-github-pipeline:1.25.5 blueocean-i18n:1.25.5 blueocean-jwt:1.25.5 blueocean-personalization:1.25.5 blueocean-pipeline-api-impl:1.25.5 blueocean-pipeline-editor:1.25.5 blueocean-pipeline-scm-api:1.25.5 blueocean-rest:1.25.5 blueocean-rest-impl:1.25.5 blueocean-web:1.25.5 bootstrap5-api:5.1.3-7 bouncycastle-api:2.26 branch-api:2.1046.v0ca_37783ecc5 build-timeout:1.20 build-user-vars-plugin:1.8 caffeine-api:2.9.3-65.v6a_47d0f4d1fe checks-api:1.7.4 chucknorris:1.4 cloud-stats:0.27 cloudbees-bitbucket-branch-source:773.v4b_9b_005b_562b_ cloudbees-disk-usage-simple:0.10 cloudbees-folder:6.722.v8165b_a_cf25e9 command-launcher:84.v4a_97f2027398 config-file-provider:3.10.0 configuration-as-code:1429.v09b_044a_c93de copyartifact:1.46.4 credentials:1087.1089.v2f1b_9a_b_040e4 credentials-binding:523.vd859a_4b_122e6 dependency-check-jenkins-plugin:5.1.2 display-url-api:2.3.6 docker-commons:1.19 docker-workflow:1.28 durable-task:496.va67c6f9eefa7 ec2:1.68 echarts-api:5.3.2-2 extended-choice-parameter:346.vd87693c5a_86c extended-read-permission:3.2 favorite:2.4.1 font-awesome-api:6.1.1-1 git:4.11.3 git-client:3.11.0 git-parameter:0.9.16 github:1.34.3 github-api:1.303-400.v35c2d8258028 github-branch-source:1637.vd833b_7ca_7654 gradle:1.38 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 hashicorp-vault-plugin:3.8.0 hetzner-cloud:60.vf7c9ee657e67 htmlpublisher:1.30 insightappsec:1.0.5 instance-identity:3.1 ivy:2.2 jackson2-api:2.13.3-285.vc03c0256d517 javadoc:217.v905b_86277a_2a_ javax-activation-api:1.2.0-3 javax-mail-api:1.6.2-6 jaxb:2.3.6-1 jdk-tool:1.5 jenkins-design-language:1.25.5 jira:3.7.1 jjwt-api:0.11.2-71.v2722b_b_06a_2a_f job-dsl:1.79 jquery:1.12.4-1 jquery3-api:3.6.0-4 jsch:0.1.55.2 junit:1.63 ldap:2.10 mailer:414.vcc4c33714601 matrix-auth:3.1.2 matrix-project:771.v574584b_39e60 maven-plugin:3.18 mercurial:2.16.2 metrics:4.1.6.2 momentjs:1.1.1 multiple-scms:0.8 next-build-number:1.8 node-iterator-api:1.5.1 nodejs:1.5.1 nomad:0.9.3 okhttp-api:4.9.3-105.vb96869f8ac3a parameter-separator:1.3 pipeline-build-step:2.18 pipeline-graph-analysis:195.v5812d95a_a_2f9 pipeline-groovy-lib:591.v3a_7f422b_d058 pipeline-input-step:448.v37cea_9a_10a_70 pipeline-milestone-step:101.vd572fef9d926 pipeline-model-api:2.2086.v12b_420f036e5 pipeline-model-definition:2.2086.v12b_420f036e5 pipeline-model-extensions:2.2086.v12b_420f036e5 pipeline-rest-api:2.24 pipeline-stage-step:293.v200037eefcd5 pipeline-stage-tags-metadata:2.2086.v12b_420f036e5 pipeline-stage-view:2.24 pipeline-utility-steps:2.12.1 plain-credentials:1.8 plugin-util-api:2.17.0 popper2-api:2.11.5-2 prometheus:2.0.11 pubsub-light:1.16 rebuild:1.34 resource-disposer:0.19 s3:0.12.1 scm-api:608.vfa_f971c5a_a_e9 script-security:1175.v4b_d517d6db_f0 slack:608.v19e3b_44b_b_9ff snakeyaml-api:1.30.1 sonar:2.14 sse-gateway:1.25 ssh-agent:295.v9ca_a_1c7cc3a_a_ ssh-credentials:277.v95c2fec1c047 ssh-slaves:1.814.vc82988f54b_10 sshd:3.237.v883d165a_c1d3 structs:318.va_f3ccb_729b_71 throttle-concurrents:2.8 timestamper:1.17 token-macro:293.v283932a_0a_b_49 trilead-api:1.57.v6e90e07157e1 uno-choice:2.6.1 variant:1.4 versionnumber:1.9 workflow-api:1153.vb_912c0e47fb_a_ workflow-basic-steps:948.v2c72a_091b_b_68 workflow-cps:2705.v0449852ee36f workflow-durable-task-step:1139.v252a_e12e8463 workflow-job:1182.v60a_e6279b_579 workflow-multibranch:716.vc692a_e52371b_ workflow-scm-step:400.v6b_89a_1317c9a_ workflow-step-api:625.vd896b_f445a_f8 workflow-support:820.vd1a_6cc65ef33 ws-cleanup:0.42 ```

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

We Use official Docker Jenkins jenkins/jenkins:lts-jdk11

Reproduction steps

We use Multybrunch projects with bitbucket-branch-source-plugin to check our PR Pull Requests.

Expected Results

Is to update PRs body with status of runs

Actual Results

We got error: [Bitbucket] Notifying pull request build result Can not determine Jenkins root URL or Jenkins URL is not a valid URL regarding Bitbucket API. Commit status notifications are disabled until a root URL is configured in Jenkins global configuration. IllegalStateException: Could not determine Jenkins URL.

And PR not got updated.

Anything else?

But Jenkins URL is set everywhere we can: image image And this is FQDN address. and also Hudson.instance.getRootUrl() returns the same result in Jenkins script:

image

KalleOlaviNiemitalo commented 2 years ago

Does jenkins.model.JenkinsLocationConfiguration.get().getUrl() return the correct URL?

ilyataskaev commented 2 years ago

Need take a look, usually I fix it by deleting last / in address in both settings in Jenkins configuration, and after apply problem is gone until some time, when is is suddenly returns, so jenkins.model.JenkinsLocationConfiguration.get().getUrl() right now it returns actual FQDN address of jenkins, and plugin is working.

ilyataskaev commented 2 years ago

For wich Jenkins parameter this jenkins.model.JenkinsLocationConfiguration.get().getUrl() is responcible for?

KalleOlaviNiemitalo commented 2 years ago

I'm not sure where the jenkins.model.JenkinsLocationConfiguration.get().getUrl() setting is in the Jenkins UI, but Bitbucket Branch Source checks the resulting URL.

KalleOlaviNiemitalo commented 2 years ago

Do you configure anything related with the configuration-as-code plugin? If you have an incorrect setting there, that could explain why it reverts.