Dynamic Azure Deployment Targets Must be Created Before Package Acquisition

We are currently using OctopusDeploy v2019.8.9. In the documentation for using the built-in “Deploy an Azure Web App” it indicates that the first step that should happen is “Download the package from the package repository.”

However, if we add any steps to our deployment process that require a package before the “Create x Deployment Target” steps (which are currently using inline Powershell), the Deploy an Azure Web App steps fail due to ‘No package has been staged’.

It works fine, however, if the deployment targets are created before package acquisition.

Is this by design or a bug? I’ve only really found one related article online so far and it seems like it indicates that this was resolved in v2018.8.4 and we are on v2018.8.9.

Edit: the reason this came up for us is because we are trying to migrate our inline-Powershell scripts into packages so that we can better source control them. However, moving the Create Deployment Target inline Powershell to a script file in a package will cause package acquisition to occur first, causing our issue. This is also limiting our ability to move steps that must happen at the beginning into packages.

Hi Rob,

Thanks for getting in touch! After talking it through with some of my team, this sounds like Octopus is doing the wrong thing. My expectation would be, when you add some new deployment targets, Octopus should “inject” a package acquisition step to make sure the release can be deployed to those new targets successfully.

I haven’t been able to reproduce the behaviour you are seeing yet, but instead of making you wait, I wanted to reply with some next steps you can try in the meantime.

Try adding a Health Check Step after the targets are added.

We think this will force the package acquisition logic to run again, and recognise the new targets have been added, and stage the packages as required.

If this workaround is successful, you can keep moving toward your end goal.

In the meantime I will try to get a solid reproduction of the behaviour so we can investigate further.

Hope that helps!
Mike

Thanks for the response. We will give adding Health Check Step a shot and cross our fingers.

Great, let me know how you go. If it’s a bug we’ll want to fix it.

Adding Health Check step has resolved the issue. Thanks again for the help!

Hopefully the documentation is updated at some point so others don’t run into similar roadblocks.

Hi Rob, it turns out I missed this bug we fixed which sounds like it lines up exactly with what you are seeing. https://github.com/OctopusDeploy/Issues/issues/4731

Can you try upgarding and see if you can remove that Health Check step workaround and the deployments continue to work?

Thanks to @benpearce for the tip.

Thanks!
Mike

Hi Mike, I updated to latest Fast Lane (2019.4.4) and tried deploying one of our Azure Web App projects, skipping the Health Check step after creating the deployment target. It failed with the same error:

The step failed: Activity Deploy Website on <redacted> failed with error 'No package has been staged'.

Hi Rob,

I feel terrible - I lost track of our conversation and didn’t realise you are still having this problem.

Thankfully you were able to work around it. I’m not quite sure where to go next since we covered the scenario we were aware of in our bug fix.

Mike