.gitlab-ci.yml Gitlab部署SFTP不工作

问题描述 投票:1回答:2
deploy:
  stage: deploy
  script:
    - apt-get update -qq && apt-get install -y -qq lftp
    #- lftp -u $DEPLOY_USER,$SFTP_PASSWORD $DEPLOY_HOST -e "mirror -e -R -p ./dist/ new/ ; quit"
    - lftp -c "set ftp:ssl-allow no; debug; open -u root,$DEPLOY_PASSWORD -p 22 $DEPLOY_HOST; mirror -Rev ./ gitlab --verbose --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
    - echo "deployment complete"
  # specify environment this job is using
  environment:
    name: staging
    url: https://xxxxxxxx.de/
  # needs artifacts from previous build

你能用脚本帮我吗?谢谢。 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

新的失败 - >

--verbose --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
---- Running connect program (ssh -a -x -s -l root xx.xx.xxx.xx sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- The authenticity of host 'xx.xx.xxx.xx (xx.xx.xxx.xx)' can't be established.
<--- ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxx+xxxxxxxxxxxxxx.
<--- Are you sure you want to continue connecting (yes/no)? no
<--- 
<--- Host key verification failed.
---- Disconnecting
---- Running connect program (ssh -a -x -s -l root xx.xx.xxx.xx sftp)
---> sending a packet, length=5, type=1(INIT), id=0
<--- The authenticity of host 'xx.xx.xxx.xx (xx.xx.xxx.xx)' can't be established.
<--- ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxx+xxxxxxxxxxxxx.
<--- Are you sure you want to continue connecting (yes/no)? no
<--- 
<--- Host key verification failed.
mirror: Fatal error: Host key verification failed.
---- Disconnecting
ERROR: Job failed: exit code 1
git gitlab gitlab-ci gitlab-ci-runner lftp
2个回答
2
投票

您已设置ftp:ssl-allow no,但您正在连接到端口22,这很可能是SSL服务。

假设您打算使用SSL进行连接。尝试:set ftp:ssl-allow true;作为lftp命令的一部分。

lftp man page说:

ftp:ssl-allow(boolean)如果为true,尝试与FTP服务器协商SSL连接以进行非匿名访问。默认为true。仅当使用ssl / tls库编译lftp时,此设置和其他SSL设置才可用。


1
投票

lftp -c“set ftp:ssl-allow no; debug; open -u root,$ DEPLOY_PASSWORD -p 22 $ DEPLOY_HOST ...”

1,删除set ftp:ssl-allow no;或将其设置为yes

2,你在标题中说“SFTP”并使用端口22;协议SFTP不是FTP,它是一个完全不同的协议;使用它你要使lftp使用带有sftp://协议的URL来使用协议:

lftp -c "debug; open -u root,$DEPLOY_PASSWORD sftp://$DEPLOY_HOST…"
© www.soinside.com 2019 - 2024. All rights reserved.