Load Jenkins Pipeline Shared Library from same repository

前端 未结 7 2149
北恋
北恋 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:43

    You may take a look at plugin I wrote, that enables using subdirectories of repo where your pipeline is as shared libraries: https://github.com/karolgil/SharedLibrary

    After building and installing it, you can simply put following in your pipeline:

    @SharedLibrary('dir/in/repo') _
    

    To start using dir/in/repo as shared library for your pipelines.

提交回复
热议问题