Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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

    Scheduled Pinned Locked Moved Support
    tfsbuildmaster
    7 Posts 2 Posters 18 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      pdickers_0718
      last edited by

      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

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        "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.

        1 Reply Last reply Reply Quote 0
        • P Offline
          pdickers_0718
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            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
            );
            
            1 Reply Last reply Reply Quote 0
            • P Offline
              pdickers_0718
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                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
                {
                    ...
                }
                
                1 Reply Last reply Reply Quote 0
                • P Offline
                  pdickers_0718
                  last edited by

                  Those 2 steps are working now. I can work on adding back the other steps in the plan/pipeline.

                  Thanks for your help.

                  1 Reply Last reply Reply Quote 0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • 1 / 1
                  • First post
                    Last post
                  Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation