EOF:在 Jenkins 管道中找不到命令

EOF: command not found in 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'''
                }



            }
        }

任何帮助都会很有帮助。

我将 << EOF 更改为 <<- _EOF_,现在可以正常使用了。

            script {
            echo "Installing Datadog Agent"
            
            sh '''#!/bin/bash 
                ssh -o ConnectTimeout=30 -t  ABC@1234 /bin/bash  <<- _EOF_ || error_exit "Failed to execute while doing SSH"    
                    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_'''

                }