Using Gitlab variable with newman

Hi, I setup newman to run my collections in gitlab pipeline. I wanted to allow the user to set a value for a Gitlab environement variable before running my newman test pipeline. I am wondering is there a possible way for newman to inject a gitlab variable and his value into the environment.json?

Thanks.

Hey @mikeccc

Welcome to the community! :trophy:

Depending on how you’re using Newman in your pipeline - You can add those Gitlab variables into the Collection like this?

From the CLI:

--env-var "variable_name=$GITLAB_VAR"

Newman as a library:

    envVar: [ 
        { "key":"variable_name", "value": $GITLAB_VAR}
    ]

If you wanted to share your pipeline file, I could give you a better/more focussed solution.

Thanks a lot @dannydainton . I’ll give it a try. Thanks for the advice.
Truly appreciated.

1 Like