无论如何,是否有在詹金斯(Jenkins)进行特殊提交的应用程序?

发布于 2025-02-12 18:22:30 字数 332 浏览 0 评论 0原文

我已经使用Jenkins自动化了一个应用程序。当我将代码推向主分支时,Jenkins脚本会运行并重建应用程序。这是我目前的情况。

我现在需要做的事情,当我只使用特定的提交消息推动时,我需要触发詹金斯的构建。 (例如,提交消息由“构建”键合成只能再次构建应用程序。)

Ex:-
git commit -m "Build | this is demo commit" - should be build the application.
git commit -m "this is demo commit" - should not be rebuild.

我有可能做到吗?

I have automated an application using Jenkins. When I push my code to master branch, Jenkins script runs and rebuild the application. This is my current situation.

What I need to do now, When I push with specific commit message only, I need to trigger the Jenkins build. (For an example, Commit message consist of "Build" keywork can only build the application again.)

Ex:-
git commit -m "Build | this is demo commit" - should be build the application.
git commit -m "this is demo commit" - should not be rebuild.

Am I possible to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

这个俗人 2025-02-19 18:22:30

这是您可以使用声明的管道来执行此操作的方法。请注意条件当{ChangElog'build |。*'}

pipeline {
    agent any

    stages {
        stage('Checkout') {
            steps {
                git (url: 'https://github.com/ycr/sample.git', branch: 'main')
            }
        }
        
        stage('Build') {
            when {  changelog 'Build |.*' }
            steps {
               echo "BUILDING"
            }
        }
    }
}

Here is how you can do this with a declarative pipeline. Note the condition when { changelog 'Build |.*'}

pipeline {
    agent any

    stages {
        stage('Checkout') {
            steps {
                git (url: 'https://github.com/ycr/sample.git', branch: 'main')
            }
        }
        
        stage('Build') {
            when {  changelog 'Build |.*' }
            steps {
               echo "BUILDING"
            }
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文