简体   繁体   English

在 Jenkins 模板引擎中使用实用程序脚本

[英]Use utility scripts in Jenkins Templating Engine

I'm a newbie to Jenkins Templating Engine, and trying to implement a CI process using JTE.我是 Jenkins 模板引擎的新手,正在尝试使用 JTE 实现 CI 流程。 Usually, when using Jenkins, i have a repo named DevOps in which i keep all the utility scripts that i'm using in the CI process instead of placing them in the developers' source code repositories.通常,在使用 Jenkins 时,我有一个名为DevOps存储库,我将在 CI 过程中使用的所有实用程序脚本保存在其中,而不是将它们放在开发人员的源代码存储库中。 So in each Jenkinsfile i check out the source code as well as the DevOps repo into the workspace and use it.因此,在每个 Jenkinsfile 中,我将源代码以及 DevOps 存储库检出到工作区并使用它。

I was wondering if this is considered a best practice in general.我想知道这是否被认为是一般的最佳实践。 If not, what is?如果不是,那是什么? and if is, what is the best way to imitate that kind of pattern in JTE, given that my fresh new Jenkinsfile looks like:如果是,考虑到我的新 Jenkinsfile 看起来像这样,在 JTE 中模仿这种模式的最佳方法是什么:

checkout scm
build()
deploy()

Checkout scm elegantly checks out the source code repository defined in the SCM plugin in the configuration page. Checkout scm 优雅地检出配置页面中 SCM 插件中定义的源代码存储库。 Where can i embed another checkout step that will clone the DevOps repo and still keep the JTE infrastructure generic?我在哪里可以嵌入另一个checkout步骤,该步骤将克隆 DevOps 存储库并仍然保持 JTE 基础设施的通用性?

coming in JTE 2.0 you'll be able to store and access library resources.在 JTE 2.0 中,您将能够存储和访问图书馆资源。

merged PR for the feature: https://github.com/jenkinsci/templating-engine-plugin/pull/102该功能的合并 PR: https : //github.com/jenkinsci/templating-engine-plugin/pull/102

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM