参数化管道构建jenkins始终使用最后的构建参数。如何解决这个问题?

时间:2017-06-13 06:46:17

标签: jenkins groovy jenkins-pipeline

我正在使用具有多分支设置的Jenkins管道。我使用Jenkinsfile为“使用参数构建”设置了构建参数。问题是它总是会获取以前的构建参数。这是代码:

properties([[$class: 'JobRestrictionProperty'],
      parameters([

      string(defaultValue: 'https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#build-parameters', description: 'File-Location', name: 'File_Location')

  ]), [$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 0, maxConcurrentTotal: 0, paramsToUseForLimit: '', throttleEnabled: false, throttleOption: 'project'], pipelineTriggers([])])

我每次运行后都会重置此变量(使其为空)。但是对于下一个构建,它总是选择最后一个(它是空的),而不是Jenkins文件中定义的新构建。

1 个答案:

答案 0 :(得分:0)

我认为这是设计的,参数化管道仅在第一次提示参数,然后默认使用这些参数