@Dan_Woolf,
Thanks. This will help me a lot.
ashah_4271
@ashah_4271
Best posts made by ashah_4271
Latest posts made by ashah_4271
-
RE: Setting runtime variable from powershell script
-
RE: Setting runtime variable from powershell script
@Dan_Woolf,
that seems to be working..
What does>>
mean? I can define multi-line powershell script within that block and then callPSEval
to run that code block?Thanks a million for your assistance.
-
RE: Setting runtime variable from powershell script
@Dan_Woolf ,
I am now getting the following error:Error: Unhandled exception: System.Management.Automation.IncompleteParseException: Missing closing ')' in expression. at System.Management.Automation.Runspaces.AsyncResult.EndInvoke() at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.Extensions.Scripting.PowerShell.PowerShellScriptRunner.<RunAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.Extensions.Scripting.PowerShell.ExecutePowerShellJob.StandardRunner.<ExecuteAsync>d__25.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.Extensions.Scripting.PowerShell.ExecutePowerShellJob.<ExecuteAsync>d__43.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.Agents.LocalJobExecuter.<ExecuteJobAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.Extensions.Scripting.Functions.PSEvalVariableFunction.Evaluate(IVariableFunctionContext context) at Inedo.BuildMaster.BuildMasterVariableEvaluationContext.<TryEvaluateFunctionAsync>d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.ExecutionEngine.Variables.FunctionTextValue.<EvaluateAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.ExecutionEngine.Variables.ProcessedString.<EvaluateValueAsync>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.ExecutionEngine.Executer.ExecuterThread.<EvaluateExpressionAsync>d__76.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.ExecutionEngine.Executer.ExecuterThread.<ExecuteAsync>d__53.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Inedo.ExecutionEngine.Executer.ExecuterThread.<ExecuteNextAsync>d__37.MoveNext()
For PSEval, I don't see any issue with ')'.
Can you please advice.
Thanks -
RE: Setting runtime variable from powershell script
@Dan_Woolf,
This is what I get:Cannot bind argument to parameter 'Name' because it is null.
Here is my Otter script block looks like
##AH:UseTextMode # Call DELETE on ElasticSearch with retry = 3 { Execute-PowerShell 'set $indexName = $PSEval((Get-Date).AddMonths(-1).ToString("yyyy.MM.*"));' ( Debug: true, Verbose: true ); Get-Http $elasticUrl/$indexName ( Method: DELETE ); }
-
RE: Built-in Variables and global otter script not working
Thanks Nanci for your response.
I exactly don't know how variables are being passed from one step to the other in same block of code to the other. Otter script documentation is not so clear on it.
I have created separate thread fore that. If you can answer that.
Setting Runtime Variable From Powershell Script
Thanks -
Setting runtime variable from powershell script
Re: Setting runtime variable from powershell script
Here is my otter script:
##AH:UseTextMode # Call DELETE on ElasticSearch with retry = 3 { Execute-PowerShell >>$indexName=(Get-Date).AddMonths(-1).ToString("yyyy.MM.*") Write-Host "Index for the last Month is $indexName">> ( Debug: true, Verbose: true ); Get-Http $elasticUrl/$indexName ( Method: DELETE ); }
I created variable called "$indexName" and "$elasticUrl" in my Settings -> variables
As seen in my otter script above, I need to pass $indexName from first step to the ohter.Thanks
-
Built-in Variables and global otter script not working
Hi,
I am trying to create an Automated deployments everyday. For that I have created Automatic trigger to run everyday. For that, we have three choices to either create a new build, execute a custom script and Disabled.
I couldn't pick Create a new build since there are no active releases. For my deployment, I have to create release and build (that is another question on how can I prevent from release from closing after deployment is complete... so that I can use it for Automatic deployments)
For my custom script, I have created global otter script as seen below:General { Create-Release ( Application: $ApplicationName, Pipeline: $PipelineName ); Create-Build ( Application: $ApplicationName ); }
When I use that in my Automatic triggers as custom script, it just doesn't work. Am I using built-in variables correctly?
when I hard-code application name and pipeline, it works.Can you please advice me on that?
Thanks.
-
Setting runtime variable from powershell script
Hi,
I have two two steps otter script plan. They both are in one general block.
First one is a powershell script where I need to set runtime variable
Next step is REST HTTP call where I need to use that runtime variable.
Can someone please tell me how can I do that?I was reading document about variables and it even confuses me more:
https://docs.inedo.com/docs/buildmaster/applications/configuration-variables
https://docs.inedo.com/docs/executionengine/components/runtime-variablesAny of these two pages doesn't mention anywhere how can I set variables dynamically through script.
Thanks