Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

YAML String interpolation for image property #974

Open
ghost opened this issue Aug 25, 2021 · 4 comments
Open

YAML String interpolation for image property #974

ghost opened this issue Aug 25, 2021 · 4 comments
Labels
frozen Issue should not be marked as stale is:suggestion priority:high

Comments

@ghost
Copy link

ghost commented Aug 25, 2021

Describe the problem you'd like to solve

Hi, Is it possible to implement string interpolation via config / environment variables for the "image" property? This would be helpful with running different versions of containers in test pipelines.

The below is compatible with docker-compose, so thinking something similar can be implemented?
image: my-repo/my-image:${IMAGE_TAG:-latest}

Describe the solution you'd like

To be able to use environment variables and/or config variables when specifying an image.

something like this:
image: my-repo/my-image:${IMAGE_TAG:-latest}
and/or
image: my-repo/my-image:<{image_tag}

Describe alternatives you've considered

An alternative I have found is to run docker in docker and have that start up the image using 'docker run' as the command property supports string interpolation

docker-my-app: image: docker:20.10.8 environment: IMAGE_VERSION: <{image_version} command: "sh -c \" docker run --rm my-repo/my-image:${IMAGE_VERSION} \""

Additional context

I'm trying to run cypress tests in a Jenkins pipeline against a docker image my company produces, I want to set up the batect task in a way that developers can use this in their local environments too. The ideal endpoint is for devs/pipelines to be able to run a batect task in the following format

./batect test:cypress --config-var test_img=0.5.7
or
TEST_IMG=0.5.7 ./batect test:cypress
or
./batect test:cypress
with a .env file that specifies what image to test.

Thanks!

@ghost ghost added the is:suggestion label Aug 25, 2021
@charleskorn
Copy link
Collaborator

Hi @ryanb6920, thanks for the suggestion. Something I'm hoping to do soon* is support interpolation like this in almost every field in configuration files. Watch this space.

(*for some definition of soon :) )

@charleskorn
Copy link
Collaborator

Take a look at #990 and let me know your thoughts.

@ghost
Copy link
Author

ghost commented Aug 30, 2021

Looks like a good solution to me :)

@stale
Copy link

stale bot commented Oct 29, 2021

This issue has been automatically marked as stale because it has not had any activity in the last 60 days. It will automatically be closed if no further activity occurs in the next seven days to enable maintainers to focus on the most important issues.
If this issue is still affecting you, please comment below within the next seven days.
Thank you for your contributions.

@stale stale bot added the stale label Oct 29, 2021
@charleskorn charleskorn added frozen Issue should not be marked as stale and removed stale labels Oct 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen Issue should not be marked as stale is:suggestion priority:high
Development

No branches or pull requests

1 participant