Does this plugin support configuration using JCasC? I can't seem to find any documentation on it and I'd rather not have to one-off configure this via the GUI.

          [JENKINS-71385] Atlassian Bitbucket Plugin Support for CasC

          AFAIK the Bitbucket Server Integration plugin does not explicitly support Configuration as Code, but at least unclassified.bitbucketPluginConfiguration.serverList can be set. (It is separate from unclassified.bitbucketEndpointConfiguration.endpoints used by the Bitbucket Branch Source plugin.)

          Kalle Niemitalo added a comment - AFAIK the Bitbucket Server Integration plugin does not explicitly support Configuration as Code, but at least unclassified.bitbucketPluginConfiguration.serverList can be set. (It is separate from unclassified.bitbucketEndpointConfiguration.endpoints used by the Bitbucket Branch Source plugin.)

          M Foster added a comment -

          IIRC, the problem with not having it configurable via JCasC is that the plugin requires a shared secret when creating a consumer. However, you can't use any existing credential as a secret and instead you have to manually create one in the UI in the plugin configuration. This means that if you manually configure this plugin but use JCasC, the secret you create will get obliterated the next time that JCasC runs. I don't know why it can't use a built-in credential but it effectively makes this plugin useless if using JCasC. We opted to just use generic webhooks and live with not having the build results available in Bitbucket.

          M Foster added a comment - IIRC, the problem with not having it configurable via JCasC is that the plugin requires a shared secret when creating a consumer. However, you can't use any existing credential as a secret and instead you have to manually create one in the UI in the plugin configuration. This means that if you manually configure this plugin but use JCasC, the secret you create will get obliterated the next time that JCasC runs. I don't know why it can't use a built-in credential but it effectively makes this plugin useless if using JCasC. We opted to just use generic webhooks and live with not having the build results available in Bitbucket.

          M Foster added a comment -

          Doing some testing, I found if you install the plugin, you can set the credentials in JCasC like this:

                  - bitbucketToken:
                      id: "bb_token"
                      description: "LAN Bitbucket"
                      secret: "my_secret" 

          M Foster added a comment - Doing some testing, I found if you install the plugin, you can set the credentials in JCasC like this:       - bitbucketToken:             id: "bb_token"             description: "LAN Bitbucket"             secret: "my_secret"

          M Foster added a comment -

          After some more searching and testing, I found you can just use a REST API call to Bitbucket to send the build information and skip using this plugin altogether:

           curl -X "POST" "https://bitbucket.example.com/rest/api/1.0/projects/myproject/repos/myrepo/commits/<commit_id>/builds" \
               -H 'X-Atlassian-Token: no-check' \
               -H 'Content-Type: application/json; charset=utf-8' \
               -u 'my_username:my_password' \
               -d $'{
            "key": "my_jenkins_job_key",
            "state": "SUCCESSFUL",
            "url": "https://jenkins.example.com/job/my_jenkins_job_key/<build_id>/",
            "parent": "my_jenkins_job_key"
          }'

          For some undocumented reason, the API won't store the status unless the "parent" is set as well as the "job_key" even though the docs don't mention this at all.

          M Foster added a comment - After some more searching and testing, I found you can just use a REST API call to Bitbucket to send the build information and skip using this plugin altogether: curl -X "POST" "https://bitbucket.example.com/rest/api/1.0/projects/myproject/repos/myrepo/commits/<commit_id>/builds" \      -H 'X-Atlassian-Token: no-check' \      -H 'Content-Type: application/json; charset=utf-8' \      -u 'my_username:my_password' \      -d $'{   "key": "my_jenkins_job_key",   "state": "SUCCESSFUL",   "url": "https://jenkins.example.com/job/my_jenkins_job_key/<build_id>/",   "parent": "my_jenkins_job_key" }' For some undocumented reason, the API won't store the status unless the "parent" is set as well as the "job_key" even though the docs don't mention this at all.

          Milad added a comment -

          I was able to add the Bitbucket server to Jenkins via JCasC using the unclassified.bitbucketPluginConfiguration.serverList key. but I cannot leverage JCasC to add the Application Link (Oauth consumer) and seems like doing it manually from the web UI is the only option. 

          It would be great if this support is added to the plugin. Some organizations (including mine) have a 100% as-code requirement for all Jenkins configs and this throws a wrench in that.

          Milad added a comment - I was able to add the Bitbucket server to Jenkins via JCasC using the unclassified.bitbucketPluginConfiguration.serverList key. but I cannot leverage JCasC to add the Application Link (Oauth consumer) and seems like doing it manually from the web UI is the only option.  It would be great if this support is added to the plugin. Some organizations (including mine) have a 100% as-code requirement for all Jenkins configs and this throws a wrench in that.

            Unassigned Unassigned
            fostddev M Foster
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: