lftp无法在gitlab ci中运行,返回未找到的shell
当我使用此.gitlab-ci.yml配置将示例文件上载到ftp时:lftp无法在gitlab ci中运行,返回未找到的shell,gitlab,gitlab-ci,lftp,Gitlab,Gitlab Ci,Lftp,当我使用此.gitlab-ci.yml配置将示例文件上载到ftp时: variables: FTP_HOST: ****** FTP_PASSWORD: ******* FTP_USERNAME: ******* stages: - build - test - deploy samplejob: stage: build script: - mkdir sample - echo 'lorem ipsum' > sample/s1.tx
variables:
FTP_HOST: ******
FTP_PASSWORD: *******
FTP_USERNAME: *******
stages:
- build
- test
- deploy
samplejob:
stage: build
script:
- mkdir sample
- echo 'lorem ipsum' > sample/s1.txt
artifacts:
expire_in: 2d
paths:
- sample/
upload:
stage: deploy
#image: mwienk/docker-lftp:latest
image: alpacadb/docker-lftp:latest
script:
- lftp -v
- lftp -e "set ftp:ssl-allow false; mirror -eRnv sample deploy-test; exit;" -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST
结果是未找到shell错误。使用gitlab 11.0.3-ee和gitlab runner 11.0.0
这是作业终端输出:
Running with gitlab-runner 11.0.0 (5396d320)
on build.dev.*****.com 75df7aee
Using Docker executor with image alpacadb/docker-lftp:latest ...
Pulling docker image alpacadb/docker-lftp:latest ...
Using docker image sha256:49f8f3e772415878d19828d9d402699d5d18f550220877fa21ebe64f87fbb36a for alpacadb/docker-lftp:latest ...
Running on runner-******-project-60-concurrent-0 via build.dev.*****.com...
Fetching changes...
Removing sample/
HEAD is now at 925653b Update .gitlab-ci.yml
Checking out 925653b9 as master...
Skipping Git submodules setup
Downloading artifacts for samplejob (258)...
Downloading artifacts from coordinator... ok id=258 responseStatus=200 OK token=ZUW7pcbQ
open: invalid option -- 'c'
Usage: lftp [-e cmd] [-p port] [-u user[,pass]] <host|url>
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `else'.
shell not found
open: invalid option -- 'c'
Usage: lftp [-e cmd] [-p port] [-u user[,pass]] <host|url>
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `elif'.
Unknown command `then'.
Unknown command `exec'.
Unknown command `else'.
shell not found
ERROR: Job failed: exit code 1
此配置有什么问题?我解决了使用image:mwienk/docker lftp:latest而不是image:alpacadb/docker lftp:latest的问题。如图所示,此图像没有使用入口点,因此可以在Gitlab CI中使用。谢谢,现在它可以正常工作并成功上传文件,但上传文件后,返回:错误:作业失败:退出代码1。你知道为什么吗?现在不知道。你解决问题了吗?脚本是否提供了更多信息?通过使用-verbose出现错误。使用-p选项修复了它。lftp试图在上传后对文件设置chmod。