Set Bitbucket triggers based on Jira issue labels - bitbucket

What I am trying to achieve:
If there's a certain Label set in Jira's issue I want to automatically decline Pull Request (with comment, if possible) if this label is in issue of type bug.
Is it possible to do such thing?

No, it's not possible by default and I'm not aware of any add-on on the marketplace that is able to do it.
However, you can create some scripts to achieve this. You can create a custom listener (via ScriptRunner add-on) to watch changes on Labels and then change/decline the linked PR over REST API.
Alternatively, you can script a custom merge check on Bitbucket side (if Bitbucket is used) checking the linked Jira issue's labels and blocking the PR from merging if condition is met. ScriptRunner for Bitbucket would be used instead.
Note: It depends what DCVS you use and if you use on-premise Jira (Server/DC) or Cloud one.

Related

how to get jenkins build urls related to a jira fix version?

I need some help to ingrate Jenkins with jira my user case is this one : i would like to feed urls of builds related to a Jira fix version. This is important for us ( audit & compliance purposes )
How can i do that ?
Think you in advance.
regards,
This is how we handled it:
Add a custom text field to every jira issue type. it can be 'build number' or 'build url' or whatever information you need to display regarding the jenkins build
Create a python script that receives as parameters a list of jira issues and a build number.
Using the JIRA python module (pip install jira), the script creates a connection to jira, goes over the list of issues and updates the custom field above to the given build number.
if the list of issues is not known in advance, then instead of parameter you can provide (or hard-code) a JQL query which the script can use to obtain the list of issues.
Depending on your needs, you may want to skip updating issues who already has a build
number set (either manually or by a previous build)
(Sorry, i can't share exact code but it shouldn't be complicated.)
In your Jenkins build, add a 'batch command' item which runs that python script with the appropriate parameters.

TFS Build Definitions: Use complex patterns in branch filter for triggering build

In TFS it is possible to set the trigger of a build definition to a specific branch (e.g. master). It is also possible to use patterns like so features/* in order to execute the build whenever there was a push to a branch underneath features/.
This already worked for me. In my use case now I want to trigger the build whenever there was a push to a branch with a specific version number in it.
E.g. Bugs/BUG1234/BUG1234_v1.2
I already tried things like **/*_v1.2, but it didn't work.
Did I miss something, or is it just not possible?
It's not possible for now, CI filter does not support such complex patterns. Please see Continuous integration (CI)-Filters for details.
As a workaround you can add multiple filters with the paths wich include the specific version number in it.
E.g.:
Include Bugs/BUG1234/BUG1234_v1.2
Include Bugs/BUG5678/BUG5678_v1.2
Include Bugs/BUG910/BUG910_v1.2
However the requirement makes sense, I have submitted a user voice here for you to suggest the feature. You can go and vote it up to push the Dev team to achieve that in future.

Integration Jira - GitLab

I would like to exploit the integration between the two tools to be able to automatically create a branch in GitLab for every new Bug or Feature ticket created in Jira.
I would like to know if (i) it is possible; (ii) what is the link between the two tools (I guess the unique ID number assigned by Jira); (iii) assuming the first point is true, what happens to the created branch when I close the Jira issue (e.g. I've mistakenly created a bug fix that was not needed).
I've used Jira in conjunction with GitHub so I'll try my best to help you.
I) This is definitely possible.
II) We used to use the unique ID given to a ticket and include it within in the branch name this creates a link between both tools. Any changes committed on the branch will be shown in JIRA.
III) From experience when this happens the branch will persist and will need to be deleted manually using a console we used to use a .git console and used a delete command.
I also found through a quick google search some documentation on GitLab on integration with JIRA as well as some insight on creating branches.
Doc - https://docs.gitlab.com/ee/user/project/integrations/jira.html
Branch - https://gitlab.com/gitlab-org/gitlab-ce/issues/3886
Hope this helps.

Can we export testcases/Reports from testlink to JIRA

We are planning to use one testcase management tool for our project.
I am using testlink in my previous project.
But my management want JIRA as all our sprint planning and bug tracking is happing over there.
Can I export Testlink testcases and reports in JIRA without using any add-ion
If no, Then what are other option I can use.
I have find Zephyr add-ion which can do similer like this. is it any other option present?
I have also found that JIRA can accept rest-api but then I need to make changes in testlink project so testlink can send JSON to JIRA
What should I follow. any suggestion will help
I worked with one QA team that created a custom 'testcase' issue type in JIRA. They removed all the standard JIRA fields that weren't required and added in custom fields for things that were not covered by standard JIRA fields (such as 'test category', 'pass/fail' checkbox, etc.).
The 'testcase' issues were used as sub-tasks for user stories. Using this approach each requirement had one or more test cases associated with it.
When they needed to report they would do an issue search for issues of type 'testcase' within a particular time period. Then they would export all fields to Excel.
In my company we're using Testlink and JIRA and has been proposed to remove Testlink migrating all the data to JIRA but depending of the usage of JIRA(amount of data it is managing) as this can overload JIRA due to you will need several custom fields, maybe customized with JavaScript and that can be worth.
We analysed the possibility to use the Zephyr plugin which is appropiated for this usage.

TFS: Can I have a script run when I create a new label?

We're using TFS 2008 for our source control. We're currently doing embedded work so our actual build process is using Analog Devices VisualDSP++ IDE. However, we do still use labels on TFS. What I had hoped was for the ability to have a script run when a label is applied. The idea here is to update version information in some data files. This would help ensure that every label programmatically updated that version string. Currently we have to do this manually.
I'm used to Subversion and Git to some extent and was hunting around for post-commit type hooks or something similar. TFS seems like a different beast.
I'm not a stranger to .NET and (so far as I know) could write a simple app that did the grunt work of updating our files and then applied the label programmatically but it seems like there's got to be an easier way.
Am I right? Is there some mechanism that I can attach a script/batch file when a label is applied in TFS?
No, sorry, there's no server-side event fired when labels are created/updated. I'd recommend using branches instead of labels. Then you can hook the CheckinEvent (filtered by the path of the branch[es] in question).
For more info on subscribing to CheckinEvent (including filters), check out Buck's blog + updates + links: http://blogs.msdn.com/buckh/archive/2006/09/29/checkinevent-path-filter.aspx
For a code sample that illustrates what your event listener might look like, check out Martin Woodward's "bunny": http://www.woodwardweb.com/vsts/behind_brian_th.html
For info on using branches instead of labels for code promotion, try http://tfsbranchingguideiii.codeplex.com/

Resources