2017-07-27 67 views
1

我试图提供Gradle和Heroku的连续部署,但由于某些原因,部署步骤未运行。CircleCI + Gradle + Heroku部署

CircleCI Pipeline result enter image description here
我已经更新了关键的Heroku圆词。

version: 2 
jobs: 
    build: 
    docker: 
     - image: circleci/openjdk:8-jdk 

    working_directory: ~/repo 

    environment: 
     JVM_OPTS: -Xmx3200m 
     TERM: dumb 

    steps: 
     - checkout 

     - restore_cache: 
      keys: 
      - v1-dependencies-{{ checksum "build.gradle" }} 
      - v1-dependencies- 

     - run: gradle dependencies 

     - save_cache: 
      paths: 
      - ~/.m2 
      key: v1-dependencies-{{ checksum "build.gradle" }} 

     # run tests! 
     - run: gradle test 
deployment: 
    staging: 
    branch: master 

    heroku: 
     appname: my-heroku-app 

请问你们能帮助我吗?部署步骤是否在正确的位置?

回答

0

您正在使用CircleCI 1.0的部署配置,但是您使用的是CircleCI 2.0

从CircleCI 2.0的文档:

内置集成的Heroku通过CircleCI UI不是 为CircleCI 2.0实现。但是,可以手动部署到 Heroku。

要与CircleCI 2.0在Heroku上部署,您需要:

  1. 添加环境变量HEROKU_LOGIN,HEROKU_API_KEY,HEROKU_APP_NAME您CircleCI项目设置https://circleci.com/gh/<account>/<project>/edit#env-vars
  2. 创建一个没有密码的私人SSH密钥,并将其添加到您的CircleCI项目设置https://circleci.com/gh/https://circleci.com/gh/<account>/<project>/edit#ssh for hostname git.heroku.com
  3. 使用您的ssh密钥的指纹在.circleci/config.yml文件中添加步骤
- run: 
     name: Setup Heroku 
     command: | 
     ssh-keyscan -H heroku.com >> ~/.ssh/known_hosts 
     cat > ~/.netrc << EOF 
     machine api.heroku.com 
      login $HEROKU_LOGIN 
      password $HEROKU_API_KEY 
     EOF 
     cat >> ~/.ssh/config << EOF 
     VerifyHostKeyDNS yes 
     StrictHostKeyChecking no 
     EOF 
    - add_ssh_keys: 
     fingerprints: 
     - "<SSH KEY fingerprint>" 
    - deploy: 
     name: "Deploy to Heroku" 
     command: git push --force [email protected]:$HEROKU_APP_NAME.git HEAD:refs/heads/master