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!

    Powershell array parameter with default value blocks subsequent parameters

    Scheduled Pinned Locked Moved Support
    2 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.
    • D Offline
      dwynn_6489
      last edited by

      In the powershell code shown below, the value for param3 is not received from the plan when the release is executed. Is this a powershell limitation, or something to do with how BuildMaster is parsing the script? If I remove $arr_param, param3 is properly handled.

      When the plan is viewed in visual mode, param3 doesn't show up when I edit the test_PS_script Operation. Including a value for arr_param in the plan doesn't change the behavior (although the script does receive the passed in value for arr_param).

      SCRIPTASSET - test_PS_script

      Param (
      $param1,
      $param2,
      $arr_param = @(),
      $param3
      )

      Write-Output "param1: ${param1}"
      Write-Output "param2: ${param2}"
      Write-Output "arr_param.Count: $($arr_param.count)"
      Write-Output "param3: ${param3}"

      PLAN

      PSCall test_PS_script
      (
          param1: val1,
          param2: val2,
          param3: val3
      );
      

      OUTPUT

      Found script test_PS_script.ps1 in Default raft.
      Using LocalAgent agent on TESTSERVER01
      Importing param3...
      Assigning parameter param1...
      Assigning parameter param2...
      param1: val1
      param2: val2
      arr_param.Count: 0
      param3:

      1 Reply Last reply Reply Quote 0
      • jjonesJ Offline
        jjones inedo-engineer
        last edited by

        After looking into this issue further we have determined that sequentially ordering the parameters will resolve the issue.

        Thanks,
        Jason

        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