Skip to content

Buildkite Integration: zsh shell parameter expansion evaluation #53

@tomowatt

Description

@tomowatt

The following line results in the expansion of ${env_vars[@]}

ssh -A -o ServerAliveInterval=60 -o ServerAliveCountMax=60 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$ORKA_VM_USER@$vm_ip" -p "$vm_ssh_port" env ${env_vars[@]} /bin/bash -s < "${currentDir}/run.sh"

But if there are any special characters in the environment variables, this will result in the evaluation of environment variables which can result in the following error, rather than treating them as strings:

zsh:1: parse error near `)'
zsh:1: parse error in command substitution

Unfortuantely due to this script running before users Steps, there is no way for the environment variables from BUILDKITE_ENV_FILE to be sanitized before usage.

env_vars=$(<"$BUILDKITE_ENV_FILE")

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