簡體   English   中英

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

[英].gitlab-ci.yml Gitlab Deploy SFTP Not Working

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

為什么前面的.gitlab-ci.yml產生以下錯誤?

新的失敗->

--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

您已設置ftp:ssl-allow no ,但您正在連接端口 22,這很可能是 SSL 服務。

假設您打算使用 SSL 進行連接。 嘗試: set ftp:ssl-allow true; 作為 lftp 命令的一部分。

lftp 手冊頁指出:

ftp:ssl-allow (boolean) 如果為真,嘗試與 FTP 服務器協商 SSL 連接以進行非匿名訪問。 默認為真。 此設置和其他 SSL 設置僅在 lftp 使用 ssl/tls 庫編譯時才可用。

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

1、刪除set ftp:ssl-allow no; 或將其設置為yes

第二,您在標題中說“SFTP”並使用端口 22; 協議 SFTP不是FTP,它是一個完全不同的協議; 要使用它,您必須通過使用帶有sftp://協議的 URL 使lftp使用該協議:

lftp -c "debug; open -u root,$DEPLOY_PASSWORD sftp://$DEPLOY_HOST…"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM