简体   繁体   English

清理基于文件的变量。 错误:作业失败:退出代码 1

[英]Cleaning up file based variables. ERROR: Job failed: exit code 1

I am using gitlab-ci to automate build and release.我正在使用gitlab-ci来自动化构建和发布。 In the last job, I want to upload the artifacts to a remote server using lftp .在上一份工作中,我想使用lftp将工件上传到远程服务器。

$(pwd)/publish/ address is the artifacts that were generated in the previous job. $(pwd)/publish/ address 是在上一个作业中生成的工件。 And all variables declared in the gitlab Settings --> CI / CD .以及在gitlab Settings --> CI / CD 中声明的所有变量。

This the job yaml code:这是工作yaml代码:

upload-job:
    stage: upload
    image: mwienk/docker-lftp:latest
    tags:
        - dotnet
    only:
        - master
    script:
        - lftp -e "open $HOST; user $FTP_USERNAME $FTP_PASSWORD; mirror -X .* -X .*/ --reverse --verbose --delete $(pwd)/publish/ wwwroot/; bye"

Note that lftp transfers my files, however, I'm not sure all of my files are transferred.请注意, lftp传输我的文件,但是,我不确定我的所有文件都已传输。

I added echo "All files Transfered."我添加了echo "All files Transfered." but it never runs.但它永远不会运行。

There is no error and warning in the pipeline log but I got the following error:管道日志中没有错误和警告,但出现以下错误:

在此处输入图片说明

I don't know what is it for.我不知道这是为了什么。 Have anyone faced the error and have found any solution?有没有人遇到错误并找到任何解决方案?

Finally, I solved the problem by some changes in lft command parameters.最后通过修改lft命令参数解决了这个问题。

The point in troubleshooting ERROR: Job failed: exit code 1 is that to use commands with the verbose parameter that return sufficient log to enable you to troubleshoot the problem.ERROR: Job failed: exit code 1进行故障排除的要点是使用带有verbose参数的命令,返回足够的日志,使您能够对问题进行故障排除。 Another important point is to know how to debug shell scripts such as bash , powershell , or etc.另一个重要的点是知道如何调试 shell 脚本,例如bashpowershell等。

Also, you can run and test commands directly in a shell , it is helpful.此外,您可以直接在shell 中运行和测试命令,这很有帮助。

The following links are helpful to troubleshoot command-line scripts:以下链接有助于对命令行脚本进行故障排除:

How to debug a bash script? 如何调试 bash 脚本?

5 Simple Steps On How To Debug a Bash Shell Script 关于如何调试 Bash Shell 脚本的 5 个简单步骤

Use the PowerShell Debugger to Troubleshoot Scripts 使用 PowerShell 调试器对脚本进行故障排除

For lftp logging:对于lftp日志记录:

How to enable lftp protocol logging? 如何启用 lftp 协议日志记录?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 gitlab 跑步者在最后抛出“清理基于文件的变量 00:01 错误:作业失败:退出代码 1” - gitlab runner throws "Cleaning up file based variables 00:01 ERROR: Job failed: exit code 1" at the end Gradle 环境变量。 从文件加载 - Gradle Environment variables. Load from file bash 执行整个脚本,但如果任何中间作业失败,则返回退出代码 > 0 - bash execute whole script but return exit code > 0 if any intermediate job has failed 根据退出代码bash脚本将命令重定向到变量或文件? - redirect command to a variable or a file based on its exit code bash script? 需要帮助使用bash清理日志文件 - Need help cleaning up a log file with bash 基于bash中的循环操作退出带有错误代码的脚本 - Exit script with error code based on loop operations in bash bash脚本将内容写入文件。 文件内容需要bash变量。 怎么做? - bash script to write content into file. File content requires bash variables. How to do that? 基于标准输出替换退出代码? - Replace exit code based on stdout? 在bash中,清理后退出上一个命令状态的最佳方法是什么 - In bash, what's the best way to exit with the status of a previous command after cleaning up 尝试构建Android应用程序时,Cordova失败,错误为“命令失败,退出代码2”,Linux - Cordova fail when try to build Android app with error “Command failed with exit code 2” Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM