为所有github回购生成jenkins作业 [英] Generate jenkins jobs for all github repos

查看:98
本文介绍了为所有github回购生成jenkins作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Jenkins中设置一些自动化功能,定期轮询我们github组织中的repos列表,并根据作业模板自动为每个Git仓库设置jenkins作业。



实现此目标的可能解决方案是什么?谢谢!

解决方案

Jenkins Pipeline是时下流行的方式。



它使用 Jenkinsfile 来定义管道,您可以在您的回购站中签入。



最佳实践是像这样的文件

  pipeline {
代理任何

阶段{
阶段('Build'){
steps {
echo'Building ..'
}
}
stage('Test'){
steps {
echo'Testing ..'
}
}
stage('Deploy'){
steps {
echo'Deploying ....'




code
$ b

如前所述




$ b < a href =https://jenkins.io/doc/book/pipeline/jenkinsfile/ =nofollow noreferrer>在文档中。


I would like to set up some automation inside Jenkins that periodically polls the list of repos in our github organization and automatically sets up a jenkins job for each of that Git repos based on a job template.

What would be a possible solution to achieve this? Thanks!

解决方案

Jenkins Pipeline is nowadays the way to go.

It defines pipelines using a Jenkinsfile, which you can check into your repos.

Which the best practice is a file like this

pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                echo 'Building..'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing..'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying....'
            }
        }
    }
}

As described in the documentation.

这篇关于为所有github回购生成jenkins作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆