CircleCI YAML 配置失败
CircleCI YAML config fails
我已经创建了一个 CircleCI 配置,它将 运行 我的 PHPUnit 测试我的 laravel 应用程序并且它正在 100% 工作但是我现在正在尝试添加一个工作流然后 SSH 并部署我的应用程序到 AWS EC2 服务器,我收到以下错误:
Your config file has errors and may not run correctly:
2 schema violations found
required key [jobs] not found
required key [version] not found
但是我看不出我的 CircleCI 配置文件有问题,是我哪里弄错了吗?
version: 2
jobs:
build:
docker:
- image: circleci/php:7.1-browsers
working_directory: ~/laravel
steps:
- checkout
- run:
name: Download NodeJS v6
command: curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
- run:
name: Install SQLite and NodeJS 6
command: sudo apt-get install -y libsqlite3-dev nodejs
- run:
name: Setup Laravel testing environment variables for CircleCI test
command: cp .env.circleci .env
- run:
name: Update composer to latest version
command: composer self-update
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.json" }}
- composer-v1-
- run: composer install -n --prefer-dist --ignore-platform-reqs
- save_cache:
key: composer-v1-{{ checksum "composer.json" }}
paths:
- vendor
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install NodeJS Packages
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Create SQLite Database
command: touch database/database.sqlite
- run:
name: Migrate Laravel Database
command: php artisan migrate --database=sqlite --force
- run:
name: Run NPM
command: npm run production
# Run Laravel Server for front-end tests
- run:
name: Run Laravel Server
command: php artisan serve
background: true
- run:
name: Run PHPUnit Tests
command: vendor/bin/phpunit
deploy:
machine:
enabled: true
steps:
- run:
name: Deploy Over SSH
command: |
ssh $SSH_USER@$SSH_HOST "cd /var/www/html"
workflows:
version: 2
build-and-deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
感谢任何帮助,谢谢!
CircleCI 有 AWS 部署的文档。看这里https://circleci.com/docs/1.0/continuous-deployment-with-aws-codedeploy/
我认为您的问题与 AWS 的 SSH 授权有关。你可以在本地试一下,确保你的授权成功,然后在你的AWS上做同样的事情。
我已经创建了一个 CircleCI 配置,它将 运行 我的 PHPUnit 测试我的 laravel 应用程序并且它正在 100% 工作但是我现在正在尝试添加一个工作流然后 SSH 并部署我的应用程序到 AWS EC2 服务器,我收到以下错误:
Your config file has errors and may not run correctly: 2 schema violations found required key [jobs] not found required key [version] not found
但是我看不出我的 CircleCI 配置文件有问题,是我哪里弄错了吗?
version: 2
jobs:
build:
docker:
- image: circleci/php:7.1-browsers
working_directory: ~/laravel
steps:
- checkout
- run:
name: Download NodeJS v6
command: curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
- run:
name: Install SQLite and NodeJS 6
command: sudo apt-get install -y libsqlite3-dev nodejs
- run:
name: Setup Laravel testing environment variables for CircleCI test
command: cp .env.circleci .env
- run:
name: Update composer to latest version
command: composer self-update
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.json" }}
- composer-v1-
- run: composer install -n --prefer-dist --ignore-platform-reqs
- save_cache:
key: composer-v1-{{ checksum "composer.json" }}
paths:
- vendor
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install NodeJS Packages
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Create SQLite Database
command: touch database/database.sqlite
- run:
name: Migrate Laravel Database
command: php artisan migrate --database=sqlite --force
- run:
name: Run NPM
command: npm run production
# Run Laravel Server for front-end tests
- run:
name: Run Laravel Server
command: php artisan serve
background: true
- run:
name: Run PHPUnit Tests
command: vendor/bin/phpunit
deploy:
machine:
enabled: true
steps:
- run:
name: Deploy Over SSH
command: |
ssh $SSH_USER@$SSH_HOST "cd /var/www/html"
workflows:
version: 2
build-and-deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
感谢任何帮助,谢谢!
CircleCI 有 AWS 部署的文档。看这里https://circleci.com/docs/1.0/continuous-deployment-with-aws-codedeploy/
我认为您的问题与 AWS 的 SSH 授权有关。你可以在本地试一下,确保你的授权成功,然后在你的AWS上做同样的事情。