简体   繁体   English

CircleCI + Gradle + Heroku部署

[英]CircleCI + Gradle + Heroku deployment

I'm trying to provide a continuous deployment with Gradle and Heroku but for some reason, the deployment step is not running. 我正在尝试使用Gradle和Heroku提供连续的部署,但是由于某些原因,部署步骤未运行。

CircleCI Pipeline result CircleCI管道结果 在此处输入图片说明
I've already updated the circle ci with the Heroku key. 我已经用Heroku键更新了ci圆。

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

Could you guys help me, please? 你们能帮我吗? Is the deployment step in the right place? 部署步骤是否在正确的位置?

You are using deployment configuration for CircleCI 1.0 but you are using CircleCI 2.0 . 您正在使用CircleCI 1.0的部署配置,但正在使用CircleCI 2.0

From the documentation for CircleCI 2.0: 从CircleCI 2.0的文档中:

The built-in Heroku integration through the CircleCI UI is not implemented for CircleCI 2.0. CircleCI 2.0未实现通过CircleCI UI内置的Heroku集成。 However, it is possible to deploy to Heroku manually. 但是,可以手动部署到Heroku。

To deploy on heroku with CircleCI 2.0, you need : 要使用CircleCI 2.0在heroku上进行部署,您需要:

  1. add environment variables HEROKU_LOGIN, HEROKU_API_KEY, HEROKU_APP_NAME to your CircleCI project settings https://circleci.com/gh/<account>/<project>/edit#env-vars 将环境变量HEROKU_LOGIN,HEROKU_API_KEY,HEROKU_APP_NAME添加到CircleCI项目设置https://circleci.com/gh/<account>/<project>/edit#env-vars
  2. create a private ssh key without passphrase and add it to your CircleCI project settings https://circleci.com/gh/https://circleci.com/gh/<account>/<project>/edit#ssh for hostname git.heroku.com 创建一个没有密码的ssh私钥,并将其添加到您的CircleCI项目设置https://circleci.com/gh/https://circleci.com/gh/<account>/<project>/edit#ssh用作主机名git。 heroku.com
  3. add steps in the .circleci/config.yml file with the fingerprint of your ssh key 使用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 git@heroku.com:$HEROKU_APP_NAME.git HEAD:refs/heads/master 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM