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!

    PSCall does not work for script created at application level

    Scheduled Pinned Locked Moved Support
    8 Posts 2 Posters 17 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
      paul_6112
      last edited by paul_6112

      Hi,
      When trying to add a PowerShell Script Asset defined at the application level to a BuildMaster OtterScript(Plan)

      PSCall PSDemo
          (
              YourName: Paul
          );
      

      I'm getting an error :
      "PSDemo.ps1" is not a valid Script identifier for the "global" scope.
      The Visual Mode Designer will also not allow drag and drop of the script.

      The same script defined at the Global Level works

      PSCall global::PSDemo1
          (
              YourName: Paul
          );
      

      BuildMaster 7.0.3 (Build 1)

      Full Stack Trace Message
      An error occurred in the web application: "PSDemo.ps1" is not a valid Script identifier for the "global" scope.

      Full Stack Trace Details
      URL: http://server:8622/0x44/BuildMaster.WebApplication/Inedo.BuildMaster.WebApplication.Pages.Plans.Editor.PlanEditorPage/RebuildStatement
      Referrer: http://server:8622/plans/edit?planId=Default::Test::DeploymentPlan::Deploy
      User: Admin
      User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36 Edg/91.0.864.59
      Stack trace: at Inedo.BuildMaster.Rafts.RaftItemId.Parse(RaftItemType itemType, ApplicationId applicationId, String appRelativeId)
      at Inedo.BuildMaster.BuildMasterSdkConfig.Config.GetRaftItem(RaftItemType type, String itemId, Object context)
      at Inedo.Extensions.Scripting.PowerShell.PowerShellScriptInfo.TryLoad(LooselyQualifiedName scriptName)
      at Inedo.Extensions.Scripting.Operations.PowerShell.PSCallOperation.GetDescription(IOperationConfiguration config)
      at Inedo.Extensibility.Operations.Operation.GetDescription(Type operationType, ActionStatement statement)
      at Inedo.BuildMaster.PlanEditor.TsStatement.FromDynamicStatement(ActionStatement statement)
      at Inedo.BuildMaster.PlanEditor.TsStatement.FromStatement(Statement statement)

      Thanks,
      Paul

      1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer
        last edited by

        Hi @paul-reeves_6112 ,

        I was able to track down this error; it's a regression introduced into v7, and only impacts the OtterScript editor.

        If you upgrade the Scripting extension (Admin > Extensions) to 1.10.4 then it should work :)

        Cheers,
        Alana

        P 1 Reply Last reply Reply Quote 0
        • P Offline
          paul_6112 @atripp
          last edited by paul_6112

          @atripp Hi Alana,
          I've installed that updated Extension and I now get a message "An unexpected error occurred while posting to the server"
          "Internal Server ErrorYou should try to save your work if possible."
          If I try and drag the Local Application Script in the GUI.

          I manually downloaded the extension and copied onto the server and restarted both BuildMaster and the Web services.

          Thanks,
          Paul

          atrippA 1 Reply Last reply Reply Quote 0
          • atrippA Offline
            atripp inedo-engineer @paul_6112
            last edited by

            @paul-reeves_6112 I'm thinking I didn't fix the regression after all 😓

            Can you go to Admin > Diagnostic Center and share the stack trace that resulted from the message? It should be logged in the case of an editor crash like that. I suspect it's related, but I only used a very simple/quick script test.

            P 1 Reply Last reply Reply Quote 0
            • P Offline
              paul_6112 @atripp
              last edited by

              @atripp Hi Alana,
              On Extension 1.10.3 the stack trace on my original post was from the Diagnostic Centre.

              On 1.10.4 its just an error that is displayed on the GUI; it doesn't log the message into the Diagnostic Center.
              So you have 'fixed' something :-)

              This is the error when just dragging a PowerShell script defined in the Application.
              pstest.png

              Dragging the PSCall global::PSDemo1 works perfectly as this is defined in the Global Script respository.

              I've tried simple scripts with and without parameters...
              These are my two test Powershell Scripts which are cut down from your Otter demo..

              <#
              .SYNOPSIS
              Demo Script
              
              .PARAMETER YourName
              When specified
              #>
              
              param([string]$YourName)
              
              if ($YourName){
                  Write-Output @"
                  Hello $YourName
              "@
              } else {
                  Write-Output @"
                  Hello from PowerShell !
              "@
              }
              
              <#
              .SYNOPSIS
              Demo Script
              
              #>
                  Write-Output @"
                  Hello from PowerShell !
              "@
              

              One further thing I have noticed, if I edit my Otterscript in Text Mode, I can add the local application powershell by prefixing the application name i.e.

              # General
              {
                  PSCall Test::PSPaul1
                  (
                      YourName: Paul
                  );
              }
              

              Therefore the issue seems to be the GUI is okay with either

              PSCall Global::PSPaul1
              

              or

              PSCall Application::PSPaul1
              

              But doesn't like the short name

              PSCall PSPaul1
              

              Which from my screenshot you can see if how the local Application Scripts are defined.

              I've also tried creating a new test script under v1.10.4 in case this wasn't saving something properly, but this is also broken.

              Hope this helps,
              Thanks,
              Paul

              1 Reply Last reply Reply Quote 0
              • atrippA Offline
                atripp inedo-engineer
                last edited by

                Hi @paul-reeves_6112 ,

                Thanks for all the detailed information; it was a bit of a rush due to US holiday yesterday, and I didn't look so carefully. That patch to Scripting (1.10.4) seems to fix text mode, but the editor is clearly still broken unless you prepend the application name (which you figured out).

                The application name should not be required like this, and I've logged a product change to fix this (BM-3707 and SDK-74). This will get fixed in the next maintenance release of BuildMaster, which is scheduled for Friday.

                We may ship it sooner, because this regression is quite annoying.

                Cheers,
                Alana

                1 Reply Last reply Reply Quote 0
                • atrippA Offline
                  atripp inedo-engineer
                  last edited by

                  Hi @paul-reeves_6112 ,

                  I ended up fixing this in the extension after all - can you try 1.10.5?

                  8b65d202-aa2e-493c-a54e-c52c23799853-image.png

                  We will still want to make the SDK change, but it was more involved than I thought. So the team wants to wait to do that later... especially since we could quickly fix it in the extension.

                  Cheers,
                  Alana

                  P 1 Reply Last reply Reply Quote 0
                  • P Offline
                    paul_6112 @atripp
                    last edited by

                    @atripp Hi Alana,
                    Sorry for the delay; I had not checked in as I was watching for the v7.0.5 release..
                    Extension v1.10.5 looks good to me in solving this problem; thank you.

                    Regards,
                    Paul

                    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