Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    David Masters
    @davemasters1984_twitter
    @a-hacker thanks for the quick response! I have read through some of the issues around multi-branch and I understand it's not as flexible as some user's would like. However, reading the documentation it seems that it should work OK for my scenario. What I'm struggling with is why I'm not getting a build triggered when I open a new PR, but I am getting a build triggered from running it manually? As both of these actions should call the build endpoint, not the scan?
    Austin Hacker
    @a-hacker
    @davemasters1984_twitter I don't see anything in code that would cause this. Both manual and PR triggers execute the same functions and both should provide the necessary data to trigger a build. Could you open an issue for this?
    rhodessteve
    @rhodessteve
    Hi, I've recently taken over support for Bitbucket and this addon. There is a request to add a second jenkins server. From reading up here, i saw that there was no support for multiple jenkins servers. But what does "If you have multiple Jenkins servers setup you can set the api token for each one." mean? From: https://github.com/ParameterizedBuilds/parameterized-builds#link-your-bitbucket-server-account-to-jenkins
    Austin Hacker
    @a-hacker
    @rhodessteve You can't have more than one jenkins server per project but you can have different servers for each project. You can also set a global server.
    rhodessteve
    @rhodessteve
    @a-hacker and are there any further instructions for setting multiple API tokens for that? I am not very familiar with the addon. Where should this happen?
    David Masters
    @davemasters1984_twitter
    @a-hacker just to clarify something - would updating a pull request (i.e. pushing a commit) cause the PR Source Rescoped event to fire?
    NeoDobby
    @NeoDobby
    Hi, I have a problem triggering builds on a multibranch pipeline, and I'm not sure if this is a configuration issue on my side or a bug. The jenkins build is set up to not trigger builds on scans ("Suppress automatic SCM triggering"), so I want bitbucket to trigger the builds on specific branches directly. I have 3 triggers on my repo, one for manual, which works fine, the multibranch pipeline checkbox is not selected. The second trigger should trigger builds on feature and bugfix branches on a PUSH EVENT, so I have that trigger selected, and ref filter set to "feature/.|bugfix/.". No matter if I check multibranch trigger, the push event always just triggers a scan instead of a build on the branch. Same problem with the third trigger, on PR MERGED, it should trigger a build on PR destination "master|maintenance/.*", but again, it only triggers a scan instead of a build. If I understand the README correctly, the multibranch checkbox toggles scanning vs. direct build for REF CREATED, REF DELETED and PUSH EVENT, and all others should directly trigger a build. But it doesn't seem to work like that for me. Do you have any hints what could be wrong? (I'm using 4.0.12)
    David Masters
    @davemasters1984_twitter
    I might be wrong but I believe the checkbox simply allows the plugin to use the correct Jenkins URL to invoke the build; multibranch pipelines have a different URL structure than standard builds
    I think the plugin will always trigger a scan for the REF CREATED, REF DELETED and PUSH EVENT, but SHOULD trigger a build for the PR* and Manual events. However, I cannot get it to trigger a build for the PR* events
    NeoDobby
    @NeoDobby
    Thanks @davemasters1984_twitter . For me the manual trigger works no matter if I check the checkbox or not, so it doesn't look like it needs to change the build trigger URL for manual builds. Anyway, the README is not completely clear about how the checkbox is supposed to work.
    David Masters
    @davemasters1984_twitter
    @NeoDobby that's interesting. I just a manual build without the checkbox checked and I get a message saying "Job not found"
    NeoDobby
    @NeoDobby
    Correction, actually, without the checkbox the manual build just triggers a scan for me.
    NeoDobby
    @NeoDobby
    So I think you are right about the URLs - the URL for the scan is "job/MyJob/build" and for triggering a build it is "job/MyJob/job/master/build", which would explain why it triggers the scan without the checkbox and the build with the checkbox
    NeoDobby
    @NeoDobby
    And another correction: The PR MERGED trigger does nothing for me, it doesn't trigger a build, nor does it trigger a scan. Anyway if the trigger worked, would it trigger a branch on the source branch or on the destination branch?
    NeoDobby
    @NeoDobby
    Looks like it would trigger a build on the source branch, because for pipeline the value of $BRANCH is added, to the URL, which is the source branch of the PR (https://github.com/ParameterizedBuilds/parameterized-builds/blob/master/src/main/java/com/kylenicholls/stash/parameterizedbuilds/item/Job.java#L324). In my case, the source branch is deleted on merge, so that could be a problem, but Jenkins doesn't even try to build the source branch, so the trigger is not working at all.
    David Masters
    @davemasters1984_twitter
    @NeoDobby you have the same issue as me - the PR* events do nothing for me either

    @NeoDobby with regards to the correct branch - what I had hoped to do is to send both the source and target branches as parameters, and when those parameters are present, my pipeline would merge them locally before running the build. In your case you could send an extra parameter to your pipeline called something like "Merged=true" which your pipeline could respond to by checking out the target branch rather than the source.

    Having said that, I think just having a plain webhook to trigger scans on commits would probably be simpler? i.e. not use this plugin for the merge event?

    NeoDobby
    @NeoDobby
    @davemasters1984_twitter thanks for the suggestion, but a plain webhook is not enough because I need to decide if a branch should be built based on the trigger. I was able to make the push event trigger for certain branches work by suppressing the automatic SCM triggering conditionally, but I still need to somehow trigger a build on merge. I'll have to try to find a workaround for that.
    Austin Hacker
    @a-hacker
    @rhodessteve those API tokens are user-specific so they are only used when that specific user triggers a build. They are set in the user's bitbucket user settings. If you set a default user to trigger jobs with, you'll only need to set a single API token on the project or global jenkins settings page.
    @davemasters1984_twitter in regards to the PR Source Rescoped event, this happens whenever the source branch is updated as in the example you gave. However, if the target branch changes (choosing a different branch to merge into) that will not fire the event.
    Austin Hacker
    @a-hacker
    @NeoDobby , @davemasters1984_twitter what do the names of your pipelines look like? Do they match the branch names or do they use the PR id?
    David Masters
    @davemasters1984_twitter
    My branch is named feature/AC-2838-multi-branch-pipeline and the URL for it's job in Jenkins is job/XXX_XXX/job/feature%252FAC-2838-multi-branch-pipeline
    If I replace the %252F in URL with a /then I get a 404. So if the plugin is not URL encoding the branch name on the URL that could explain why it's not working; but the problem with that theory is that it works OK for the manual trigger.
    David Masters
    @davemasters1984_twitter

    After spending some more time looking into it, I've discovered the following:

    • In order for builds to be triggered from PR events, Jenkins needs to already be aware of the branch for the PR.

    • You can make Jenkins aware of the branch before the PR is created in two different ways:

      1) By enabling the ref_created triggers in the Bitbucket plugin - this will cause a scan when branches are created.
      2) Set Jenkins to poll every X minute to look for branches/changes

    • Both of these will trigger a build for the feature branch, without any pull request params.

    • When you run a build manually from a PR, despite Jenkins seemingly not yet knowing about the branch from a scan, it will run the build with any PR parameters fine.

    • Jenkins builds will only be triggered on a multibranch pipeline from a PR event IF the branch name does not contain a slash in it; i.e. feature/myfeature. I presume there is an issue in code with URL encoding, as jenkins expects %252F in the URL instead of a \

    David Masters
    @davemasters1984_twitter

    I wonder if this line in the method Job.createPipelineJobPath should change from:

    jobSegments.add(variables.fetch("$BRANCH"));

    to:

    jobSegments.add(URLEncoder.encode(variables.fetch("$BRANCH"), "UTF-8"));

    Austin Hacker
    @a-hacker
    That seems likely. I'll try to reproduce this locally and make sure that fixes the issue
    David Masters
    @davemasters1984_twitter
    I would raise a PR, but the trouble is I'm not a Java dev, and it would take me an age to get env setup etc
    having said the above, I'm still really confused as to why it seems to work for the manual event.... even with / in my branch name
    Austin Hacker
    @a-hacker
    No worries. Getting the right environment setup for this can be a bit of a pain.
    Austin Hacker
    @a-hacker
    For the record, the manual trigger worked because the branch name was already encoded when the front-end code sends the trigger through a REST endpoint. PR for the fix is here: ParameterizedBuilds/parameterized-builds#279
    David Masters
    @davemasters1984_twitter
    @a-hacker awesome - thanks for making the change! Ah, that explains it :)
    LoriGelbein
    @LoriGelbein
    I am new and I am supporting the Parameterized-builds plugin with Bitbucket. We have a change to the Jenkins Base URL going in. In my testing in Dev when I change the BASE URL in the Bitbucket Admin and select Save, refresh the screen the change is not saved. We are using the following versions of the Plug-in Dev = 4.0.9, Prod=4.0.2 Bitbucket Server Version = 6.1.2. Thank you in advance for any assistance or guidance on this item
    nedmark
    @nedmark
    Hi All, we are using this plugin version 4.011 on the bitbucket version 6.6.0. It is not possible to update or to uninstall this addon. Thank you in advance for your help.
    Austin Hacker
    @a-hacker
    @nedmark that sounds like a Bitbucket issue. You should consider opening a support ticket with Atlassian.
    @LoriGelbein I can't replicate that issue. You may want to consider updating to version 4.0.13. It could be an old issue that has since been resolved.
    syryin
    @syryin
    Hi @a-hacker , Did you get chance to update the plugin to data center compatible? Any estimated time of completion. Thanks
    Austin Hacker
    @a-hacker
    @syryin No. At this point the plugin will not be officially marked as data center compatible. I do not have the resources or motivation to make it happen. I haven't tested it but you may be able to manually install the plugin in a Bitbucket data center instance.
    Rakshatha Shetty
    @RakshathaShetty_gitlab
    Hi All, In bitbucket repository we are using hook "Parameterized Builds for Jenkins". We are running the Jenkins build by selecting "Build in Jenkins" option from bitbucket. During this a pop-up appears in Bitbucket quoting "Optional: You can link your Jenkins account to your Bitbucket account.".
    Clicking on this takes us to page https://bitbucket.com/plugins/servlet/account/jenkins which is an incorrect URL.
    The correct URL is https://bitbucket.com/plugins/servlet/jenkins/account
    Could this be config issue?
    priyanka-agarwal2
    @priyanka-agarwal2
    Hi All, We recently upgraded our Bitbucket instance from 5.13 to 6.10 and post that the manual "Build in Jenkins" option isn't working. However, the automatic build is running properly. Can anyone please point me to the right direction if anything needs to be updated after the BB upgrade? Thank you in advance for this help.
    priyanka-agarwal2
    @priyanka-agarwal2
    @a-hacker Please look into my query above and help me resolve the issue, the version of plugin running is 4.0.13
    2 replies
    MohgaNabil
    @MohgaNabil
    Hello Everyone,
    I recently started migrating to this plugin from the pull-request-notifier. The job set up for PRs relies on some params being passed from Git to Jenkins. I currently get this error 'Job was not found' when I try to trigger a build from the PR manually and I am kinda not able to figure out the issue as I added Jenkins settings and able to connect ( tested the connection through the button). Some system info: bitbucket v6.10.5 & Jenkins v2.150.3. Any help would be appreciated. Thanks!
    2 replies
    rhodessteve
    @rhodessteve
    There is one global setting for the Jenkins servers in Bitbucket, but i see that you can also set other Jenkins servers per project/repo. Is there a way of seeing which Jenkins servers are being used in all the repos and projects? Im about to do an upgrade and dont want the test servers to be triggering any builds to the prouction servers.
    rhodessteve
    @rhodessteve
    @a-hacker I have access to the postgres database, if the infoformation is there to see, how can i see repos that have jenkins servers, and/or webooks?
    Austin Hacker
    @a-hacker
    @rhodessteve that is possible but a little tricky as you have to deal with binary data. The jenkins servers are defined in the PLUGIN_SETTINGS table, filter by NAMESPACE='com.kylenicholls.stash.parameterized-builds'. To find which servers are actually in use, you'll want to query the STA_REPO_HOOK table for entries with HOOK_KEY='com.kylenicholls.stash.parameterized-builds:parameterized-build-hook' and IS_ENABLED=true. You can then join to the STA_SHARED_LOB table on STA_REPO_HOOK.LOB_ID == STA_SHARED_LOB.ID. Within the LOB_DATA you can try to parse out the jenkins server for each job. Unfortunately, the parsing of blob data will probably be pretty tedious so I'd recommend just assuming that any repos defined in PLUGIN_SETTINGS are likely to be in use.
    Maciej
    @Maciej14723674_twitter
    Hi everyone! I am looking for an answer to my question: If I have build parameters like AUTHOR_NAME or AUTHOR_IP, when running a manual build, I can provide those parameters, but how to pass any parameters from a git client? Is it possible that when git commit and git push are executed, some parameters are passed to the hook? On Bitbucket I found only global Bitbucket variables, but I would like to pass data from Git clients.
    1 reply
    MohgaNabil
    @MohgaNabil
    @a-hacker Hello :), I wonder if you can help me figure something out please. So I've about 137 repo that I need to configure the plugin for. I wrote a script that sends requests to the target endpoint, settings are created successfully ( builds are also triggered successfully). However, the settings/jobs configurations are not showing in the plugin UI on bitbucket. What am I missing here?
    lukiszlak
    @lukiszlak
    Hello there,
    I need to declare parameter "on the fly".
    I have a .xml file which i want to parse and make parameters from what i find inside.
    Is there a way to do it soo everytime it will read the file and then show them on Build With Parameters screen?
    @Edit - I'm only talking about build Parameters
    Carter Sanders
    @seestonebat

    Hi - I've seen some earlier posting about this same issue, but I don't see a fix or workaround in them. I'm having an issue with manually triggering multibranch pipeline builds. Triggering via scanning works fine. It's only manual invocations that fail. Here are the details-

    Here’s how I reproed the problem -

    Create a simple Jenkins multibranch pipeline build using a declarative pipeline.
    Set up hooks for the build in the “parameterized builds for Jenkins” config under hooks
    Push a branch to the repo
    Create a PR
    Confirm that that the build is properly triggered
    Go to the PR in BitBucket and click the triple-dot menu and select “Build In Jenkins”
    Observe the “Build started” dialog
    Observe the “Job was not found” dialog

    Bitbucket version: 6.10.4
    Jenkins version: 2.263.1
    Pipeline multibranch plugin version: 2.22

    Osman Kenobi
    @osmankenobi_twitter
    Hello , I am a newbie here and just wondering where I can see a successful build log or a failed one in bitbucket server
    Suddenly Cı/CD stopped working and I am looking for a log to solve it