Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
V5 has 'Invalid variable name' error for an application build
-
I was running v4.9.7, with builds already converted to OtterScript format. I upgraded to v5.0.3, and also upgraded the few extensions that I was using, such as TFS.
The builds seemed to be in "legacy" mode again, so I re-converted them to OtterScript.
However, the builds are failing with an "Invalid variable name" error. I also tried reducing one build to only get the latest files from TFS source control (with a TFS [or SCM] triggered build), with no other steps in the build. This build is still getting the same error.
I can't find anywhere any hints about which variable is missing or invalid.
The error details are:
ERROR: Unhandled exception: System.FormatException: Invalid variable name.
at Inedo.ExecutionEngine.RuntimeVariableName.Parse(String s)
at Inedo.ExecutionEngine.Variables.TextProcessor.ReadVariableOrFunction(Boolean onlyScalar)
at Inedo.ExecutionEngine.Variables.TextProcessor.ReadNext()
at Inedo.ExecutionEngine.Variables.ProcessedString.Load(TextReader reader)
at Inedo.BuildMaster.PlanExecuter.ScriptPropertyMapper.SetPropertyValue(Object target, IVariableEvaluationContext variableContext, String propertyValue, PropertyInfo property)
at Inedo.BuildMaster.PlanExecuter.ScriptPropertyMapper.SetProperties(Object target, ActionStatement action, IVariableEvaluationContext variableContext)
at Inedo.BuildMaster.Windows.ServiceApplication.Executions.PlanExecuter.DeploymentPlanExecuter.<Inedo-ExecutionEngine-Executer-IExecutionHostEnvironment-ExecuteActionAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---Product: BuildMaster
Version: 5.0.3
-
"Invalid Variable Name" means that the variable was never declared, nor can be found externally. For example, an OtterScript with just...
Log-Information $aswlfnk43;
...w ill throw that message. Whereas...
set $aswlfnk43 = something;
Log-Information $aswlfnk43;.... will not. We will improve the error message for the next beta and identify the variable that's used.
-
I don't believe I have any variables that I am referencing or attempting to use.
The entire plan that I am using now for testing is as follows (with some anonymization):
Get-Latest-Source ( From: "$/TFS-Project/application-folder", To: C:\inetpub\wwwroot\test, Provider: TFS-provider-name ); Send-Email ( To: philipd@example.com, Subject: Test Build email, Text: Testing );
The build is triggered by a "release package" trigger, using an SCM trigger to monitor a TFS (2015) project. The trigger does seem to detect a check-in and start the build, but the invalid variable error happens almost immediately.
Thanks.
-
I would try escaping the $/TFS with the grave apostrophe.
Get-Latest-Source ( From: `$/TFS-Project/application-folder, To: C:\inetpub\wwwroot\test, Provider: TFS-provider-name );
-
OK. I tried that, and I'm no longer getting the variable error.
Now I'm getting an error:
[...] Use a "for server ..." block to set the server context.I think I can work on resolving that. If I still encounter errors, I will post another reply later.
-
Yes you will need to target a server at the pipeline level (in which case it will run the plan against that server or servers), or use an explicit server context block such as:
for server MYSERVRNAM { ... }
-
Those 2 steps are working now. I can work on adding back the other steps in the plan/pipeline.
Thanks for your help.