Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaping environment variables with spaces? #164

Closed
rcoup opened this issue Aug 16, 2018 · 2 comments · Fixed by #165
Closed

Escaping environment variables with spaces? #164

rcoup opened this issue Aug 16, 2018 · 2 comments · Fixed by #165

Comments

@rcoup
Copy link

rcoup commented Aug 16, 2018

Trying to populate an environment variable for a test-runner

  - label: 'Action'
    plugins:
      docker-compose#v2.5.1:
        run: app
        environment:
          - "PROPERTIES=Buildkite: ${BUILDKITE_PIPELINE_SLUG}:${BUILDKITE_BUILD_NUMBER} ${BUILDKITE_BRANCH} ${BUILDKITE_COMMIT}"

But I end up with:

$ docker-compose ... run --name buildkite...e6c_mypipeline_build_123 -e PROPERTIES=Buildkite: mypipeline:123 mybranch abcdef12345abcdef12345 app

ERROR: No such service: mypipeline:123

(ie. the variable gets expanded on the command line without escaping it)

I've also tried:

- 'PROPERTIES="Buildkite: ${BUILDKITE_PIPELINE_SLUG}:${BUILDKITE_BUILD_NUMBER} ${BUILDKITE_BRANCH} ${BUILDKITE_COMMIT}"'
- "PROPERTIES='Buildkite: ${BUILDKITE_PIPELINE_SLUG}:${BUILDKITE_BUILD_NUMBER} ${BUILDKITE_BRANCH} ${BUILDKITE_COMMIT}'"
- 'PROPERTIES=Buildkite:\ ${BUILDKITE_PIPELINE_SLUG}:${BUILDKITE_BUILD_NUMBER}\ ${BUILDKITE_BRANCH}\ ${BUILDKITE_COMMIT}'

with the same results

@lox
Copy link
Contributor

lox commented Aug 17, 2018

Sorry about that @rcoup! Looks like a bug with how we escape env. We will investigate.

@lox
Copy link
Contributor

lox commented Aug 17, 2018

I've added a test in #165 and fixed the issue with a fairly major change to how we tokenize BUILDKITE_COMMAND. We will do some testing and get a release out soon!

@lox lox closed this as completed in #165 Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants