Use CI_COMMIT_BRANCH branch name as a file path

Viewed 3040

I'm trying to setup a pipeline where the output will be written to a location based on the branch on which the pipeline was triggered.

Example: If branch was topic/124579, then output must be written to D:/Artifacts/topic/124579.

But when I use this on my .gitlab-ci.yml, the runner creates a directory with the name CI_COMMIT_BRANCH literally: D:/Artifacts/CI_COMMIT_BRANCH.

Here are a few things that I've tried

md D:/Artifacts/CI_COMMIT_BRANCH results in D:/Artifacts/CI_COMMIT_BRANCH as before

md D:/Artifacts/$CI_COMMIT_BRANCH results in D:/Artifacts/$CI_COMMIT_BRANCH

md D:/Artifacts/"$CI_COMMIT_BRANCH" also results in D:/Artifacts/$CI_COMMIT_BRANCH

How do I do this ?

I'm running my jobs on a self-hosted Windows runner, using cmd as the shell.

1 Answers
Related