从 Gitlab CI 设置邮递员变量值

Set a postman variable value from the Gitlab CI

为我的测试定义了两个变量。我想通过 CI.

设置这些值
Below is the code from gitlab-ci.yml
smoketest-test:
  stage: smoketests-test
  dependencies:
  - deploy-test
  image: 
    name: postman/newman:alpine
    # entrypoint: [""]
  script:
    - newman --version.sh
    - npm install -g newman-reporter-html
    - newman runs tests/postmanui-tests.json -e tests/${ENV_VAR}_environment.json "uname" = "abc"
  artifacts:
     when: always
     paths:
      - report.html
  only:
    - master
  except:
    - schedules
  tags:
    - environment_test

如何从 CI 传递变量“uname”的值?目前没有通过。

可以使用 --env-var 标志覆盖单个变量。

硬编码值:

    - newman run tests/postmanui-tests.json -e tests/${ENV_VAR}_environment.json --env-var uname="abc"

要使用 Gitlab CI 变量:

variables:
  uname: default-value
  abc: default-value

...

    - newman run tests/postmanui-tests.json -e tests/${ENV_VAR}_environment.json --env-var ${uname}=${abc}