Load Jenkins Pipeline Shared Library from same repository

前端 未结 7 2137
北恋
北恋 2021-01-31 07:52

TL;DR Is there a way to import code into the Jenkinsfile from the local repository (other than the load step)?

Why?

I\'ve ex

7条回答
  •  梦如初夏
    2021-01-31 08:30

    Workaround:

    library identifier: 'shared-library@version', retriever: legacySCM(scm)
    

    The approach currently taken in PR 37 will not work properly with build agents, and anyway will only work for scripts using the library step, not the @Library annotation.

    By the way files loaded from the load step do appear in Replay. But it is true that your script cannot statically refer to types defined in such files. In other words, you could simulate library vars/*.groovy but not src/**/*.groovy—the same limitation as the current PR 37.

提交回复
热议问题