PSDeploy icon indicating copy to clipboard operation
PSDeploy copied to clipboard

DependingOn not working as expected (ordering wrong)

Open csandfeld opened this issue 8 years ago • 5 comments

Using DependingOn results in a deployment order that is completely different from what I expected.

Consider the following psdeploy.ps1 file:

Deploy A {

    By Task Setup {
        FromSource {
            'Setup'
        }
    }

    By Task One {
        FromSource {
            'One'
        }
        DependingOn Setup
    }

    By Task Three {
        FromSource {
            'Three'
        }
        DependingOn Two
    }

    By Task Five {
        FromSource {
            'Five'
        }
        DependingOn Four
    }

    By Task Four {
        FromSource {
            'Four'
        }
        DependingOn Three
    }

    By Task Two {
        FromSource {
            'Two'
        }
        DependingOn One
    }

    By Task Teardown {
        FromSource {
            'Teardown'
        }
        DependingOn One, Two, Three, Four, Five
    }

}

I would expect the order of execution to be:

  • Setup
  • One
  • Two
  • Three
  • Four
  • Five
  • Teardown

But what I get is:

C:\test> Get-PSDeployment -Path .\test.dependencies.psdeploy.ps1 | Select DeploymentName

DeploymentName
--------------
A-Five
A-One
A-Three
A-Two
A-Four
A-Teardown
A-Setup
C:\test> Invoke-PSDeploy -Path .\test.dependencies.psdeploy.ps1 -Force
Five
One
Three
Two
Four
Teardown
Setup

Version used:

C:\test> Get-Module PSDeploy

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.2.1      PSDeploy                            {By, DependingOn, Deploy, FromSource...}

csandfeld avatar Sep 27 '17 12:09 csandfeld

Hiyo!

So it looks like we namespace the dependency name - try using A-One, A-Two and so forth as the items you are depending on.

I don't recall the specifics, but I think it was to avoid collisions. I might need to update docs, there's some info here, but at a quick glance didn't see in module docs.

Also, in that example... not sure why B wasn't namespaced. Will have to look at the code, might take a few days

Let me know how it turns out with the namespaced DependingOn bits!

Cheers!

RamblingCookieMonster avatar Sep 27 '17 13:09 RamblingCookieMonster

Yup - using namespaced names works - thank you for your speedy reply

csandfeld avatar Sep 27 '17 15:09 csandfeld

On another note ... is there a way to setup a task, to only run if specific tasks are used? In other words, if Invoke-PSDeploy is invoked without specifying the tag, the task does not run.

csandfeld avatar Sep 27 '17 15:09 csandfeld

Hi! Completely missed the follow-up, sorry about that!

Can you give a quick pseudocode example that you might expect to use if this was in place? Just the ability to use tags for Task deployment types? Just flipped through the code, and I explicitly avoided this for some reason - if you have any ideas on how to implement it, seems like it would handy!

RamblingCookieMonster avatar Jan 18 '18 02:01 RamblingCookieMonster

No worries, and sorry for the late reply. Racking my brain to try and remember what that was all about, but comming up short.

csandfeld avatar Feb 07 '18 10:02 csandfeld