TFS 2015 build task - Manual Intervention - deployment

TFS 2015 does not have a manual intervention build task. I know TFS 17 does but we are not on this. Does anybody have a workaround for this?
Im looking for a powershell script that I can upload as a tfs 2015 build task and use. I would like to run a TFS 2015 Release and I would like the task to essentially halt the Release process and then continue after some external approval process or something.
This maybe stupid but ... I was thinking maybe something like, you run your Release build, the task opens up a popup window and waits for the user to click "OK" and then continues. I know in practice this is difficult because powershell doesn't let you open a popup window remotely
Does anybody have a solution?
Thanks

Manual Intervention Task is the new feature in TFS 2017. The workaround for TFS 2015 is to split the workflow into two environments with an approval in between.

Related

Azure DevOps Pipelines Release Copy Files step "The process cannot access the file because it is being used by another process"

I am using Azure DevOps pipelines releases to try to deploy a windows service on premise. Periodically, the windows copy files step will hang and try again every 30 seconds and output "The process cannot access the file because it is being used by another process" as it attempts to copy the build artifacts.
We've ruled out any kind of permission issue. We've tried all sorts of tools to see what might be locking these files up and they don't tell us much.
This has happened before in the past with some other projects I was also trying to release on premise. Sometimes, I am able to just wait an hour or two and redeploy successfully (not exactly a solution I'm satisfied with), but this one particular project, a windows service, seems to be experiencing the issue very, very frequently. Almost every time I try to deploy.
Has anyone else experienced this? Or any word from Microsoft on the issue?
Thanks in advance.
I experienced this issue while trying to create and deploy a release from an existing artifact. So I have a build pipeline on Azure Devops that generates artifacts to be used by the release pipeline. All I did was to make a commit that triggered the build pipeline which generated a new artifact and triggered the release and it worked fine.
It was the first time I experienced this and I had no clue on why it happened.
I'm going to be doing more research and share any thing I find helpful.

How to take code backup in TFS 2015 during Release Management/Pipeline

I've done Build for my code in TFS 2015. Now i'm configuring CD, my tasks would be
Take Backup of existing release code
Deploy build artifact to my server
Rollback task if deployment fails
I'm struck with Task 1 : Take backup of exiting release code.
I would prefer using PowerShell task as suggested over here, as my my release server path differs with different an ID {mulitple paths with multiple Id's]
How to take code backup in TFS 2015 during Release Management/Pipeline
Indeed, Backing up existing release code on the server is really a tricky issue, if your release server path differs with different an ID. It seems we have to create several task to back up release code from different release server path or we have to write the scripts(PS, Batch) to back up those release code.
To resolve this question, I would like provide a workaround, you can check if it works for you. The tasks would be:
Deploy build artifact to the server.
Use Copy task to back up the build artifact to the local folder of the TFS server machine with condition Only when all previous tasks have succeeded.
Deploy backup artifact to the server with condition Only when all previous tasks failed (Also check the option Clear Target Folder under the Advanced tab).
Some explanations for tasks 2 and task 3:
Task2: This steps is use to back up the release code of the last successful deployment, and save it to the local folder on the server.
Task3: This steps is used to deploy the back up the release code to overwrite the release code that failed to deploy before, if the previous deployment task failed.
Hope this helps.

Can you queue a Microsoft Visual Studio Team Foundation Server build remotely with powershell?

Given Microsoft Visual Studio Team Foundation Server 2015 (on premises), is it possible to interact with the build and release process remotely with powershell?
For instance, we have CI builds in place with various triggers...e.g. a working branch is merged to a feature branch will kick off a build. If I am working on a one off branch that is not part of the trigger set, can I queue a build with a script that I execute on my machine? Can I do things with the results of that build...e.g. queue the release that is created as a result of the build.
yes you can via the TFS Rest API.
I implemented the following Task with Powershell: https://marketplace.visualstudio.com/items?itemName=benjhuser.tfs-extensions-build-tasks
You can have a look at the source as well.
You can find the references to the API on msdn:
https://www.visualstudio.com/en-us/docs/integrate/api/build/overview
Regards

Where are TFS 2015 custom build tasks stored?

We use TFS 2015 on premise. Where are the TFS 2015 custom build tasks stored? or how can I download a existing build task?
I know you can download the build tasks from github. But this is not what I am looking for.
They're stored internally in the database. The easiest way to "extract them" is to install a local agent, create a build definition that targets that agent and add the task you want.
Queue the build and the agent will download the task and will store them in a subfolder under the Agent's working directory called "Tasks". Grab the contents from there.
You'll be able to push the task using the tfx build tasks upload command.
If you're downloading tasks from VSTS for installation to a onpremise TFS server, you may need to get access to a specific task version, as the service may be ahead and may have other dependencies which have not been deployed to the TFS server.
Another thing to note is that when downloading a task from VSTS, it may have the preview flag set to true in it's task.json, these tasks can be uploaded, but will be invisible in TFS, before uploading them you should remove the reference to "preview": true from the task.json completely.

Run VSTS Build/Release Task only when previous task errors

I am trying to create a Visual Studio Team Services Extension Task for my builds and releases. I need a task that will send out an alert to another system if a previous task (including the default build/test/publish/etc.) fails.
I have already created the task to send the alert. However I do not see a way to kick off the task only if my build fails.
Is there a way in VSTS to run a task if a previous task fails, but not run it if all other tasks were successful?
It is now possible to select a running condition for all tasks with the following possible values:
Only when all previous tasks have succeeded
Even if a previous task has failed, unless the build was canceled
Even if a previous task has failed, even if the build was canceled
Only when a previous task has failed
Custom conditions
EDIT:
It is currently part of a preview, you can enable it through the "Preview features" menu after you click on your profile click on VSTS:
And activate the "New Build Editor":
There is no built-in feature.
But you can use the "Rollback" task from the Release Management Utilities to run a powershell script on failure.
https://marketplace.visualstudio.com/items?itemName=ms-devlabs.utilitytasks