CircleCI YAML配置失败

时间:2018-06-08 10:41:35

标签: laravel circleci circleci-2.0 circleci-workflows

我已经创建了一个CircleCI配置,它将对我的laravel应用程序运行我的PHPUnit测试,并且100%工作但是我现在尝试添加工作流然后SSH并将我的应用程序部署到AWS EC2服务器并且我得到了以下错误:

  

您的配置文件有错误,可能无法正常运行:   发现2个架构违规    找不到所需的密钥[作业]    未找到所需的密钥[版本]

但是我看不到我的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

感谢任何帮助,谢谢!

1 个答案:

答案 0 :(得分:0)

CircleCI拥有AWS部署的文档。看这里https://circleci.com/docs/1.0/continuous-deployment-with-aws-codedeploy/

我认为您的问题在于AWS的SSH授权。您可以在本地尝试并确保您的授权成功,然后对您的AWS执行相同的操作。