How can I reference the Jenkinsfile directory, with Pipeline?

前端 未结 6 1298
你的背包
你的背包 2021-02-03 18:50

I have a groovy file, I want to run from the Jenkinsfile.

ie. load script.groovy

However, I am not sure how I can reference this file if it is store

6条回答
  •  旧巷少年郎
    2021-02-03 19:31

    Had the same problem. Ended up with extra clone operation to get copy of script repo under workspace dir so I can reliably access groovy files in it:

    dir ('SCRIPTS_DIR') {
        checkout scm
        commonScripts = load 'subdir/Common.groovy' // no def, so script is global
    }
    

提交回复
热议问题