Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-33276

Build status is not being set for parameterized repositories

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The plugin doesn't set the status:

      According to the job log - everything is fine:

      Sending build status INPROGRESS for commit 915809121478ace3d92e52bbb2769f03f26cbfa9 to BitBucket is done!
      Sending build status SUCCESSFUL for commit 915809121478ace3d92e52bbb2769f03f26cbfa9 to BitBucket is done!
      

      Plugin log:

      Mar 02, 2016 6:23:46 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier prebuild
      Bitbucket notify on start
      Mar 02, 2016 6:23:46 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier notifyBuildStatus
      This response was received:
      Mar 02, 2016 6:23:47 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier prebuild
      Bitbucket notify on start succeeded
      Mar 02, 2016 6:23:47 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier perform
      Bitbucket notify on finish
      Mar 02, 2016 6:23:47 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier notifyBuildStatus
      This response was received:
      Mar 02, 2016 6:23:48 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier perform
      Bitbucket notify on finish succeeded
      

      Using CURL requests to api with the same credentials I'm able to set the status:
      REQUEST:

      curl -X POST https://api.bitbucket.org/2.0/repositories/myteam/myrepo.git/commit/9186237941862379481679236178237/statuses/build -H "Authorization: Bearer HkG8WeMRte2C2vx3CL8SwE7gO8_086612391486231486723617991_g==" -d state=SUCCESSFUL -d key=JENKINS-BUILD-50 -d url=https://cicd.myrepo.ru/job/myrepo/
      

      RESPONSE:

      {"name": "", "links": {"commit": {"href": "https://api.bitbucket.org/2.0/repositories/myteam/myrepo/commit/9186237941862379481679236178237"}, "self": {"href": "https://api.bitbucket.org/2.0/repositories/myteam/myrepo/commit/9186237941862379481679236178237/statuses/build/JENKINS-BUILD-50"}}, "url": "https://cicd.myrepo.ru/job/myrepo/", "state": "SUCCESSFUL", "created_on": "2016-03-02T14:46:06.740794+00:00", "key": "JENKINS-BUILD-50", "updated_on": "2016-03-02T14:48:41.267025+00:00", "type": "build", "description": ""}
      

        Attachments

          Activity

          Hide
          flagbit Antonio Mansilla added a comment -

          Nice catch Lior Goikhburg. In that case, can you please provide a list of the plugins involved in your deployment and some tips for the job configuration in order to I can properly reproduce your problem?

          Show
          flagbit Antonio Mansilla added a comment - Nice catch Lior Goikhburg . In that case, can you please provide a list of the plugins involved in your deployment and some tips for the job configuration in order to I can properly reproduce your problem?
          Hide
          zerthimon Lior Goikhburg added a comment - - edited

          Oh, I have a lot of plugins actually, the relevant for this problem is "Environment Injector Plugin".

          The job is configured as follows:

          1. Select "Prepare an environment for the run" checkbox (just before SCM)
          2. In "Properties Content" form write:
            PROJECT=REPO_NAME
          3. In SCM choose git and enter "Reository URL"
            git@bitbucket.org:USERNAME/${PROJECT}.git
          4. In Post-build actions configure "Bitbucket notify build status"

          That should trigger the problem.

          EDIT:
          You can also try without "Environment Injector Plugin":
          Set your job name as the name of your bitbucket repo, and then configure your repo URL to use a built-in variable $JOB_NAME:

          git@bitbucket.org:USERNAME/${JOB_NAME}.git

          And check if your repo is notified.

          Show
          zerthimon Lior Goikhburg added a comment - - edited Oh, I have a lot of plugins actually, the relevant for this problem is "Environment Injector Plugin". The job is configured as follows: Select "Prepare an environment for the run" checkbox (just before SCM) In "Properties Content" form write: PROJECT=REPO_NAME In SCM choose git and enter "Reository URL" git@bitbucket.org:USERNAME/${PROJECT}.git In Post-build actions configure "Bitbucket notify build status" That should trigger the problem. EDIT: You can also try without "Environment Injector Plugin": Set your job name as the name of your bitbucket repo, and then configure your repo URL to use a built-in variable $JOB_NAME: git@bitbucket.org:USERNAME/${JOB_NAME}.git And check if your repo is notified.
          Hide
          zerthimon Lior Goikhburg added a comment -

          Hi Antonio, have you been able to duplicate the problem? Do you think this can be fixed? It'd be cool if I could use a variable in repo name and still be able to have bitbucket notifications.

          Show
          zerthimon Lior Goikhburg added a comment - Hi Antonio, have you been able to duplicate the problem? Do you think this can be fixed? It'd be cool if I could use a variable in repo name and still be able to have bitbucket notifications.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Antonio Mansilla
          Path:
          src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusNotifier.java
          http://jenkins-ci.org/commit/bitbucket-build-status-notifier-plugin/32e1ecb6616eb3d24878f1cc256c8976ac58fc02
          Log:
          JENKINS-33276 Expands env parameters on repo URL

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Mansilla Path: src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusNotifier.java http://jenkins-ci.org/commit/bitbucket-build-status-notifier-plugin/32e1ecb6616eb3d24878f1cc256c8976ac58fc02 Log: JENKINS-33276 Expands env parameters on repo URL
          Hide
          flagbit Antonio Mansilla added a comment -

          Sorry for the delay Lior Goikhburg, I finally got your problem and fixed it and it'll be included in the plugin release.

          Thank you for all the information you provided, it was really helpful.

          Show
          flagbit Antonio Mansilla added a comment - Sorry for the delay Lior Goikhburg , I finally got your problem and fixed it and it'll be included in the plugin release. Thank you for all the information you provided, it was really helpful.

            People

            • Assignee:
              flagbit Antonio Mansilla
              Reporter:
              zerthimon Lior Goikhburg
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: