Jenkins Cron计划无效触发类型“参数化”

发布于 2025-02-14 00:13:16 字数 618 浏览 0 评论 0原文

我试图根据参数每天晚上仅在管道中运行C级C。但是管道使我抛出了无效的触发类型“参数化”错误。以下是我的管道脚本。请帮助可能的问题。另外,我的管道不是通过Cron作业触发的,我需要手动触发。

pipeline {
    agent any
  }

parameters {
    choice(
            name: 'ENV',
            choices: [ 'uat', 'perf' ],
    )
    booleanParam(
        name: 'RUN',
        defaultValue: true
    )       
}

triggers {
    parameterizedCron('''
        17 14 * * * %RUN=true;ENV=uat
    ''')
}

stages {

    stage ('A') {

    }

    stage ('B') {

    }
    stage('C') {
          when {
            expression { env.RUN || env.ENV == 'uat' }
          }
    ## RUN THIS STAGE

}

}

I'm trying to run only Stage C in pipeline every night based on the parameters. But pipeline is throwing me Invalid trigger type "parameterizedCron" error. Below is my pipeline script. Please help what could be the issue. Also my pipeline is not triggering via cron job i need to trigger manually.

pipeline {
    agent any
  }

parameters {
    choice(
            name: 'ENV',
            choices: [ 'uat', 'perf' ],
    )
    booleanParam(
        name: 'RUN',
        defaultValue: true
    )       
}

triggers {
    parameterizedCron('''
        17 14 * * * %RUN=true;ENV=uat
    ''')
}

stages {

    stage ('A') {

    }

    stage ('B') {

    }
    stage('C') {
          when {
            expression { env.RUN || env.ENV == 'uat' }
          }
    ## RUN THIS STAGE

}

}

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

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

发布评论

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

评论(1

时光无声 2025-02-21 00:13:16

您是否已安装并启用了插件?

如果您刚安装了插件,请尝试重新启动Jenkins。

Have you installed and enabled the plugin?

enter image description here

If you freshly installed the plugin try restarting Jenkins.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文