简体   繁体   English

GitLab 自动部署到 FTP

[英]GitLab Auto Deploy to FTP

can anyone help me with this error?谁能帮我解决这个错误? I am new to GitLab and still studying things.我是 GitLab 的新手,还在学习。 I think I missed something on this configuration?我想我错过了这个配置的一些东西?

stages:
  - deploy
deploy:
  stage: deploy
  script:
    - apt-get --quiet update --yes
    - apt-get --quiet install --yes lftp
    - lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror -reverse --verbose --delete build/ /FTP/test-deploy --ignore-time --parallel=20"

This is the log这是日志

Running with gitlab-runner 14.6.0 (5316d4ac)
  on dedicated runner Lban3VJA
Preparing the "docker" executor
Using Docker executor with image ruby:2.6 ...
Pulling docker image ruby:2.6 ...
Using docker image sha256:9a2d45e2219e289f367dce5bace14f8f80495038bf16506860e3808d11afe34a for ruby:2.6 with digest ruby@sha256:634a743c2cb4b51cc9d887103c383e70aef4040b0540fa295d7aed9659320c6d ...
Preparing environment 00:00
Running on runner-lban3vja-project-2-concurrent-0 via gitlab...
Getting source from Git repository 00:01
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/root/test-project/.git/
Checking out e5bae75d as main...
Skipping Git submodules setup
Executing "step_script" stage of the job script 00:30
Using docker image sha256:9a2d45e2219e289f367dce5bace14f8f80495038bf16506860e3808d11afe34a for ruby:2.6 with digest ruby@sha256:634a743c2cb4b51cc9d887103c383e70aef4040b0540fa295d7aed9659320c6d ...
$ apt-get --quiet update --yes
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [102 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2592 B]
Fetched 8487 kB in 11s (808 kB/s)
Reading package lists...
$ apt-get --quiet install --yes lftp
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  lftp
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 725 kB of archives.
After this operation, 2309 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 lftp amd64 4.8.4-2+b1 [725 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 725 kB in 17s (42.1 kB/s)
Selecting previously unselected package lftp.
(Reading database ... 22741 files and directories currently installed.)
Preparing to unpack .../lftp_4.8.4-2+b1_amd64.deb ...
Unpacking lftp (4.8.4-2+b1) ...
Setting up lftp (4.8.4-2+b1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
$ lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror --reverse --verbose --delete build/ /FTP/test-deploy --ignore-time --parallel=20"
mirror: Access failed: /builds/root/test-project/build: No such file or directory
ERROR: Job failed: exit code 1

ERROR错误

mirror: Access failed: /builds/root/test-project/build: No such file or directory镜像:访问失败:/builds/root/test-project/build:没有这样的文件或目录

I think I missed something here?我想我在这里错过了什么?

My goal is to transfer every file inside of "test-project" repository.我的目标是传输“测试项目”存储库中的每个文件。

It's not really a Gitlab problem, rather an lftp one:这不是真正的 Gitlab 问题,而是lftp问题:

Access failed: /builds/root/test-project/build: No such file or directory

tells you that there is no build folder inside the current working directory.告诉您当前工作目录中没有build文件夹。 Instead - you want to mirror the contents of the .相反 - 你想镜像. , which is the current working directory and where the gitlab project is already cloned. ,这是当前工作目录,并且 gitlab 项目已被克隆。

So, your lftp should work with something like this:所以,你的lftp应该使用这样的东西:

lftp -c "set ftp:ssl-allow no; open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST; mirror --reverse --verbose --delete ./ /FTP/test-deploy --ignore-time --parallel=20"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM