lftp无法在gitlab-ci中运行,返回未找到的shell

时间:2018-12-01 08:46:13

标签: 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.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 not found错误。使用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

此配置有什么问题?

1 个答案:

答案 0 :(得分:1)

我解决了使用image: mwienk/docker-lftp:latest而不是image: alpacadb/docker-lftp:latest的问题。