Skip to content

--shell does not work for global agent hooks #3657

@markmssd

Description

@markmssd

I've been reading through the docs, and trying to set the agent shell option, hoping it would also run the agent global hooks.

What I'm trying is to use PowerShell v7. I've tried

  • using the cli argument --shell
  • adding shell=... to the agent config file
  • setting the environment variable BUILDKITE_SHELL

I've tried setting the value to many things:

  • C:\Program Files\PowerShell\7\pwsh.exe
  • pwsh
  • pwsh -Command

I've also tried to call pwsh from within the hook, for example:

$scriptBlock = @{
  # the actual script 
}

pwsh ${scriptBlock}

This worked for the environment.ps1 hook, but not in the others, not sure why 🤔

However the agent hooks always execute with PowerShell v5 instead. I'd prefer v7 since it's cross-platform, and would make it much easier to maintain the hooks (only need to be written once).

Is there a way to achieve this? Happy to contribute to a PR if needed. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions