huserben / TfsExtensions

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

Issue with passing parameters #96

Closed marwahaks closed 5 years ago

marwahaks commented 5 years ago

using v3.*

I have BuildA and BuildB. I want to replace one of the variables in Build A via the Trigger Build task in VSTS.

Result: I have made the variable in BuildA, which we'll call 'VariableInBuildA', 'settable at queue time' and I've passed it in the additional parameters box as "VariableInBuildA: newvalue". My expectation was that this should overwrite the variable in BuildA but it does not.

huserben commented 5 years ago

Hi @marwahaks

I just tried in my environment and it seems to work ok, so maybe there is some configuration issue. Could you provide me the logs of the task?

leahymichael commented 5 years ago

I'm having the same problem, have been doing this setup for months (with no problems) just started having issues recently. here's a snippet of our logs:

2018-09-28T15:41:04.6370569Z ##[debug]Evaluating condition for step: 'Trigger a new build of SIEnterpriseLibrary' 2018-09-28T15:41:04.6371353Z ##[debug]Evaluating: succeeded() 2018-09-28T15:41:04.6371690Z ##[debug]Evaluating succeeded: 2018-09-28T15:41:04.6372035Z ##[debug]=> True 2018-09-28T15:41:04.6372408Z ##[debug]Result: True 2018-09-28T15:41:04.6372737Z ##[section]Starting: Trigger a new build of SIEnterpriseLibrary 2018-09-28T15:41:04.6379918Z ============================================================================== 2018-09-28T15:41:04.6380095Z Task : Trigger Build 2018-09-28T15:41:04.6380238Z 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. 2018-09-28T15:41:04.6380403Z Version : 3.0.3 2018-09-28T15:41:04.6380489Z Author : Benjamin Huser 2018-09-28T15:41:04.6380575Z Help : 2018-09-28T15:41:04.6380711Z ============================================================================== 2018-09-28T15:41:05.1626104Z ##[debug]agent.TempDirectory=E:\Agents\Build_work_temp 2018-09-28T15:41:05.1653958Z ##[debug]loading inputs and endpoints 2018-09-28T15:41:05.1661665Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2018-09-28T15:41:05.1677559Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2018-09-28T15:41:05.1681994Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2018-09-28T15:41:05.1685098Z ##[debug]loading INPUT_AUTHENTICATIONMETHOD 2018-09-28T15:41:05.1687459Z ##[debug]loading INPUT_BLOCKINPROGRESSBUILDS 2018-09-28T15:41:05.1689857Z ##[debug]loading INPUT_BUILDDEFINITION 2018-09-28T15:41:05.1697091Z ##[debug]loading INPUT_BUILDPARAMETERS 2018-09-28T15:41:05.1699690Z ##[debug]loading INPUT_CANCELBUILDSIFANYFAILS 2018-09-28T15:41:05.1702154Z ##[debug]loading INPUT_DEFINITIONISINCURRENTTEAMPROJECT 2018-09-28T15:41:05.1707746Z ##[debug]loading INPUT_DELAYBETWEENBUILDS 2018-09-28T15:41:05.1711092Z ##[debug]loading INPUT_DEPENDENTONFAILEDBUILDCONDITION 2018-09-28T15:41:05.1724634Z ##[debug]loading INPUT_DEPENDENTONSUCCESSFULBUILDCONDITION 2018-09-28T15:41:05.1725841Z ##[debug]loading INPUT_DOWNLOADBUILDARTIFACTS 2018-09-28T15:41:05.1726806Z ##[debug]loading INPUT_DROPDIRECTORY 2018-09-28T15:41:05.1748165Z ##[debug]loading INPUT_ENABLEBUILDINQUEUECONDITION 2018-09-28T15:41:05.1749405Z ##[debug]loading INPUT_FAILTASKIFBUILDSNOTSUCCESSFUL 2018-09-28T15:41:05.1750637Z ##[debug]loading INPUT_FAILTASKIFCONDITIONSARENOTFULFILLED 2018-09-28T15:41:05.1751503Z ##[debug]loading INPUT_IGNORESSLCERTIFICATEERRORS 2018-09-28T15:41:05.1752341Z ##[debug]loading INPUT_INCLUDECURRENTBUILDDEFINITION 2018-09-28T15:41:05.1753199Z ##[debug]loading INPUT_QUEUEBUILDFORUSERTHATTRIGGEREDBUILD 2018-09-28T15:41:05.1754184Z ##[debug]loading INPUT_STOREINENVIRONMENTVARIABLE 2018-09-28T15:41:05.1755284Z ##[debug]loading INPUT_TREATPARTIALLYSUCCEEDEDBUILDASSUCCESSFUL 2018-09-28T15:41:05.1783492Z ##[debug]loading INPUT_USESAMEBRANCH 2018-09-28T15:41:05.1814356Z ##[debug]loading INPUT_USESAMESOURCEVERSION 2018-09-28T15:41:05.1833641Z ##[debug]loading INPUT_WAITFORQUEUEDBUILDSTOFINISH 2018-09-28T15:41:05.1835653Z ##[debug]loading INPUT_WAITFORQUEUEDBUILDSTOFINISHREFRESHTIME 2018-09-28T15:41:05.1836491Z ##[debug]loaded 26 2018-09-28T15:41:05.1837949Z ##[debug]Agent.ProxyUrl=undefined 2018-09-28T15:41:05.1870812Z ##[debug]Agent.CAInfo=undefined 2018-09-28T15:41:05.1871478Z ##[debug]Agent.ClientCert=undefined 2018-09-28T15:41:05.1872007Z ##[debug]Agent.SkipCertValidation=undefined 2018-09-28T15:41:05.1918351Z ##[debug]definitionIsInCurrentTeamProject=true 2018-09-28T15:41:05.1920383Z ##[debug]tfsServer=null 2018-09-28T15:41:05.1921833Z ##[debug]teamProject=null 2018-09-28T15:41:05.1927753Z ##[debug]buildDefinition=SIEnterpriseLibrary 2018-09-28T15:41:05.1933625Z ##[debug]ignoreSslCertificateErrors=false 2018-09-28T15:41:05.1935579Z ##[debug]queueBuildForUserThatTriggeredBuild=true 2018-09-28T15:41:05.1937341Z ##[debug]useSameSourceVersion=false 2018-09-28T15:41:05.1938971Z ##[debug]useSameBranch=true 2018-09-28T15:41:05.1939755Z ##[debug]branchToUse=null 2018-09-28T15:41:05.1941722Z ##[debug]waitForQueuedBuildsToFinish=false 2018-09-28T15:41:05.1943491Z ##[debug]waitForQueuedBuildsToFinishRefreshTime=60 2018-09-28T15:41:05.1945392Z ##[debug]failTaskIfBuildsNotSuccessful=true 2018-09-28T15:41:05.1947203Z ##[debug]cancelBuildsIfAnyFails=false 2018-09-28T15:41:05.1948780Z ##[debug]treatPartiallySucceededBuildAsSuccessful=false 2018-09-28T15:41:05.1950948Z ##[debug]downloadBuildArtifacts=false 2018-09-28T15:41:05.1952742Z ##[debug]dropDirectory=E:\Agents\Build_work 2018-09-28T15:41:05.1954766Z ##[debug]storeInEnvironmentVariable=false 2018-09-28T15:41:05.1954967Z ##[debug]demands=null 2018-09-28T15:41:05.1955559Z ##[debug]queueid=null 2018-09-28T15:41:05.1959919Z ##[debug]buildParameters=\"Society.Build.Trigger.Source\" : \"Main\" 2018-09-28T15:41:05.1960182Z ##[debug]delayBetweenBuilds=0 2018-09-28T15:41:05.1979887Z ##[debug]authenticationMethod=OAuth Token 2018-09-28T15:41:05.1980544Z ##[debug]username=null 2018-09-28T15:41:05.1980966Z ##[debug]password=null 2018-09-28T15:41:05.1981332Z ##[debug]enableBuildInQueueCondition=false 2018-09-28T15:41:05.1981734Z ##[debug]includeCurrentBuildDefinition=true 2018-09-28T15:41:05.1982096Z ##[debug]blockingBuildsList=null 2018-09-28T15:41:05.1982473Z ##[debug]blockInProgressBuilds=false 2018-09-28T15:41:05.1982867Z ##[debug]dependentOnSuccessfulBuildCondition=false 2018-09-28T15:41:05.1983249Z ##[debug]dependentBuildsList=null 2018-09-28T15:41:05.1983611Z ##[debug]dependentOnFailedBuildCondition=false 2018-09-28T15:41:05.1984013Z ##[debug]dependentFailingBuildsList=null 2018-09-28T15:41:05.1984370Z ##[debug]failTaskIfConditionsAreNotFulfilled=false 2018-09-28T15:41:05.2003274Z Using current Team Project 2018-09-28T15:41:05.2003812Z Team Project: society with ID REMOVED 2018-09-28T15:41:05.2004206Z Using current Collection Url 2018-09-28T15:41:05.2008842Z Server URL: REMOVED 2018-09-28T15:41:05.2008985Z Trying to fetch authentication token from system... 2018-09-28T15:41:05.2021430Z Using OAuth Access Token 2018-09-28T15:41:05.5593182Z Provided team project was guid. 2018-09-28T15:41:05.5597785Z Build shall be triggered for same user that triggered current build: Mike Leahy 2018-09-28T15:41:05.5598397Z Using same branch as source version: $/society 2018-09-28T15:41:05.5599136Z Will trigger build with following parameters: \"Society.Build.Trigger.Source\" : \"Main\" 2018-09-28T15:41:05.8369453Z Found parameter Society.Build.Trigger.Source with value: Main 2018-09-28T15:41:06.1645521Z ##[debug]task result: Failed 2018-09-28T15:41:06.1651195Z ##[error]An item with the same key has already been added. 2018-09-28T15:41:06.1651865Z ##[debug]Processed: ##vso[task.issue type=error;]An item with the same key has already been added. 2018-09-28T15:41:06.1653002Z ##[debug]Processed: ##vso[task.complete result=Failed;]An item with the same key has already been added. 2018-09-28T15:41:06.1746494Z ##[section]Finishing: Trigger a new build of SIEnterpriseLibrary

leahymichael commented 5 years ago

I think I found my issue - it appears that something is now case sensitive that wasn't before. My variable in question was SOCIETY.BUILD.TRIGGER.SOURCE and in the other build (input variable) I had it upper case, but the output variable of the trigger task was lower case, and that's what seemed to allow the error state to happen where it tried adding the same variable.

Anywho, matched the casing and I'm good now... Just odd that it was working and just stopped.

FWIW I had been running on the v2 version of this task, and started getting a "Bad Request" error when that was triggering the builds, so I updated to the v3 task, and that's when I started getting the duplicate key error...

huserben commented 5 years ago

@leahymichael

Thanks for that clarification, it could be that due to the underlying change made with version 3 that case sensitivity is now relevant. Why it stopped working with v2 however it can't tell, the interfaces the task works against are the same in v2 and v3.

@marwahaks could you maybe check whether you have the same issue with the case sensitivity?

marwahaks commented 5 years ago

@huserben Yeah, mine is working now. thank you

marwahaks commented 5 years ago

oops sorry.

huserben commented 5 years ago

Ok thank you both for reporting this. If you face any other issues or have a feature request please don't hesitate to create another issue.