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!

BuildMaster v2023 PSEVAL



  • Hi Support,
    Given this Otterscript;

    Set-BuildVariable Web
    (
        Value: $PSEval("(Get-Website -Name MyWebSite).PhysicalPath")
    );
    

    This correctly sets the Variable;
    77c52fbb-df32-4463-a640-5d03249c33ef-image.png

    After upgrading to BuildMaster v2023; it seems this is broken with the Variable output being;
    b115c13f-4a93-40e1-b48e-1f570864d57f-image.png

    Also the engine syntax highlighting is not happy with the brackets;

    BuildMaster 7, the text in quotes is picked including the brackets is highlighted in green;
    95b563e3-2a6b-45d6-8a47-75aa5a4f7993-image.png

    Vs BuildMaster 2023, the syntax highlight is not correctly following the brackets within the quotes, i.e. the middle bracket is white..
    9f55d686-883f-4f3f-9709-b7fdd762184c-image.png

    Thanks,
    Paul


  • inedo-engineer

    Hi @paul_6112,

    I'm not able to reproduce this; I tried something similar, a script that looks just like this:

    Set-BuildVariable MyVar
    (
        Value: $PSEval("(Get-TimeZone).Id")
    );
    

    There's a lot of moving parts in the case you gave, so best to use something simpler to try to repro. Like Get-TimeZone. It'd be good if you "play around" and figure out what specifically is causing the behavior.

    Cheers,
    Alana



  • Hi Alana,
    Using IIS was the simplest repro I could come up with for you to easily replicate, sorry..

    I can confirm that something as basic as Get-Date does work;
    $PSEval(Get-Date)

    This is a 'raw' powershell example output;

    40f1daf7-750e-4700-a55c-d56e93214371-image.png

    We did try adding ' | out-string' to force any formatting for PSEval but this didn't make a difference.

    I've tried your example and tried to come up with something else you should have by default (although you will have to change the InterfaceAlias to whatever yours is called..

    Raw PowerShell Output;
    e3ca16bd-4121-41ed-af74-96c0353f9708-image.png

    BuildMaster 2023 Script;
    c130fc6d-3388-4fbd-b980-f1c29277002d-image.png

    Build Output;
    310f8fd5-e254-443e-8dab-0a64a6c8e59a-image.png

    So why does your example want to return a String (?) and my example want to return a List (?)

    Thanks,
    Paul


  • inedo-engineer

    Hi @paul_6112 ,

    That's really peculiar; what must be happening is that PowerShell is returning multiple results, so the variable is automatically being being created as a list:
    https://github.com/Inedo/inedox-scripting/blob/master/Scripting/InedoExtension/Functions/PsEvalVariableFunction.cs#L52

    Digging further, it's like related to some issue with value detection/conversion:
    https://github.com/Inedo/inedox-scripting/blob/master/Scripting/InedoExtension/PowerShell/PSUtil.cs#L205

    Unfortunately it's a bit of rabbit hole from here; it's just as likely a bug in .NET6 powershell libraries as it is our code. But hopefully you can play around and find a work around? I'm at a loss, and we're pretty heads-down in ProGet 2024 planning at the moment, so hard to find the likely half-a-day to explore this further.

    I'll add this to our BuildMaster 2024 roadmap, but if anyone else experiences this (or we get a ticket) we'll investigate it further.

    Cheers,
    Alana


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation