Comments (6)
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.
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.
@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.
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.
@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.
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)
- input from block steps not passed in env HOT 1
- Can't interpolate ENV vars in mount path HOT 3
- Docker on Docker support HOT 1
- Exit codes > 1 are not correctly propagated HOT 2
- Dependency Dashboard
- GPU parameters not passing in Docker Run {--gpus 1} HOT 3
- Allow setting config globally, instead of per step HOT 1
- Limitation with an array of commands at the step level
- Handling of parameters when shell is false HOT 4
- Changing the Docker Version from 20.10.9 to 20.10.22 HOT 1
- `.ssh/known_hosts` mounted in wrong location when both `mount-ssh-agent` and `user` are used HOT 3
- Documentation: expand-volume-vars expansion time HOT 2
- error pulling amazonlinux:latest HOT 6
- How to pass environment variable to command? HOT 2
- Support for other docker commands than docker run HOT 2
- Windows: docker: Error response from daemon: invalid volume specification HOT 1
- add `expand-workdir-vars` option HOT 2
- Next major version should support the 99% case HOT 1
- `mount-buildkite-agent` should mount `BUILDKITE_AGENT_JOB_API_SOCKET`
- Plugin doesn't correctly bubble up Docker Hub Rate Limiting Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-buildkite-plugin.