Giter Club home page Giter Club logo

Comments (6)

toolmantim avatar toolmantim commented on September 1, 2024 8

For future travelers, if you need an environment variable passed into the container you can use the environment option from the readme.

For the example, the following will pass through the standard Buildkite commit environment variable:

environment:
  - BUILDKITE_COMMIT

from docker-buildkite-plugin.

toolmantim avatar toolmantim commented on September 1, 2024

Thanks for taking the time to file that as an issue @maks, and sorry it caused some confusion. I've just pushed an update to make it a little clearer. Do you think that should avoid future confusion?

from docker-buildkite-plugin.

maks avatar maks commented on September 1, 2024

@toolmantim thanks that's great! Yes I think that makes it much more clear that only those 3 are passed in

from docker-buildkite-plugin.

blsmth avatar blsmth commented on September 1, 2024

i'm stumbling upon this issue because i'm also confused by this functionality. what is the reasoning behind not passing in all the env variables? it's confusing as well that variables defined my steps also don't get passed through.... am i missing something?

from docker-buildkite-plugin.

lox avatar lox commented on September 1, 2024

@blsmth I'm sorry for the confusion! We don't pass through env by default because generally docker usage requires you to opt-in to what environment is passed from the host and we try and match up with docker's philosophies as closely as possible in this plugin.

We could certainly consider a flag that allows you to pass in all environment from the job though. Perhaps something like:

steps:
  - command: yarn install && yarn run test
    plugins:
      docker#v1.4.0:
        image: "node:7"
        workdir: /app
        job_environment: true

from docker-buildkite-plugin.

playdoz avatar playdoz commented on September 1, 2024

Hey there, I am also playing around with passing env vars to containers via the Docker plugin.

I've finally got my head around how it works however just one more question I want to confirm.

If I declare an env var at the pipeline level (see example below), then it does not export the variable and therefore is not usable in a shell script. This means you have to declare the 'MYENVVAR' in the job step (commented out code below) explicitly?

env:
  MYENVVAR: "hello"

steps:
  - label: ':partyparrot: Test Docker Plugin'
    command:
      - echo $MYENVVAR
      - test-env-var.sh
    plugins:
      docker#v1.4.0:
        image: alpine
#        environment:
#          - MYENVVAR=hello

@lox that would be great if a flag was available as currently I'm repeatedly passing in the same bunch of BUILDKITE_* variables in every job of my pipeline

from docker-buildkite-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.