EOF:在 Jenkins Pipeline 中未找到命令

EOF:在 Jenkins Pipeline 中未找到命令

我正在尝试在 Jenkins 管道中启动 Datadog 代理,但出现以下错误:

第 7 行:警告:第 2 行的此处文档以文件末尾分隔(需要“EOF”)。EOF:未找到命令错误。

    stage('Install Datadog agent'){
        when {
            environment(name: "DATADOG_REQ", value: "enable")
            }
        steps {
            script {
            echo "Installing Datadog Agent"
            
            sh '''#!/bin/bash 
                ssh -o ConnectTimeout=30 -t  ABC@1234 /bin/bash  << EOF || error_exit "creating based folder failed for $service_name"
                sudo chmod u+x ./${JOB_NAME}/enableDatadogAgent.sh
                sudo chown jenkins:jenkins ./${JOB_NAME}/enableDatadogAgent.sh
                echo ${DATADOG_REQ} ${JOB_NAME}
                ./${JOB_NAME}/enableDatadogAgent.sh ${DATADOG_REQ} 
                EOF'''
                }



            }
        }

任何帮助都会非常有帮助。

答案1

阶段('安装 Datadog 代理'){当{环境(名称:“DATADOG_REQ”,值:“启用”)}步骤{脚本{echo“安装 Datadog 代理”

        sh '''#!/bin/bash 
            ssh -o ConnectTimeout=30 -t  ABC@1234 /bin/bash  << EOF || error_exit "creating based folder failed for $service_name"
            sudo chmod u+x ./${JOB_NAME}/enableDatadogAgent.sh
            sudo chown jenkins:jenkins ./${JOB_NAME}/enableDatadogAgent.sh
            echo ${DATADOG_REQ} ${JOB_NAME}
            ./${JOB_NAME}/enableDatadogAgent.sh ${DATADOG_REQ} 
            << EOF'''
            }
      

相关内容