管道询问答案时如何传递"yes"?
How to pass "yes" when pipeline asks an answer?
我正在尝试将 laravel 应用程序部署到我的服务器。这是我的 gitlab-ci.yml
文件:
image: edbizarro/gitlab-ci-pipeline-php:7.3
stages:
- build
- deploy
# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: username
MYSQL_PASSWORD: password
MYSQL_DATABASE: database
DB_HOST: localhost:3306
PUBLIC_URL: https://example.com
build:
stage: build
tags:
- my-tag
- another-tag
script:
- echo "Building deploy package"
- echo "composer install"
- composer install --optimize-autoloader --no-dev
- mysql --version
- echo "Migrating database"
- php artisan migrate:fresh --seed
- echo "Dumping mysql database"
- mysqldump --host="${DB_HOST}" --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" > db.sql
- php artisan config:cache
- php artisan route:cache
- php artisan view:cache
- echo "Build successful"
artifacts:
expire_in: 1 hour
paths:
- build
deploy_production:
stage: deploy
tags:
- my-tag
- another-tag
script:
- echo "Current Directory:"
- pwd
- ls
- echo "Deploying to server"
- sudo cp -rv build/* /var/www/vhosts/example.com/
- echo "Deployed"
environment:
name: production
url: https://example.com
only:
- master
但它给出了这个错误:
...
$ mysql --version
mysql Ver 15.1 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
$ echo "Migrating database"
Migrating database
$ php artisan migrate:fresh --seed
**************************************
* Application In Production! *
**************************************
Do you really wish to run this command? (yes/no) [no]:
> Command Canceled!
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1
我在 gitlab-runner
上使用 docker。
我该如何处理这个错误?
php artisan
有一个 --no-interaction
标志,您可以使用它,这样它就不会等待交互式用户的“是”。例如:
php artisan migrate:fresh --seed --no-interaction
我正在尝试将 laravel 应用程序部署到我的服务器。这是我的 gitlab-ci.yml
文件:
image: edbizarro/gitlab-ci-pipeline-php:7.3
stages:
- build
- deploy
# Variables
variables:
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: username
MYSQL_PASSWORD: password
MYSQL_DATABASE: database
DB_HOST: localhost:3306
PUBLIC_URL: https://example.com
build:
stage: build
tags:
- my-tag
- another-tag
script:
- echo "Building deploy package"
- echo "composer install"
- composer install --optimize-autoloader --no-dev
- mysql --version
- echo "Migrating database"
- php artisan migrate:fresh --seed
- echo "Dumping mysql database"
- mysqldump --host="${DB_HOST}" --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" "${MYSQL_DATABASE}" > db.sql
- php artisan config:cache
- php artisan route:cache
- php artisan view:cache
- echo "Build successful"
artifacts:
expire_in: 1 hour
paths:
- build
deploy_production:
stage: deploy
tags:
- my-tag
- another-tag
script:
- echo "Current Directory:"
- pwd
- ls
- echo "Deploying to server"
- sudo cp -rv build/* /var/www/vhosts/example.com/
- echo "Deployed"
environment:
name: production
url: https://example.com
only:
- master
但它给出了这个错误:
...
$ mysql --version
mysql Ver 15.1 Distrib 10.3.27-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
$ echo "Migrating database"
Migrating database
$ php artisan migrate:fresh --seed
**************************************
* Application In Production! *
**************************************
Do you really wish to run this command? (yes/no) [no]:
> Command Canceled!
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1
我在 gitlab-runner
上使用 docker。
我该如何处理这个错误?
php artisan
有一个 --no-interaction
标志,您可以使用它,这样它就不会等待交互式用户的“是”。例如:
php artisan migrate:fresh --seed --no-interaction