![](/img/trans.png)
[英]gitlab-runner on windows in docker fails to run with wrong OSType error
[英]GitLab-runner fails to finish successfully due to “No such file or directory” error
我正在使用 laravel-deployer package 在我的服務器上部署我的項目。 我有以下gitlab-ci
文件:
stages:
- build
- test
- deploy
image: lorisleiva/laravel-docker:7.4
.init_ssh: &init_ssh |
eval $(ssh-agent -s)
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keyscan yourdomain.com >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
.change_file_permissions: &change_file_permissions |
find . -type f -not -path "./vendor/*" -exec chmod 664 {} \;
find . -type d -not -path "./vendor/*" -exec chmod 775 {} \;
composer:
stage: build
script:
- composer install --prefer-dist --no-ansi --no-interaction --no-progress
- cp .env.production .env
- php artisan key:generate
artifacts:
expire_in: 1 month
paths:
- vendor/
- .env
cache:
key: ${CI_COMMIT_REF_SLUG}-composer
paths:
- vendor/
npm:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}-npm
paths:
- node_modules/
script:
- npm install
- npm run production
artifacts:
expire_in: 1 month
paths:
- node_modules/
- public/css/
- public/js/
production:
stage: deploy
script:
- *init_ssh
- *change_file_permissions
- cp .env.production .env
- pwd
- hostname
- php artisan deploy yourdomain.com -s upload
- cd /var/www/yourdomain.com/current
- cp /var/www/yourdomain.com/current/.env.production /var/www/yourdomain.com/shared/.env
- npm install
- npm run production
environment:
name: production
url: http://yourdomain.com
when: manual
only:
- master
它主要部署 laravel 網站,刪除以前的版本,復制新版本並更改其權限,以便 Nginx 可讀。 所有步驟均已正確執行,但在完成並出現以下錯誤后總是失敗:
✔
➤ Executing task artisan:migrate
✔
➤ Executing task deploy:symlink
✔
➤ Executing task deploy:unlock
✔
➤ Executing task cleanup
✔
➤ Executing task fpm:reload
✔
🚀 Successfully deployed in 16.63s
$ cd /var/www/yourdomain.com/current
/bin/bash: line 127: cd: /var/www/yourdomain.com/current: No such file or directory
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1
即使管道正常工作,我也無法獲得通過報告徽章,這讓我很煩惱。
利用
npm install /var/www/yourdomain.com/current --verbose
npm run production --prefix /var/www/yourdomain.com/current
以避免該錯誤。 並刪除“cd”命令。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.