Closed sstamenova closed 7 years ago
Hi
is it possible that your Project Name contains a space? If so i could reproduce the problem and it might be the same issue as https://github.com/huserben/TfsExtensions/issues/12
Hello,
The project name does not contain a space. I looked through the issues and none of them seemed to be the same.
Thanks, -Stella
From: Benj Huser [mailto:notifications@github.com] Sent: Tuesday, June 27, 2017 12:28 PM To: huserben/TfsExtensions TfsExtensions@noreply.github.com Cc: Stella Stamenova stilis@microsoft.com; Author author@noreply.github.com Subject: Re: [huserben/TfsExtensions] The remote server returned an error: (400) Bad Request (#13)
Hi
is it possible that your Project Name contains a space? If so i could reproduce the problem and it might be the same issue as #12https://github.com/huserben/TfsExtensions/issues/12
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/huserben/TfsExtensions/issues/13#issuecomment-311460146, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AcXEH9XQ2I0ID3kPTycPV_4b3lV1u2mWks5sIVexgaJpZM4OHBf7.
Hmm ok, I successfully managed to trigger a build from a different project as long as there are no spaces in the team project and collection.
Is the team project on the same TFS Server as the build that triggers it?
Right now the original build (which does the triggering) is running on a Hosted Agent.
The build that is being triggered runs on a Azure VM.
I have it setup to try and queue the second build with the same Requestor as the original build (in this case, both me).
There’s a different extension that also triggers a build which I can successfully use to trigger builds between the two projects, however, it does not support the feature to use the same requestor or to pass parameters.
Thanks, -Stella
From: Benj Huser [mailto:notifications@github.com] Sent: Tuesday, June 27, 2017 12:37 PM To: huserben/TfsExtensions TfsExtensions@noreply.github.com Cc: Stella Stamenova stilis@microsoft.com; Author author@noreply.github.com Subject: Re: [huserben/TfsExtensions] The remote server returned an error: (400) Bad Request (#13)
Hmm ok, I successfully managed to trigger a build from a different project as long as there are no spaces in the team project and collection.
Is the team project on the same TFS Server as the build that triggers it?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhuserben%2FTfsExtensions%2Fissues%2F13%23issuecomment-311462365&data=02%7C01%7Cstilis%40microsoft.com%7C5f88ccea185441f04ffe08d4bd93d5b2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636341890027558395&sdata=apKC3yLVcXiCC3YXmbpEzWVNK1Iueciz%2B0WGNxU%2FtZU%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAcXEH2Y8CM-15ziNSSgOOkYxZ-tNWeYWks5sIVnHgaJpZM4OHBf7&data=02%7C01%7Cstilis%40microsoft.com%7C5f88ccea185441f04ffe08d4bd93d5b2%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636341890027558395&sdata=K4%2FDKouLAQif2%2F4KTivy%2FsDf6IWMu1lMU0KTqa0IYN8%3D&reserved=0.
Is it somehow possible that you would send me a screenshot of your configuration so i could see if there might be a problem with the configuration?
Other possible source of the problem: Do you use git repositories or TFVC? Or maybe even one project of each?
We use git repositories for both.
Which part of the configuration?
I think I might then have a clue where the problem lies We specify the "sourceBranch" of the build we want to trigger and use the same that the original build was triggered with: "2017-06-27T20:04:01.3660784Z { definition: { id: 14 }, sourceBranch: "refs/heads/master", requestedFor: { id: "59aeedd1-c252-407c-8fd0-3773e6de1772"}}"
Is it possible that you use a different branch that does not exist on the triggered build? I think i will make this configurable and not always specify it directly.
Yes, it is possible in some scenarios that we want to enable, but they both have the same branch in the default case (which I am testing).
ok, too bad can you provide me with the log of the build step that fails?
2017-06-27T18:27:24.7411856Z ##[section]Starting: Trigger a new build of E2Sim Rolling Build & Execute Tests (LLVM) 2017-06-27T18:27:24.7422838Z ============================================================================== 2017-06-27T18:27:24.7422838Z Task : Trigger Build 2017-06-27T18:27:24.7422838Z 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. 2017-06-27T18:27:24.7422838Z Version : 1.9.0 2017-06-27T18:27:24.7422838Z Author : Benjamin Huser 2017-06-27T18:27:24.7422838Z Help : 2017-06-27T18:27:24.7422838Z ============================================================================== 2017-06-27T18:27:24.7542523Z Preparing task execution handler. 2017-06-27T18:27:28.3791576Z Executing the powershell script: d:\a_tasks\TriggerBuild_32abcf98-0df6-4711-b2e4-66a405d3c1a6\1.9.0\triggerbuild.ps1 2017-06-27T18:27:28.5629327Z Using Custom Team Project URL 2017-06-27T18:27:28.5649414Z Path to Server: https://tools.visualstudio.com/DefaultCollection/tools 2017-06-27T18:27:28.5659462Z Using Personal Access Token 2017-06-27T18:27:28.5709662Z Build shall be triggered for same user that triggered current build: Stella Stamenova 2017-06-27T18:27:28.5729752Z Build In Queue Condition is not enabled 2017-06-27T18:27:28.5729752Z Dependant Build Condition is not enabled 2017-06-27T18:27:28.5729752Z Dependant on Failed Build Condition is not enabled 2017-06-27T18:27:28.6463073Z Add Rolling Build & Execute Tests (LLVM) to list of Builds to trigger 2017-06-27T18:27:28.7868620Z ##[error]System.Net.WebException: The remote server returned an error: (400) Bad Request. 2017-06-27T18:27:28.7868620Z at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request) 2017-06-27T18:27:28.7878649Z at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord() 2017-06-27T18:27:28.7999370Z ##[error]System.Management.Automation.RuntimeException: Cannot index into a null array. 2017-06-27T18:27:28.7999370Z at CallSite.Target(Closure , CallSite , Object , Int32 ) 2017-06-27T18:27:28.7999370Z at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) 2017-06-27T18:27:28.7999370Z at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame) 2017-06-27T18:27:28.7999370Z at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) 2017-06-27T18:27:28.8029451Z Queue new Build for definition Rolling Build & Execute Tests (LLVM) on https://tools.visualstudio.com/DefaultCollection/tools/_apis/build/builds?api-version=2.0 2017-06-27T18:27:28.8029451Z { definition: { id: }, sourceBranch: "refs/heads/master", requestedFor: { id: "9bc78cd1-9a57-467b-bed0-77e45442f720"}} 2017-06-27T18:27:28.8250126Z ##[error]System.Net.WebException: The remote server returned an error: (400) Bad Request. 2017-06-27T18:27:28.8250126Z at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request) 2017-06-27T18:27:28.8250126Z at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord() 2017-06-27T18:27:28.8330445Z ##[error]System.Net.WebException: The remote server returned an error: (400) Bad Request. 2017-06-27T18:27:28.8330445Z at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request) 2017-06-27T18:27:28.8330445Z at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord() 2017-06-27T18:27:28.8330445Z Queued new Build for Definition Rolling Build & Execute Tests (LLVM) 2017-06-27T18:27:28.9389144Z ##[error]PowerShell script completed with 4 errors. 2017-06-27T18:27:28.9399199Z ##[section]Finishing: Trigger a new build of Rolling Build & Execute Tests (LLVM)
Thanks I will have a look at it in the next few days and try to update you as soon as I found something out
I think I figured it out - it's actually the name of the build. I am not sure yet if it's the parenthesis or the &, but one of the special characters is causing the issue.
We'd still like to be able to queue builds for a different branch than the default. Can that be passed as part of the properties currently?
oh ok, that would make sense I guess. I will look into this then.
Yes I think it should be possible to define it as part of the build parameters in the advanced configuration
I have confirmed that the culprit is the ampersand (&). Parenthesis are ok.
I tried to pass the sourceBranch like so:
Will trigger build with folowing parameters: \"sourceBranch\" : \"testSource\"
Which produced:
{ definition: { id: 81 }, sourceBranch: "refs/heads/master", requestedFor: { id: "9bc78cd1-9a57-467b-bed0-77e45442f720"}, parameters: "{\"sourceBranch\" : \"testSource\"}"}
And the triggered build ran for master. Is that the correct way?
The problem is right now that you still have this "sourceBranch" property that we set automatically that uses the master: { definition: { id: 81 }, sourceBranch: "refs/heads/master", requestedFor: { id: "9bc78cd1-9a57-467b-bed0-77e45442f720"}, parameters: "{"sourceBranch" : "testSource"}"}
I can try to release a new version where this is configurable soon, but right now you cannot override this i think.
Thanks. Should I open a new issue or re-use this one? We'd really like to be able to specify the sourceBranch
Maybe open a new one, then i can use this one to check the "&" issue
Thanks for your help in figuring this out 👍
Hi @shmatkotija I tried to find a way to circumvent your problem with the '&' in the build definition name. I think it is not possible to use it in a build name that we want to trigger, as we need to send a request to the TFS API that contains that name, and the & will be interpreted as another parameter which than causes this "Bad Request". I will add a remark about this in the overview of the task on the Marketplace and I hope it is not a problem for you to change that.
I am trying to use this extension to queue build in a different project and regardless of how I try to specify the path and credentials, I get errors. When I follow the instructions most closely, the error that I get is Bad Request.
For example, specifying:
https://ourname.visualstudio.com/DefaultCollection/ourproject
and use either an OAuthToken or a PAT with all access.