Move a jira issue between workflows - workflow

I have an issue in JIRA that is following one workflow, workflow looks something like this (for bugs):
New -> Eval -> Approve -> Roadmap/Schedule -> Dev -> Complete
This workflow is for issue type "Bug".
For higher priority bugs, I want a totally different workflow, and for it to have its own issue type, for instance "Priority Bug".
R&D -> Dev -> Release -> Complete
This works great, for new Priority Bugs, but I have a transition, that allows you to promote a normal bug to a priority bug. That transition changes the issue type to Priority Bug properly, but when it gets there, it seems lost, its now not in either workflow. How do I get it to change workflows as well?

I suggest to install Script Runner plugin, and implement this as a single workflow. You can have custom scripted conditions that will check the type of the issue and allow and disallow your transitions thus emulating like it is a different workflow for another issue type.

Workflows are for a given project and for a given issue type. If the bug is in a particular project and of a particular issue type then it will follow the corresponding workflow.
However, when moving from one workflow to another there needs to be some way for JIRA to know what state to go to. When you do a manual move you get a prompt that allows you to decide what state in the new workflow it has. I have never done an automatic move triggered by a transition, but I suspect it will have a problem determining what state the issue should have. Perhaps you could set the state as a part of the transition?

Related

How to set a bug status to 'Reopened' in Azure Devops?

How do I add a state to a Bug with Value = Reopened.
We have only New, Active, Resolved and Closed configured in the bug status dropdown.
The New, Active, Resolved and closed states are the Default State for the Bug Work item.
From you screenshot, you are using the Default Agile Process. The default agile process cannot be changed. So you need to create an inherited Agile process. Then you could modify the inherited process.
Here are the steps:
Step1: Create an inherited Agile process in Organization Settings -> Process.
Step2: Add the Reopend state to Bug Work item in New Inherited Agile process -> Bug -> States -> New state.
In order for your project to use this new inheritance process, you need to change the project process in Organization Settings -> Process -> Agile(Default) -> Projects ->Change Process.
Create an inherited process if you do not have one already (i.e if you are using one of the built in processes), and change process used by your project to use the new one
Add a custom state to your process
The type of states available seem to be defined by the project settings.
According to Microsoft Azure DevOps Documentation it seems like the state categories you mention come from setting the project as Agile Process.
The same documentation page also lets us know that you can add custom states. Presumably if you have the correct permissions to do so.
Also, please consider updating your title to something like "How to set bug to state 'Responded' in Azure Devops?", or something similar, descriptive.

How to move failed / stuck workflow to new version after fixed bug?

My understanding is if the bug was in Activity, the new code will be used since Activity does not have the concept of version. But what if there is a bug in Workflow code and causing some workflows to fail (or even worse, not fail but stuck), we fixed the bug and deployed the new version, but those failing workflows are stuck on old versions. Is there a way to automatically move those failed / stuck workflows to new version and re-run them?
This happening a lot to us because we just started to learn to use Cadence/Temporal
Thank you in advance!
It depends on the bug.
For bugs that cause workflow to get stuck (in Go a nil pointer dereferencing causes panic which blocks the workflow progress by default) deploying the new version of the code is usually enough to unblock them.
If the bugfix requires backwards incompatible change then the best option would be to reset workflow to the point before the bug. This way workflow will be rolled back and continue through the new code.
For situation when the breakage of workflow code is caused by a new bad build you can rollback the workers to the previous build and mark that build as broken and all workflows going to roll back their state to before that build automatically. See "Recovery from bad deployment" section of the Temporal documentation.
If you are using ElasticSearch integration then you can also perform batch reset of multiple workflows using a predicate to select workflows that match some criteria. See "Signal, cancel, terminate workflows as a batch job" section. Besides the name of the section the batch jobs apply to reset operations as well.

Is it possible to check in VSTS was build stated manually or not?

I'm trying to execute a bit different build steps in VSTS based on type how build was started: automatically or manually.
I'm especially interested in accessing that information from powershell script. But so far was not able to find suitable solution or workaround.
Did someone faced similar requirement before? How did you solved it? I would appreciate your help!
Seems you want to know whether the project build is happening through TFS triggered build or manually triggered build.
There is no such feature for vnext build for now. About this , you could submit your uservoice to this link, TFS Product Team is listening to your voice there.
As a workaround either to use two build definitions through different version patterns or manually add a specifical tag after a manually build finished. Through using tags to set some labels on the build to distinguish manual and automatic builds. But this is a manual action, it would be better if we can do this automatically.
It seems to be I've managed to find an option that allows to determine wherever build was triggered automatically or manually.
All builds started manually have actual user in $Env:BUILD_QUEUEDBY variable, while automatic builds have system account there. My value was [********]\Project Collection Service Accounts.
I don't know how reliable it is, but for me so far following code did the job:
# Identifying who triggered the build
$OwnerId = $Env:BUILD_QUEUEDBY;
$OwnerId = $OwnerId.ToUpper();
if ($OwnerId.EndsWith("PROJECT COLLECTION SERVICE ACCOUNTS"))
{
Write-Host "Build was triggered automatically. Resulting files considered 'BETA'"
}
else
{
Write-Host "Build was triggered manually. Resulting files considered 'STABLE'"
}

Create new branch from the Issue

Is it possible to create new branch directly from Issue which is posted on Github? We have project hosted on Github with many issues, it would be easy for us just to click one button in Issue web interface and create new branch for it to start developing.
This is not possible directly from the issue interface. I can try to provide you some workarounds and maybe start a debate why one would want this feature:
Creating branches directly on the web interface
After you've noticed that you need to start working on an issue you can just go to the repository main page (keyboard shortcut gc) and create a branch with the name you want:
Chrome extensions
If this is a must for you, you can create a chrome extension that augments the UI and creates a branch directly from the Issues WebUI using the GitHub API. There's a lot of open source extensions that augment the default WebUI.
Is it the most efficient way to start a new feature?
I think this changes from developer to developer, but having worked with GitHub for 7 years using Issues I've never felt the need for this feature because unless it's a one line change that doesn't require local testing or compilation, I still want to get down to my command line and IDE. If I have to do that, I still have to at least git fetch to get the branch I just created directly through the issue interface. If that's the case I've always preferred to just look at the issue and run git checkout -b branch-name, optionally with git push if my team needs to see the branch.
Then the issue name wouldn't normally translate to a branch name, at least I wouldn't want that. So that option to create a branch from an issue would probably need to spin out a prompt to allow me to name the branch what I wanted.
This is just my personal opinion and nothing else, hope it helps :)
GitHub finally added this feature request to their roadmap.
Summary
The branch is the first thing a developer creates when the start
working on a new issue. Creating that association makes it really easy
for someone to then follow the work happening and keep everything
connected as they take their idea to code.
Intended Outcome
We want to help developers get started on work faster and signal to
their team where to find the code changes related to an issue. It
should also be really easy to then follow development to the pull
request without the user needing to do additional work to link
everything together.
How will it work?
From the issue page, a user can quickly create a branch with an
auto-generated or custom name that becomes associated with the issue.
They can then fetch the branch and switch to it in their development
environment and further development changes (such as commits and pull
requests) are automatically associated with the issue.
https://github.com/isaacs/github/issues/1125
Nope. You can subscribe this issue.
You could accomplish this by creating a small script.
I'd start by leveraging the Issues Event webhook. This will fire a JSON payload every time an issue is opened. When the webhook fires, your script can then create a new branch using the Create a Reference API endpoint. Note: URL must be formatted as heads/branch, not just branch.
There is an app that automatically creates branches for issues. You can install it here for free: https://github.com/marketplace/actions/create-issue-branch
If you want to create the branches manually instead of automatically:
It does not enable you (directly) to click on create branch from the issue. Instead you would have to write a comment in the issue consisting of: /cib. If you do that, it automatically creates the branch from the issue.
Please note I have no affiliation with the app.
Recently I saw that Github finally added this feature to its Issues Panel.
All you have to do is navigate to an Issue on Github and scroll down to the following section:

How can a Jenkins build differentiate between a SCM-triggered, and a user-requested build?

I would like my builds to behave differently (a handling script needs to know) if a person requested the build through the UI "build now" button, or if it was triggered by SCM. I don't want to have to provide a checkbox in the UI that the users have to alter - I've already gotten blowback from them about such things. Trouble is, any parameter I set has the same default regardless of how the build is triggered.
You should not really have 1 job with different behaviour. If you need different behaviour set up a job per behaviour. Best bet in your case is to have 2 separate jobs, one for the SCM triggered builds, and one for the manually triggered builds.
There's a plugin to allow you to filter jobs into separate pages (can't remember the name at the moment). You could set all SCM builds on 1 page and manual builds on another, then set the manual build page as the default one on login. Users will only see the jobs you want triggered manually by default, but can still access the SCM triggered builds by selecting the other page.
Could you somehow check the SCM polling log during the pre-build (with a script), and then go from there?