Any way to export environment vars during build?


Hi everybody!

Actually, the problem I’m trying to solve is to filter $CI_BRANCH variable and replace some symbols (like -/.*, etc) with “_”. I was thinking about some pre-processing step where I can modify $CI_BRANCH and store new value to another env variable. Is it possible to do so? Any other workaround?


Hey @Ivan,

sorry for the slow reply on this topic.

You could use shared host volumes (see to pass data between different steps (or containers).

That way you could have a container, that takes the CI_BRANCH environment variable as input, transforms it according to your rules and writes the generated data to a file on the shared volume. A later step could then source that file and get access to the modified version.

Would that work in your case?


Hi @mlocher!

Thanks for the tip, it worked for me. I just thought that there is another approach to solve such a problem.



Not at the moment. But I’ll ask our @product team to look into this :slight_smile: