2
votes

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.

Here is a screenshot of the error message

I don't want to have everyone do this every time is there a better way?

1
"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." Emails can be configured to be sent out when an approval is needed. Why reinvent the wheel?Daniel Mann
Emails are not good enough, our process is very specific and they work on a task queue. Also when we are doing the release to production we need to also associate the user stories that are being deployedgreektreat
The user stories are automatically associated with the release assuming commits have been associated with user stories. It sounds like your process should be re-evaluated to account for the capabilities of the tools you're using.Daniel Mann
We have many projects with many releases to QA and prod on a daily bases. we also use this as a queue so we know what will be released at a specific time as well we are using Octopus Deploy and the task generated includes the url of the deployment for approval. There always is a better process but this is the approved process we put forward with SOX compliance we are not using. it is proposal that I can put forward in the future but I am working on converting my XAML build to the new TFS build process and this is the final step of completiongreektreat
@greektreat There isn’t the way to queue a new release without specify the version of TFVC artifacts, I submit a user voice (updated my answer)starian chen-MSFT

1 Answers

0
votes

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)

  1. Create or open a release definition
  2. 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)
  3. 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.