huserben / TfsExtensions

Extensions for TFS 2015+ such as custom Widgets (require TFS 2017) and Build Tasks
MIT License
45 stars 22 forks source link

Cannot set version number as parameter value in old version #144

Closed oskarskog closed 4 years ago

oskarskog commented 4 years ago

Hi,

from the documentation it seems pretty clear that I should be able to use build parameters like this in the GUI: Version: $(Build.BuildNumber). However the pipeline fails complaining about the format of the parameter, as can be seen from the output.

The task's version might be a bit out of date and I don't have the possibility to update but if there's any way to get what I want to do to work with this version I'd appreciate any help I can get.

Task         : Trigger Build
Description  : This tasks allows to trigger a new Build (add it to the queue) as part of a Build Definition. It contains as well some conditions that can be applied, for example if the last build of certain definition was successful or not.
Version      : 2.4.5
Author       : Benjamin Huser
Help         : 
==============================================================================
Using current Team Project Url
Path to Server: https://abc
Using Personal Access Token
Build shall be triggered for same user that triggered current build: Joe
Source Version: d353a76e389b752c3c116aa8b3ed81df62d9c3ea
Triggered Build will use the same source version: d353a76e389b752c3c116aa8b3ed81df62d9c3ea
Using same branch as source version: refs/heads/somebranch
Will trigger build with following parameters: Version: 1.0.0-alpha.14
Queue new Build for definition Distribute app
Failed to deserialize the build parameters. This field must be a stringified JSON dictionary.
##[error]Could not Trigger build. See console for more Information.
##[section]Finishing: Distribute app
oskarskog commented 4 years ago

Ok, it seems the problem was between the chair and the keyboard as usual. Since $(build.buildnumber) expands to 1.0.0-alpha.14, the first character being '1' caused it to being parsed as an int, adding surrounding single quotes fixed it.