disabling "delete branch" checkbox on pull requests in bitbucket - bitbucket

i was wondering if someone knows how to disable this checkbox from being clicked by users bc i don't want the feature branches to be deleted after merge in pull requests.
i've managed to disable it by implementing branch restrictions, but the restriction is too general (disable the deletion of feature branches), and i don't want to disable the deletion of feature branches at all, i just want to restrict that checkbox so users don't delete it after a pull request.
i would need a similar solution to this one but in bitbucket.
Prevent branches from being deleted on PR completion

Related

How to do a good code review in Bitbucket

I have used a few code review programs. I am now using pull requests in Bitbucket. I am expecting a certain process:
Create review (ie pull request)
Comments are added by reviewers. ( am used to a graded system where someone can mark the change as a bug which needs to be fixed before being merged)
The review is sent back to the originator who fixes any problems that are marked
(!!)The originator pushes their changes to their branch and then the code review is done again by all reviewers who then approve or reject the new changes.
With all things being good, the review is approved and then merged.
What I am wondering about are steps 3 and 4. There seems no grading to the comments and there seems to be no way for the originator to see quickly the comments (in some condensed format). Also, how do new changes update a pull request? Is this just missing from the Bitbucket system or is there a way to achieve this?
"there seems to be no way for the originator to see quickly the comments (in some condensed format)". Open a pull request, and look over on the right hand side. I see 3 tabs: Details / Files / Activity. Under "Activity", I can filter to "All Comments".
"how do new changes update a pull request?" When creating a pull request, you are requesting approval from your colleagues to pull code from some source branch to some target branch. So, when the source branch is updated with changes, the pull request should automatically reflect that. In other words, you shouldn't have to take any extra action.
"There seems no grading to the comments" A reviewer can check a box that says "merge not allowed until the 'issue fixed' box is checked." The repo admin has some latitude to set how strict the PR / merge policies will be, including whether approval is needed from anyone or from specific individuals.

Get MR source branch on Push event Gitlab Webhook

Is there a way to get the merge request (particularly the source branch) that caused a particular Push event on the Gitlab Webhook? I want to run a build only once an MR has been merged (hence the push event), but I want to do slightly different things in my Jenkins build based off of the source branch in the MR. Is this doable using a Push event?
I figure one way to do this manually would be to scrape the commit messages from the push event, and parse out any MR commit messages. However, that seems like a very brittle solution.
If it is not doable, could I use the Accepted MR event instead? And if so, is the Accepted event run after the merge happens? Or would I have to do the Merge myself within the job?
According to the Push Events Webhooks Documentation, push events body contains ref field, which is actually the branch to which the push has been performed, i.e the source branch of a merge request (if one has been created for this branch).
If you need more detailed information about the merge request, you may find it useful to consider Merge Requests API. It flexible enough to filter merge requests by source_branch.

How do the new Jenkins build strategies interact with "skip" strategies

I'm having trouble understanding how the newer Branch API Basic Branch Build Strategies interact with each other.
What I'd really like is to understand how to understand and craft rules - but for now I'm happy to solve a concrete example:
What I'd like to get is:
Build all branches selected by the SCM rules (Regular Branches), but skip initial builds on branch discovery
Build all pull requests (change requests) selected by the SCM rules
Allow commit messages with a "skip pattern" to skip building a particular change (in a pull request or on a branch)
The building blocks from the Basic Branch Build Strategies seem like a good match at first blush - we have:
Change requests
Regular Branches (or I could use named branches by regexp/wildcard)
"Skip build trigger if commit message contains" to skip by regexp from messages
"Skip Initial build on first branch indexing"
However when all of these are added neither of the skip rules seem to take effect. This could make some sense if the combined strategies are "logically or'ed". Every build candidate is a branch and/or a pull-request so they already match
So an alternative is to combine using the "All strategies match" and "Any strategies match".
All Strategies Match
Any Strategies Match
Regular branches
Change requests
Skip build on message
Skip build on first commit
Now my pull-requests don't build automatically.
I suspect with enough levels of "Any" and "All" I might be able to get something right, but it seems complicated.
Additionally the "Skip" strategies are unclear on how they interact with the "All" filter - since they are negative.
Even more confusingly the individual strategies can be re-ordered - although by default they seem to have a preferred order. I can't see how that interacts through "All", "Any" or just the top-level list.
Can anyone clarify how these strategies interact? I have found no relevant documentation.

What is the Gerrit Follow-up button doing?

What is the "Follow-up" button in the Gerrit Review is doing? And when should it be used?
I am using Gerrit 2.13.8.
I saw this feature mentioned here and also played around with it a bit as I was curious myself.
...allows us to create a Follow-Up change. The Follow-Up changes are
changes that are based on existing changes. This gives you an
opportunity to create a chain of related changes.
The "follow-up" feature allows you to create change-sets very quickly.
The parent commit of these change-sets will be the change-set that they were created from (the change-set where the "follow-up" button was used).
This feature could be useful for when you are wrapping up a change but a few additional bugs or tweaks were found that you don't want to include in the current change-set.
You can create change-sets for those follow-up items rather than having to create the change-sets manually.
The text that is typed into the popup box after you click the follow-up button becomes the commit message for the new change-set.

Is it possible to make review optional on any particular branch in gerrit?

With my information, non-admins may not create a new branch. However, is he/she creates one (or gets it created by taking help of someone admin), he/she would still need to get every commit reviewed before merging into branch. Can we avoid this kind of a scenario where pushing something into a less important branch need not go through review process (without making someone an admin)?
I think you should create a subset of branches/references and give permission where everybody can create such branch and can push commit directly.
So create a new reference like refs/heads/feature-[a-zA-Z]* and add Create Reference, Push - with Force Push option to able to delete branches, Push Merge Commit
you can find more info about Access controls there.

Resources