Workflow script doesn't see functions (paralalism in deploymentscripts)

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Daniel Krebs Daniel Krebs 2 years, 2 months ago.

  • Author
    Posts
  • #19435
    Profile photo of Kasper Brandenburg
    Kasper Brandenburg
    Participant

    hi guys,

    i'm trying to bring down my deployment time on a production website. Its a bunch of scheduled tasks, Windows services and websites.
    Today i deploy this in a sequential order, which is starting to take to long to complete.
    Many of the Windows services can just be deployed, in no specific order. Its always just a (Stop service, overwrite files, Start Service).

    I've been looking a multiple options to do this in parallel from powershell. Start-Job looks nice, but workflow is more interesting as i get to keep all my console output in the same context.

    There is however a problem. The workflow functions, doesn't always recongnize my user-defined powershell functions.
    I see errors like:

    "Microsoft.PowerShell.Utility\Write-Error : The term 'Deploy-Website' is not recognized as the name...."

    I'm new with Workflow, but consider myself a decent powershell user. What the h**** am i doing wrong?
    Attached is a empty "deployment package" with a very raw attampt to use workflow to deploy groups of services.
    The example code has this problem.

  • #19442
    Profile photo of Daniel Krebs
    Daniel Krebs
    Participant

    Hi Kasper,

    I'm not an expert on PowerShell workflow but I think you'll need to replace "sequence" with "inlinescript" to use your custom functions.

    sequence 
    {
      Deploy-Ressource -Ressource $Ressource        
    }
    

    http://technet.microsoft.com/en-us/library/jj574197.aspx

    inlinescript
    {
      Deploy-Ressource -Ressource $Using:Ressource        
    }
    

    Best,
    Daniel

You must be logged in to reply to this topic.