Jenkins设置流水线Pipeline定时任务
  TEZNKK3IfmPf 2023年11月13日 23 0

Jenkins设置流水线Pipeline定时任务

2、构建触发器

* * * * *   # 为每分钟执行
# 分时日月周 与crontab一样

Jenkins设置流水线Pipeline定时任务

3、流水线任务

Jenkins设置流水线Pipeline定时任务

定义(Pipeline script)

流水线语法 -> 片段生成器

示例步骤(sh: Shell Script)

echo $(date "+%Y-%m-%d %H:%M:%S") hello world >> /root/hello.txt

装换为pipeline脚本

sh label: '', script: 'echo $(date "+%Y-%m-%d %H:%M:%S") hello world >> /root/hello.txt'

Jenkins设置流水线Pipeline定时任务

填入流水线框

pipeline {
    agent any 
    stages {
        stage('Stage 1') {
            steps {
                sh label: '', script: 'echo $(date "+%Y-%m-%d %H:%M:%S") hello world >> /root/hello.txt'
            }
        }
    }
}

保存

查看结果

$ tail -f hello.txt

2019-04-03 16:37:00 hello world
2019-04-03 16:38:00 hello world
2019-04-03 16:39:00 hello world
2019-04-03 16:40:00 hello world
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月13日 0

暂无评论

推荐阅读
  TEZNKK3IfmPf   2023年11月13日   19   0   0 jenkins
  TEZNKK3IfmPf   2023年11月14日   23   0   0 jenkins
  TEZNKK3IfmPf   2023年11月14日   24   0   0 jenkins
  TEZNKK3IfmPf   2023年11月13日   26   0   0 节点jenkins
  TEZNKK3IfmPf   2024年03月22日   58   0   0 jenkins
  TEZNKK3IfmPf   2023年11月14日   21   0   0 jenkins
  TEZNKK3IfmPf   2023年11月14日   29   0   0 linuxtomcatjenkins
  TEZNKK3IfmPf   2023年11月13日   29   0   0 jenkins
TEZNKK3IfmPf