Drone

Correct environment variable substitution for drone v1 with jsonnet

While rewriting old .drone.yml files to .drone.jsonnet and I faced one problem.

In yml there was a line which used variable substitution, like this:

tags: ${DRONE_BRANCH/\//-}

So, I tried to write such a jsonnet which will generate yaml as the one above. But I failed.

Maybe I missed something important? Please, help!

I recommend posting jsonnet syntax questions (or in this case jsonnet escaping) to stackoverflow using the jsonnet tag. The jsonnet folks should be able to help clear up any questions related to escaping.

Thank you for your response! @sbarzowski in the issue thread I linked argues that it’s impossible and useless to generate such a string from jsonnet. And this is a problem.