PostDeploy running twice

Hey guys,

So - continuing to work on fixing the multiple IIS bindings as I migrate from 1.6.x to 2.x and I have seen that my PostDeploy.ps1 is actually being run twice (see attached).

Hi - that’s a bit of a scary bug report :slight_smile:

Is it possible that there are multiple PostDeploy.ps1 scripts in different locations in the package, or under the installation folder? Octopus will search recursively and find all of them.

If this doesn’t help - can you please check the Verbose or Raw task output? The filenames will be listed:

                    |         Success: PostDeploy.ps1
08:39:49   Verbose  |           Script: C:\OctopusTest\TentacleA\Apps\Test Environment 2\Acme.Web\3.2.4\PostDeploy.ps1

Hopefully this offers a clue… If not, can you please let me know the 2.x version you’re using?

Cheers,
Nick

So, looks like the PostDeploy.ps1 was in the package twice:

  • C:\Octopus\Applications\Production\TestODApp.Web\1.0.5133.23016\PostDeploy.ps
  • C:\Octopus\Applications\Production\TestODApp.Web\1.0.5133.23016\bin\PostDeploy.ps1

So, that would be OctoPack doing that … right?

Hi,

It looks like your PostDeploy.ps1 file is both marked as both “Content” and has “Copy to output directory” set. This means it gets embedded at the package root (because it is content) and in bin (because of the copy to output directory setting). For a web application you should disable the copy to output directory setting.

I’ll make a note to have Octopack raise a warning when a *Deploy.ps1 file appears twice. Thanks for reporting.

Paul

Ah! Thanks Paul.

Actually, it looks like the PostDeploy.ps1 is not marked as copy to output. Hmm. The nuget package only contains Deploy.ps1 and PostDeploy.ps1 in the expected spots as well (see attached).

postDeploy.jpg

Hi Kori,

Could you attach the raw deployment log?

Paul

Oops - actually, you were right. I was looking at two different projects. The sample app TestODWeb DID have it marked for output as well as being content.