Urago
Urago

Reputation: 47

Newman pass variable from GitLab

I have pipeline on GitLab and there the variable - ENV_VAR. This variable is changing based on branch for pipeline.

In the same yml file I have script with newman, where I want to pass this variable like this -> newman run ... -e test/apis/$ENV_VAR_environment.json

But the issue I have right now is that it seems the variable is not being passed as i want. The pipeline shows error - cannot read the test/apis/here_should_be_the_variable_name.json

Is there a way to pass this variable into the file source?

Upvotes: 1

Views: 447

Answers (1)

pavelsaman
pavelsaman

Reputation: 8352

It looks like you only need to enclose the variable name in braces:

-e test/apis/${ENV_VAR}_environment.json

because test/apis/$ENV_VAR_environment.json means that it looks for $ENV_VAR_environment variable which obviously does not exist.

Upvotes: 1

Related Questions