| with cmd

问题描述 投票:0回答:1

sh''''


def sd = "2020" + "${env.START_DATE}" + "0000"
def ed = "2020" + "${env.END_DATE}" + "2359.59"

pipeline {
    agent {label "master"}
    stages {
        stage('Build') {
            steps {

                print(sd)
                sh 'echo "Hello World"'
                sh """
                    pwd
                    #rm end-time start-time
                    #rm $WORKSPACE/$PARSING_OUTPUT
                    touch -t $sd $WORKSPACE/start-time
                    touch -t $ed $WORKSPACE/end-time
                    find /var/lib/jenkins/jobs/. -type f -newer $WORKSPACE/start-time  ! -newer $WORKSPACE/end-time -name '*' -exec grep $SEARCH_STRING /dev/null {} + >> $WORKSPACE/$PARSING_OUTPUT
                    ls -ltr
                """
            }
        post {
                always {
                    echo "sending mail"
                    //mail to: '[email protected]',
                    //subject: "Parse Jenkins log",
                    //body: "TBD"
                    //body: "${env.BUILD_URL} has result ${currentBuild.result}"
                }
            }
        }
    }
}

ERROR: script returned exit code 1$CMD#!/bin/sh

我在Jenkins上尝试以下方法来搜索工作中的失败字符串。 这将在每天的基础上运行。
shell jenkins jenkins-pipeline
1个回答
0
投票

这将允许我执行没有选项 - 没有帮助。任何建议?

我在Jenkins上尝试以下方法,目的是搜索工作中的失败字符串。def sd = "2020" + "${env.START_DATE}" 。+ "0000" def ed = "2020" + "${env.END_DATE}" + "...

有多种方法可以达到上述目的

1) 使用 set +e # 在非零时禁止退出。

sh ''''

设置+e

..

'''

2)使用OR

© www.soinside.com 2019 - 2024. All rights reserved.