首页 > 解决方案 > 第 2 行的此处文档由文件结尾分隔(需要 `EOF_$$')

问题描述

下面是执行 shell 脚本的 Jenkins groovy 代码:

    BUILD_FULL = sh (
                script: '''
                        cat > manifest.yml << EOF_$$
                        ---
                        applications:
                        - name: xyz-api
                          instances: 1
                          memory: 1G
                        EOF_$$
                        ''',
                returnStatus: true
                ) == 0

以下是错误:

line 9: warning: here-document at line 2 delimited by end-of-file (wanted `EOF_$$')

manifest.yml显示为:

                        ---
                        applications:
                        - name: xyz-api
                          instances: 1
                          memory: 1G
                        EOF_31892

代替

                        ---
                        applications:
                        - name: xyz-api
                          instances: 1
                          memory: 1G

如何跟踪文件结尾?使用 Jenkins groovy

标签: bashshellgroovyjenkins-pipelinejenkins-groovy

解决方案


推荐阅读