【问题标题】:Gitlab pipeline fails when using rsync to upload to staging server使用 rsync 上传到登台服务器时,Gitlab 管道失败
【发布时间】:2019-09-26 16:43:32
【问题描述】:

我目前正在使用 Gitlab Pipelines 将所有内容上传到我的服务器。

上传到暂存文件夹的 .gitlab-ci.yml 路径如下:

staging_upload:
  stage: staging
  only:
    refs:
      - develop
      - schedules
  script:
    - sshpass -V
    - sshpass -p '$FTP_PASSWORD' rsync --progress -avz -e ssh . $FTP_USERNAME@$HOST:$PATH

在执行管道时出现以下错误:

Using "assword" as the default password prompt indicator.
$ sshpass -p '$FTP_PASSWORD' rsync --progress -avz -e ssh . $FTP_USERNAME@$HOST:$PATH
sshpass: Failed to run command: No such file or directory

我已经尝试了各种方法,但我们都没有尝试过。 有谁知道这里出了什么问题?

【问题讨论】:

  • “没有这样的文件或目录”响应似乎表明 rsync 并未实际安装在 gitlab 运行器中。

标签: git gitlab-ci pipeline rsync sshpass


【解决方案1】:
  • 希望这个article 有所帮助,我没有使用 rsync 但 scp 应该可以完成这项工作。
  • gitlab 秘密变量可用于 USER_PASS
script:
    - export SSHPASS=$USER_PASS
    - sshpass -e scp -o stricthostkeychecking=no -r directory-to-copy user@host:path-to-copy-files-to

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-20
    • 2016-09-26
    • 2016-07-01
    • 1970-01-01
    • 2020-04-16
    • 2016-04-07
    • 2023-01-29
    相关资源
    最近更新 更多