【问题标题】:How to extract first 3 characters of jenkinsfile parameter如何提取jenkinsfile参数的前3个字符
【发布时间】:2019-07-22 17:39:49
【问题描述】:

我需要提取jenkinsfile参数的前3个字符:

string(name: 'DB_Type', defaultValue: 'mysql'  )

我尝试了以下方法,但没有成功:

prefix=${params.db_type}
prefix=prefix.substring(0,2)

【问题讨论】:

  • 你有一个错字:params.db_type 而不是params.DB_Type
  • @Matt Schuchard 抱歉打错了,我用 DB_Type 试过了,它不起作用。
  • 描述“没用”...异常?空字符串?

标签: groovy jenkins-pipeline jenkins-pipeline-unit


【解决方案1】:
params.DB_Type?.substring(0,3)

【讨论】:

    猜你喜欢
    • 2021-09-19
    • 2023-01-27
    • 1970-01-01
    • 1970-01-01
    • 2011-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-02
    相关资源
    最近更新 更多