我想使用Gitlab管道部署到ftp服务器。我试过这个代码:
deploy: // You can name your task however you like
stage: deploy
only:
- master
deploy:
script:
- apt-get update -qq && apt-get install -y -qq lftp但我收到一条错误信息。做这件事最好的方法是什么?
发布于 2018-04-03 15:24:17
明白了:)
image: mwienk/docker-git-ftp
deploy_all:
stage: deploy
script:
- git config git-ftp.url "ftp://xx.nl:21/web/new.xxx.nl/public_html"
- git config git-ftp.password "xxx"
- git config git-ftp.user "xxxx"
- git ftp init
#- git ftp push -m "Add new content"
only:
- master发布于 2018-11-19 10:53:18
然后在..gitlab ci.yml文件中添加以下代码。
variables:
HOST: "example.com"
USERNAME: "yourUserNameHere"
PASSWORD: "yourPasswordHere"
deploy:
script:
- apt-get update -qq && apt-get install -y -qq lftp
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rnev ./ ./public_html --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
only:
- master上面的代码将把Gitlab存储库中所有最近修改的文件推入public_html服务器根目录中的文件夹中。
只要用FTP凭证更新变量主机、用户名和密码,并将该文件提交到Gitlab存储库,就可以了。
现在,每当您在主分支中进行更改时,Gitlab将自动将您的更改推送到远程FTP服务器。
发布于 2018-04-03 14:35:02
尝尝这个。在Gitlab中有一个CI Lint工具,它有助于格式化错误。linter显示了一个错误,即附加部署语句。
deploy:
stage: deploy
only:
- master
script:
- apt-get update -qq && apt-get install -y -qq lftphttps://stackoverflow.com/questions/49632077
复制相似问题