OctopusDeploy / OctoTFS

| Public | Octopus extensions for Azure DevOps, TFS, VSTS, and VSO
https://marketplace.visualstudio.com/items?itemName=octopusdeploy.octopus-deploy-build-release-tasks
Other
0 stars 41 forks source link

Task.json needs powershell demand #64

Closed luke-barnett closed 8 years ago

luke-barnett commented 8 years ago

Each of the tasks need to demand powershell. This is imporntant for agent pools that have a mix between MS build agents and cross platform build agents.

Example here: https://github.com/Microsoft/vsts-tasks/blob/master/Tasks/Npm/task.json#L14

luke-barnett commented 8 years ago

Current workaround is to add a demand of "PowerShell" to builds that might otherwise be picked up by other agents.

Damovisa commented 8 years ago

@luke-barnett Is this necessary? Many other tasks that require powershell seem to have no demands. For example the IIS Web App deployment task

luke-barnett commented 8 years ago

@Damovisa It's bad practice not to. Unless you're going to provide a node alternative it needs to be explicit so that you don't have it trying to be run on agents that can support the task.

For the most part, a lot of users will be running a VS Build task or something else that has it's demands set that means the agent chosen has PowerShell anyway but it really should ensure that PowerShell is available. In my example I was packaging a nodejs package to push out to Azure, I had to put a demand into the build explicitly so it wouldn't be run by our OSX build agents (which don't have PowerShell... yet)

FYI that deployment task you referenced is deprecated

Damovisa commented 8 years ago

Hi @luke-barnett,

I don't think that's correct - and I don't think we could if we wanted to.

If you look at the capabilities of the hosted agent, PowerShell isn't among them. If we added that as a demand, it wouldn't run on the hosted agent (it's a similar story for on-prem agents).

image

I'm unable to find a task in the vsts-tasks repo that demands powershell either - even the ones that require it - e.g. the NuGet Packager or Service Fabric Deploy.

Damovisa commented 8 years ago

@luke-barnett

To clarify - I understand the issue, but a PowerShell demand probably isn't the right one. I suspect adding a demand for DotNetFramework might be the way to go seeing as we depend on octo.exe. I'll check it out.

Thanks, Damian

luke-barnett commented 8 years ago

@Damovisa +1

Interestingly NuGet Packager requires Cmd which would solve the problem. Interesting that the hosted agent doesn't have PowerShell, I assume that AzurePS is a cut down version as PowerShell is too powerful for the shared environment?

Damovisa commented 8 years ago

@luke-barnett

Even the NuGet Packager step would need Powershell to run though - the only execute option is a ps1 script.

The hosted agent definitely works with the Octopus tasks - so it's not that it doesn't have PowerShell, it's that it's not listed as a capability. I wonder if PowerShell is just an assumed capability?

I'll add the .NET Framework as a demand and see if that helps 😄