Jenkins将环境变量作为参数传递

时间:2020-03-21 02:33:26

标签: jenkins jenkins-pipeline devops gatling jenkins-groovy

我正在为内部应用程序准备性能测试脚本(加特林)。此性能测试脚本可在许多Jenkins代理(〜7个jenkins代理)上执行。

我想将所有与应用程序/加特林相关的环境变量作为Jenkins参数传递给Jenkins管道,然后应用程序/加特林可以读取环境变量并基于作为Jenkins参数提供的环境变量执行性能测试< / p>

我的代码:

const regex = /(\w+)(?:\s*,\s*(\w+))?(?:\s*,\s*(\w+))?/;
const s1 = 'id';
const s3 = 'id, title';
const s3 = 'id, title, date';

我得到的错误:

pipeline {
agent { node { label 'performance-test-agents-1' } }

    parameters {
    string(defaultValue: "https://rems-xxxxxxxxxx.dev-xxx-xxx.xx.xx.local", description: "please provide the base url for target environment", name: "Baseurl")
    string(defaultValue: "10", description: "set the execution duration", name: "duration")
    string(defaultValue: "20", description: "set the qps value for throttling", name: "maxqps")
    string(defaultValue: "10", description: "set the initial concurrent users", name: "initUsers")
    string(defaultValue: "20", description: "set the ramping user count", name: "rampUsers")
    booleanParam(defaultValue: false, description: 'Update pipeline parameters without building/deploying', name: 'update_params_only')
    }

    environment {
      DURATION   = "${duration}"
      MAXQPS     = "${maxqps}"
      INITUSERS  = "${initUsers}"
      RAMPUSERS  = "${rampUsers}"
      DIRECT_LOGGINGAPI_URL = "${Baseurl}"
      ONLY_UPDATE_PARAM = "${update_params_only}"
   }

完成:失败

0 个答案:

没有答案