PowerShell - CustomScriptConvention still runs when un-configured

Been using 2.2 since pre-release date and enjoying a lot of the new features.

I started moving all stand alone PowerShell scripts into the new custom PowerShell scripts feature, once I had them separated nicely for each deployment package I then wanted to move them into .ps1 files included in the NuGet packages. So I switched the custom PowerShell scripts feature off and added the PreDeploy.ps1 and PostDeploy.ps1 file to the project, but it looks like both custom PowerShell scripts feature and the .ps1 files included in the NuGet package are being executed : -

@@@
| Failed: Step 1: Deploy App
13:08:23 Info | Executing step: Deploy App
13:08:38 Fatal | The step failed
|
| Failed: Magic file server
13:08:23 Verbose | Starting Running step “Deploy App” on "file server"
13:08:23 Info | Running “Deploy App” on "file server"
13:08:38 Verbose | Guided Failure is not in use for this deployment; failing.
|
| Failed: Deploy App on file server
13:08:23 Info | Beginning deployment…
13:08:23 Verbose | Begin deployment of package: App.3.9.3678.53
| Package file path: E:\Octopus\Applications.Tentacle\Packages\App.3.9.3678.53_A29187E3E289E94483C22F58421DCF63.nupkg
| Package file hash: d3f3152a2038ebf37fe91b0b91d55c7c13732d95
| Tentacle Agent information:
| - Machine name: BOX30316
| - Is 64-bit: True
| - Service user name: SYSTEM
| - CLR version: 4.0.30319.18052
| - Current directory: C:\Windows\system32
| - OS version: Microsoft Windows NT 6.1.7601 Service Pack 1
| - Tentacle version: 2.2.1.1261
13:08:23 Verbose | Package will be extracted to: E:\Octopus\Applications\SystemTest3
13:08:34 Error | Error running conventions; running rollback conventions…
13:08:34 Verbose | Storing a record of the deployment.
13:08:34 Verbose | Failed receiving Octopus.Tentacle.Orchestration.Deploy.Mutex.AcquiredEvent
| A convention could not be successfully applied.
| Octopus.Platform.Deployment.ControlledFailureException: A convention could not be successfully applied. —> Octopus.Tentacle.Deployment.Integration.Scripting.ScriptFailureException: Script ‘E:\App\CustomScriptConvention.PostDeploy.ps1’ returned non-zero exit code: 1. Deployment terminated.
| at Octopus.Tentacle.Deployment.Conventions.Implementations.ScriptConvention.<>c__DisplayClass1.b__0(IConventionContext cc) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\Implementations\ScriptConvention.cs:line 66
| at Octopus.Tentacle.Deployment.Conventions.ConventionContextExtensions.RunChildOperation(IConventionContext context, String friendlyName, Action1 operation) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionContextExtensions.cs:line 15 | --- End of inner exception stack trace --- | at Octopus.Tentacle.Deployment.Conventions.ConventionContextExtensions.RunChildOperation(IConventionContext context, String friendlyName, Action1 operation) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionContextExtensions.cs:line 28
| at Octopus.Tentacle.Deployment.Conventions.Implementations.ScriptConvention.RunScripts(IEnumerable1 scriptFiles, IConventionContext context) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\Implementations\ScriptConvention.cs:line 36 | at Octopus.Tentacle.Deployment.Conventions.Implementations.PostDeployScriptConvention.Install(IConventionContext context) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\Implementations\PostDeployScriptConvention.cs:line 15 | at Octopus.Tentacle.Deployment.Conventions.ConventionProcessor.<RunInstallConventions>b__0(IInstallationConvention c, IConventionContext ctx) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionProcessor.cs:line 60 | at Octopus.Tentacle.Deployment.Conventions.ConventionProcessor.Run[TConvention](IConventionContext context, Action2 conventionCallback) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionProcessor.cs:line 84
| at Octopus.Tentacle.Deployment.Conventions.ConventionProcessor.RunConventions(IConventionContext context) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionProcessor.cs:line 51
| at Octopus.Tentacle.Deployment.DeploymentController.Execute(StoredPackage package, VariableDictionary variables, ILog log, Action`1 storeCreatedArtifact) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 55
| at Octopus.Tentacle.Orchestration.Deploy.Package.TentaclePackageDeployment.Receive(AcquiredEvent message) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Orchestration\Deploy\Package\TentaclePackageDeployment.cs:line 96
| at Pipefish.Actor.OnReceivingTyped[TBody](Message message) in c:\TeamCity\buildAgent\work\cf0b1f41263b24b9\source\Pipefish\Actor.cs:line 113
13:08:34 Fatal | A convention could not be successfully applied.
|
| Success: PreDeploy.ps1
13:08:25 Verbose | Script: E:\Octopus\Applications\SystemTest3\App\3.9.3678.53\PreDeploy.ps1
13:08:26 Info | Disconnected all open connections to HXC30316
|
| Success: CustomScriptConvention.PreDeploy.ps1
13:08:26 Verbose | Script: E:\Octopus\Applications\SystemTest3\App\3.9.3678.53\CustomScriptConvention.PreDeploy.ps1
13:08:27 Info | Disconnected all open connections to HXC30316
|
| Success: Copy files to E:\App
13:08:27 Info | Purging the directory 'E:\App’
13:08:27 Info | Copying package contents to ‘E:\App’
|
| Success: PostDeploy.ps1
13:08:31 Verbose | Script: E:\App\PostDeploy.ps1
13:08:32 Info | Required variables : -
13:08:32 Info | $OctopusEnvironmentName = SystemTest3
13:08:32 Info | $_installPath = E:\App
13:08:32 Info | $_filesToExclude = Easycom.ini App*.ini SystemTest3.security SystemTest3.ini
13:08:32 Info | $_filesToInclude = *.ini *.security handle.exe *.ps1
13:08:32 Info | Removed all configuration files except ones required by SystemTest3
|
| Failed: CustomScriptConvention.PostDeploy.ps1
13:08:32 Verbose | Script: E:\App\CustomScriptConvention.PostDeploy.ps1
13:08:33 Error | The term ‘E:\App\CustomScriptConvention.PostDeploy.ps1’ is not rec
13:08:34 Error | ognized as the name of a cmdlet, function, script file, or operable program. Ch
13:08:34 Error | eck the spelling of the name, or if a path was included, verify that the path i
13:08:34 Error | s correct and try again.
13:08:34 Error | At E:\App\Bootstrap.b2d439e4-781b-4273-a711-8360df535935.ps1:2282
13:08:34 Error | char:2
13:08:34 Error | + . <<<< "E:\App\CustomScriptConvention.PostDeploy.ps1"
13:08:34 Error | + CategoryInfo : ObjectNotFound: (E:\Magic\Hiscox…PostDeploy.p
13:08:34 Error | s1:String) [], ParentContainsErrorRecordException
13:08:34 Error | + FullyQualifiedErrorId : CommandNotFoundException
13:08:34 Fatal | Script ‘E:\App\CustomScriptConvention.PostDeploy.ps1’ returned non-zero exit code: 1. Deployment terminated.
@@@

Ok so it turns out that the CustomScriptConvention still runs if the PowerShell script is not deleted from the custom PowerShell scripts windows even though the feature is un-ticked (shown in attached image).

Ticking the feature back on and then deleting the PowerShell script from the custom PowerShell script feature windows and then un-ticking the feature stopped the CustomScriptConvention from running.

I guess this needs to be raised as a bug?

Cheers

Steve

Octopus2.2.png

Thanks for the bug report! We’ll fix this in next week’s release:

Paul