We recently upgraded to 22.214.171.124 of octopus. I did not realize until yesterday that you guys changed the convention on where scripts such as deploy.ps1 have to be deployed to. we used to just set the Copy Always property in our visual studio solution for that file, have it go to the bin directory and octopus still saw it and ran it. now it looks like all convention .ps1 files have to reside at the root of the deploy. not a big deal, so I moved it, but octopus still does not run the deploy.ps1 file. I attached a screenshot to show that the file is indeed in the root of the deploy. This is a Windows Service. the deploy.ps1 was setup a while back to point the windows service to the new deployment directory and recycle the service. I know that octopus now supports this notion directly, but we already had this in place and had not gotten around to changing it yet, so that might still be a possible workaround.
I thought I’d first ask though if there are any known issues with the convention .ps1 files, especially deploy.ps1, and windows service deployments and octopus not running them?
Deploy.ps1 (1 KB)
No, I don’t believe there are any outstanding issues around this. If you can send the relevant parts of your raw deployment log (http://docs.octopusdeploy.com/display/OD/Get+the+raw+output+from+a+task) that might offer some pointers.
Note the scripts need to be packed into the root of the .nupkg file; OctoPack 3.0 makes some changes that might help you get the right package format if you’re having any trouble.
I have attached both the raw log of the deployment and the nuspec file I have setup for the windows service. the recent line I added was at the bottom of the nuspec for the deploy.ps1 file. I assumed it should go into the “content” folder with the rest of the files, but if not, let me know.
octopus20801.log (23 KB)
MailQueueProcessor.nuspec (843 Bytes)
Thanks for the update. The NuSpec file has this line:
<file src="deploy.ps1" target="content" />
You’ll need to set
target="" to make sure the deploy.ps1 file is at the root of the NuGet package - right now it is being copied to a “content” subfolder. Hope that helps!
Thanks! yep that fixed the issue.
We have a set of deployment scripts which get generated and tested independently from the service code in order to pre-validate any changes in an effort to avoid blocking development due to framework changes. These are placed in a separate sub-folder of the package root in order to keep the deployment framework clearly segregated from the deployed code.
Is there any way of circumventing this new restriction ? I can only think of using the nuspec file to copy the deploy files to the root level and then deleting them after the deployment, but experience thought me that tends to be unreliable at best and would also break our idempotency & rollback mechanisms.
If you visit this page:
There is a section called “Scripts in package steps”. You can use this feature to define a Deploy.ps1 file in the Octopus web UI. You could us this to invoke your embedded PowerShell script in the sub folder like this:
Hope this helps!