已安装 rsync 时未找到 rsync 命令

rsync command not found while rsync already installed

我是 AWS 和一般管道的新手。 我试图使用 bitbucket 管道将 Next.js 应用程序部署到 EC2 AWS (ubuntu)。但是,管道因 bash: rsync: command not found.

而失败

pipeline failed due to rsync command not found

我用谷歌搜索了几天并尝试了一些解决方案,但其中 none 帮助我解决了管道问题。我检查了远程机器上的 rsync,它已经安装好了。我也尝试重新安装了几次。

rsync is already installed on the remote machine

我还重新检查了我的存储库 SSH 私钥(来自 .pem 文件的密钥)和 public 密钥(来自我的远程计算机 .ssh / authorized_key 的密钥)所以我100%确定这部分没有错误

至于主机地址,我使用的是来自我的 AWS 实例的 Public IPv4 地址。

对于存储库变量,我已经检查过,并且在将它与管道文件中的变量进行比较后确定没有任何问题。

my bitbucket repository variables

here is my pipeline file

至于你的笔记,我试过使用 --rsync-path=/usr/bin/rsync,但没有任何改变。

如果有人可以帮助我理解为什么会发生这种情况并解决这个问题,我将不胜感激。

我发现我的管道是导致问题的原因,我已经将 get-apt 更新和 get-apt install -y rsync(获取更新步骤)与部署最新版本分开步骤.

所以解决方案就是将获取更新步骤合并到部署步骤。

- apt-get update -y # update apt
- apt-get install -y rsync # install rsync
- apt-cache search rsync # check if apt can find rsync
- rsync -avzrut --delete-delay --exclude='.git' . $SSH_USER@$SSH_HOST_DEV:$SSH_PATH