How do I Copy Task Groups in Visual Studio Online? - deployment

Task Groups are a great way to build a library of commonly executed Build and/or Deployment Actions in Visual Studio Online. Does anyone know of a way to make a copy of (or clone) an existing Task group? I don't see that as an option in the UI anywhere.

I think there is no way to do this yet. It's not even possible on TFS On-premise. Though our TFS professional told us, it should come with TFS2017 Update 1.
Only thing you can do, is select all tasks in your task group and create a new TaskGroup with them. Which is basically the same as cloning the task group itself - it only takes you some clicks more.

Or you could export your task group, change its name and Id in the exported Json, and import it.

Currently there isn't the copy Task Group feature in VSTS and TFS.
You can create TaskGroups according to your requirement and manage them from TaskGroups tab, then use them directly in different scenario. Please follow below steps.
Create a Task Group from Build/Release definition
Navigate to Build&Release > Task Groups
Select the Task Group you need to modify, change the Properties/Tasks
Save the Task Group
If you just want to copy the Task Groups, you can install the "Copy Build Steps" extension. it can copy build/release steps from one definition to another, also support copy the Task Group.
After installing the extension, navigate to the Builds hub > All definitions. A new menu item, ‘Copy build steps’ will be available when you click the ‘’…’’ behind the definition.
To Use a task group:
In a build/release definition, choose Add steps/tasks to open in the Task catalog. Select the category you specified for your task group and find the task group (it displays the name and description you specified when you created it), then choose Add - just as you would with any other task.

Related

Azure Devops Services - Change Team project from one hosted process to another

everybody.
We have just successfully migrated from ADServer 2019 to ADServices.
We have a single custom process template that is used for all Team Projects. After migration, each team project has its own Process Template, as expected.
However, as all migrated Process Templates are equal, I would like to group all Team Projects in a single Process Template.
In order to do that, I do these steps:
Go to Organization Settings
Select Process
Click on one of my hosted process templates
Click on "Projects"
Click on "..." and select "Change Process"
A pop up appears, where I can select the target process I like to change. It's important to note that all hosted migrated process seems to be avaliable for the change.
When I select another hosted process, and click "Ok", the message "The feature is disabled. Contact your Azure DevOps Server administrator." appears and the change can't be done.
I have been looking how to enable this feature with no success.
Has anyone had this situation?
If is not possible to do that, is there any way to import the future changes of my process template via command line, in order to update all my team projects ?
Thanks in advance for the help.
Regards,
Alba
We evaluated this situation with MS and the answer is that there is no way to make this change of process template between team projects belonging to different hosted process template, even though the process templates are equals.
As we cannot change our Process Template to hosted process by now, our solution was making a script using AD api, in order to make a bulk update of all process templates for all our team projects.
See https://learn.microsoft.com/en-us/rest/api/azure/devops/processadmin/processes/import%20process%20template?view=azure-devops-rest-6.1
From the screenshot, you were trying to change the process used by the team project from a hosted xml to an inherited process. For your scenario, you need to
cloned your Hosted XML process to an inherited process.
Change a project from Hosted XML to an inherited process.
An useful blog for your reference:
https://devblogs.microsoft.com/devops/moving-from-hosted-xml-process-to-inherited-process-ga/

How to deploy to a server without build a projekt

We have an ImageVault website that we do not develop ourselves. But want version management in TFS and be able to publish against tests and production servers.
It does not need to be built because it is already finished.
How should you set up a building when you should not build anything?
Is it possible to set up a pipeline without having a building?
It is possible to set up a pipeline that doesnot build your project. You project is built by the build tasks in the pipeline. You can just disable or exclude the build tasks from your pipeline if you donot want your project be built.
You can also create an empty pipeline without any tasks inside. You can follow below steps to create an empty pipeline.
1,Sign in to your Azure DevOps organization and navigate to your project.
2,In your project, navigate to the Pipelines page. Choose the Pipelines tab and click new pipeline on the top right corner of the page.
3,Walk through the steps of the wizard by first selecting the location of your source code.(You can create a classic UI pipeline by choosing "Use the classic editor to create a pipeline without YAML".)
4,Then choose to start with An Empty Job under Select a template
With above steps, a pipeline without build tasks is created. You can then add some utility tasks like copy file task, publish artifacts task etc. Utility tasks donot do the building work.
You might need to add some utility tasks like publish build artifacts tasks if you want to deploy release pipeline.
Check here to learn more about creating your pipeline

Team Foundation Server: Combine multiple build steps into one step

We have many TFS builds in place. I have same set of steps used in many builds. I want to combine them into a single step. So that I can reuse it across the builds instead of repeating each step in each build. Because it is difficult when I have to make changes to the power-shell scripts which need to be changed everywhere.
If you are use TFS 2017, you can use Task Groups. Press ctrl key -> select the tasks you want to encapsulate -> right click -> create task group. After that, if you need these tasks in another build definition, you can select the task group instead.
If you use other older TFS versions, task groups is not available. But you can clone a build definition, then the new build definition will have the tasks and setting with the one you cloned.

How to use powershell in tfs 2017

I am trying understand how to really use PowerShell in TFS. I would like to add a release step to create a work item task, to tell our release management team they require to approve a release.
Our company has many team projects and I want this to be available as a module that can be used by any project. The process I am using to use this is I am adding an artifact for the TFS project that we store our generic item.
It is under $\BuildSupport, for this example, I create a build for my project under $\WEB. I am also creating the release Under $\Web as well. I create my new release definition, I add my Build artifact.
I then add a Team foundation Version Control Artifact to $\BuildSupport Source alias is "BuildSupport".
I then add a environment step called TEST PRODUCTION and add PowerShell task where the script path is: $(System.DefaultWorkingDirectory)/BuildSupport/Main/BuildTools/TFSBuildScripts/CreateWorkItem.ps1
My issue is that when creating a new release it asks every time for me to choose the artifact version based the changeset for BuildSupport.
I don't want to have everyone do this every time is there a better way?
There isn’t the way to queue a new release without specify the version of TFVC artifacts. I submit a user voice here: Default version of artifacts when queue new release.
The workaround is that:
You can create a task group for each team projects, then add this task group to related release definitions. (you need to update the task group if there are updates)
Create or open a release definition
Add PowerShell task and configure it (e.g. Type: Inline Script, Arguments: [necessary arguments], Inline Script: [powershell script] etc…). You also can specify the PowerShell file in the Shared folder (Map BuildSupport to shared folder, then current version is the "default" version when queue release)
Right click this task > Create Task Group
After that you can add this Task Group to other release definitions directly.
Another way is that you can create a build/release task extension, then install it for necessary team project, after that you can add that custom build/release task to build/release definition. For this way, you just need to update the extension if there is the update.

Need to add reference from one VSTS Build task to another task

I am working on creating custom vsts build task using Hosted agent and powershell script. I just want to add reference of existing task available out of the box in vsts (Publish Build Artifacts). Is there any way to reference this task in our custom task? Or I just have to implement the functionality provided by PublishBuildArtifacts manually?
The way to reference another task us to grab the sources from the Task Repository on GitHub and package them with your own task (in a subfolder). You'll need to copy the inputs from their task.json and merge them into yours if you want to allow other users to configure the fields exactly the same way as the other task is doing.
You can find the task implementations here: https://github.com/Microsoft/vsts-tasks make sure you select the right branch, the master branch is the bleeding edge, and it may contain a version of the tasks that is not fully battle tested or may not be compatible with the latest version of the agent that has been released (or the minimal agent version you are targeting).
Or you can grab the implementation from a build agent's tasks directory.
Remember that for certain functionality, the VSTS Task SDK has built-in methods to upload artefact, which may make your life easier if you decide to implement the functionality on your own.
The team that built the agent has been pretty specific about making sure that tasks are self-contained and need to package their own dependencies or flag a demand. This is to ensure that each task can evolve and change independently.