It would be possible to make image names configurable so the same pipeline can result in different images. I need this because I use a local docker registry and different drone installations will have different urls for it.
Something like
{
name: 'configurable image',
image: {
from_environment: 'IMAGE_NAME'
}
}
or even better:
{
name: 'configurable image',
image: {
from_environment: '$${LOCAL_REGISTRY}/image:latest'
}
}
This is supported today by configuring global environment variables [1] and then you can use substitution [2] to inject the environment variable in your yaml.
[1] https://docs.drone.io/runner/docker/configuration/reference/drone-runner-environ/
[2] https://docs.drone.io/pipeline/environment/substitution/
1 Like
Thanks for this.
Have I understood this right if I run the runner with drone_runner_environ of MYIMAGE=THISONE
then I can use image: ${THISONE}?
The docs say only the variables in https://docs.drone.io/pipeline/environment/reference/ can be used - i guess any other injected ones can be too? If so that’s perfect!
btw passing all that info a top level jsonnet function would be pretty powerful as you could generate completely different yaml depending on how the runner is configured + the commit info
@bradrydzewski unless I am missing something this doesn’t work. The DRONE_RUNNER_ENVIRON variables are available IN the docker steps but not via substitution unless they get some different name.
ie with DRONE_RUNNER_EVIRON=EXAMPLE:this
i can do
{
name: $DRONE_COMMIT
but not
{
name: $EXAMPLE
}