简体   繁体   中英

Implementing versioning in Jenkins Templating Engine

We are planning to use JTE(Jenkins Templating Engine)for creating pipelines in our org. There are going to be many pipelines that will use this template. Potentially, any change in template can break some pipeline. To avoid this we would like to implement versioning in templates so that we can be sure that any changes in templates would not break existing pipelines.

This is for gradle projects that would be using Jenkinsfile defined in the template. One option we have is to use different branches but that is messy. Has anyone done anything like this for JTE?

@Steven-terrana

just seeing this! I'd recommend the gitter channel or opening an issue at github.com/jenkinsci/templating-engine-plugin to get the fastest response!

I'm not sure that anyone has tried to implement that particular use case but I can think of two primary ways i'd handle it depending upon your specific requirements.

If you're trying to version the template and apply the new version to everyone at the same time, then I would recommend creating release branches for your governance tier repository for teams to consume and then updating which release you point to. If you also put your pipeline libraries in this repository it would have the benefit of packaging everything into a single release so that versions of libraries and templates stay together.

If you want to have multiple versions of your templates out there and allow teams to upgrade when it's convenient for them, then i would recommend using the pipeline_templates directory capability to have named templates. You could create a different file for each release (ie, named v1, v2, etc) and then allow teams to choose their template in their configuration files via pipeline_template="v1" .

I hope this helps!

Relevant docs:

Pipeline Template Selection

Governance Tiers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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