kerwinc / VSTSTasks

7 stars 14 forks source link

Error executing task #7

Open cherici-simone opened 5 years ago

cherici-simone commented 5 years ago

Hello, I'm trying to create a new branch at the end of a yaml build pipeline, but the task raise an error: `##[debug]GET https://dev.azure.com/XXX//YYY/_apis/git/repositories/DevOps/?api-version=5.0 with 0-byte payload

[debug]received 15653-byte response of content type text/html; charset=utf-8

Repository Id: []

[debug]Caught exception from task script.

[debug]Error record:

[debug]D:\a_tasks\branch-maker_b15628f5-ba26-4250-8e69-fb729fbda870\0.1.3\run.ps1 : Cannot validate argument on parameter 'Repository'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

[debug]At line:1 char:1

[debug]+ . 'd:\a_tasks\branch-maker_b15628f5-ba26-4250-8e69-fb729fbda870\0.1. ...

[debug]+ ~~~~~~~~~~~~~~~~~

[debug] + CategoryInfo : InvalidData: (:) [run.ps1], ParameterBindingValidationException

[debug] + FullyQualifiedErrorId : ParameterArgumentValidationError,run.ps1

[debug]

[debug]Script stack trace:

[debug]at , D:\a_tasks\branch-maker_b15628f5-ba26-4250-8e69-fb729fbda870\0.1.3\run.ps1: line 63

[debug]at , : line 1

[debug]at , : line 22

[debug]at , : line 18

[debug]at , : line 1

[debug]Exception:

[debug]System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'Repository'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. ---> System.Management.Automation.ValidationMetadataException: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

[debug] at System.Management.Automation.ValidateNotNullOrEmptyAttribute.Validate(Object arguments, EngineIntrinsics engineIntrinsics)

[debug] at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)

[debug] --- End of inner exception stack trace ---

[debug] at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)

[debug] at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)

[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

[debug] at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

[debug] at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)

[debug] at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)

[debug] at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)

[debug] at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()

[debug] at System.Management.Automation.CommandProcessorBase.Complete()

[error]Cannot validate argument on parameter 'Repository'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

[debug]Processed: ##vso[task.logissue type=error]Cannot validate argument on parameter 'Repository'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

[debug]Processed: ##vso[task.complete result=Failed]

`

Here is the configuration:

- task: branch-maker@0 inputs: repository: '$(Build.Repository.Name)' sourceBranchName: 'master' newBranchName: 'release/$(Build.BuildNumber)' applyBranchPolicy: true MinimumApproverCount: '1' creatorVoteCounts: true checkForLinkedWorkItems: true checkForLinkedWorkItemsType: 'optional' checkForCommentResolution: true enforceMergeStrategy: true enforceMergeStrategyType: 'squashMerge'

kknapp1 commented 5 years ago

was having the same error. fixed by setting Enable the

Allow scripts to access the OAuth token

on the pipeline phase per the instructions said. working fine now.

NorthHighlandNicole commented 4 years ago

Hello, can you please respond with the fix for this? There is no option to "allow scripts to access the OAuth token" in the classic pipelines and the documentation here does not list the inputs for the task. And when using the UI to edit the YAML there is also no option for "allow scripts to access the OAuth token".

Thank you.

Error: ##[error]Cannot validate argument on parameter 'Repository'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.