Giter Club home page Giter Club logo

heroku-orb's Introduction

Heroku Orb

CircleCI Build Status CircleCI Orb Version GitHub License CircleCI Community

Effortlessly deploy your application to Heroku from CircleCI. Installs the Heroku CLI and provides commands to login, create an app, deploy, and more.


Resources

CircleCI Orb Registry Page - The official registry page of this orb for all versions, executors, commands, and jobs described.

CircleCI Orb Docs - Docs for using, creating, and publishing CircleCI Orbs.

How to Contribute

We welcome issues to and pull requests against this repository!

How to Publish An Update

  1. Merge pull requests with desired changes to the main branch.
  2. Find the current version of the orb.
    • You can run circleci orb info circleci/heroku | grep "Latest" to see the current version.
  3. Create a new Release on GitHub.
    • Click "Choose a tag" and create a new semantically versioned tag. (ex: v1.0.0)
      • We will have an opportunity to change this before we publish if needed after the next step.
  4. Click "+ Auto-generate release notes".
    • This will create a summary of all of the merged pull requests since the previous release.
    • If you have used Conventional Commit Messages it will be easy to determine what types of changes were made, allowing you to ensure the correct version tag is being published.
  5. Now ensure the version tag selected is semantically accurate based on the changes included.
  6. Click "Publish Release".
    • This will push a new tag and trigger your publishing pipeline on CircleCI.

heroku-orb's People

Contributors

a14m avatar brivu avatar campbecf avatar dsayling avatar jaryt avatar kyletryon avatar levent avatar lokst avatar orangegrove1955 avatar remmelt avatar ryanfb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-orb's Issues

Downgrade resource_class or make it configurable in jobs

Is your feature request related to a problem? Please describe.
circleci/heroku jobs are unnecessarily expensive. The jobs don't set a resource_class, so they default to the Large resource class. This results in high compute credit usage.
The jobs provided by this orb are practically entirely network-bound and use very little cpu/memory. They could easily run on a Small resource class.

Describe the solution you'd like
The orb's executor should have a resource_class field set to small.

Describe alternatives you've considered
The resource_class could be made configurable, such as in the circleci/aws-ecr orb, but there's really no point since no jobs in this orb are cpu or memory bound.
Alternatively, I could rewrite the entire orb so that I can specify the resource_class, but that doesn't feel like the right solution here.

Allow local changes to be uploaded

Is your feature request related to a problem? Please describe.
Stumbled upon https://discuss.circleci.com/t/deploying-circleci-changes-to-heroku-using-git/25210/5 which described my issue: how to deploy to Heroku local changes using CircleCI.

Describe the solution you'd like
New job/command to allow local changes to be pushed to Heroku

Describe alternatives you've considered
Use dpl (like Travis does, it's public gem), which allows local modifications to be deployed to Heroku.

Last stable version: https://github.com/travis-ci/dpl/tree/v1#heroku (without skip_cleanup, local changes are stashed)

dpl --provider=heroku --strategy=api --app=$HEROKU_APP_NAME --api_key=$HEROKU_API_KEY --skip_cleanup=true

Beta: https://github.com/travis-ci/dpl#heroku-api (cleanup is optin)

dpl heroku api --app=$HEROKU_APP_NAME --api_key=$HEROKU_API_KEY

The configuration is the same as the current deploy-via-git job/command (API KEY and APP NAME)

New Feature: "Review App"

Is your feature request related to a problem? Please describe.
A new feature from Heroku was released
https://devcenter.heroku.com/articles/github-integration-review-apps

Review apps run the code in any GitHub pull request in a complete, disposable Heroku app. Review apps each have a unique URL you can share, making them a great way to propose, test, and merge changes to your code base.

Describe the solution you'd like
Add a command and a job to initiate a "review" on Heroku via the API.

Describe alternatives you've considered
N/A

Additional context
Provided by @nbialostosky

Example:

- run: | 
     curl -n -X POST 'https://api.heroku.com/review-apps' \
      -d '{
      "branch": "${CIRCLE_BRANCH}",
      "pipeline": "01234567-89ab-cdef-0123-456789abcdef",
      "source_blob": {
        "url": "https://example.com/source.tgz?token=xyz",
        "version": "v1.2.0"
      }
    }' \
      -H "Content-Type: application/json" \
      -H "Accept: application/vnd.heroku+json; version=3"
      -H "Authorization: Bearer ${HEROKU_TOKEN}"

Does this Orb require any changes to work with DockerHub auth?

Describe Request:

When DockerHub starts rate limiting anonymous requests on Nov 1st, it looks like this Orb will be impacted, since there's no auth key in the docker config. It looks like a standard pattern is to expect DOCKERHUB_USERNAME/DOCKERHUB_PASSWORD environment variables (see example), will this (or something equivalent) be required for this Orb?

Examples:

https://discuss.circleci.com/t/updated-authenticate-with-docker-to-avoid-impact-of-nov-1st-rate-limits/37567/35

Deployment with tags

Orb Version
1.0.1

Describe the bug

When using a tag to trigger a deployment the deploy-via-git command fails with the following message:

#!/bin/bash -eo pipefail
if false;then
  force="-f"
fi
git push $force https://heroku:[email protected]/$HEROKU_APP_NAME.git $CIRCLE_BRANCH:master
remote: 
remote: !	Push rejected, cannot delete master branch        
remote: 
To https://git.heroku.com/example.git
 ! [remote rejected]     master (pre-receive hook declined)
error: failed to push some refs to 'https://heroku:************************************@git.heroku.com/example.git'
Exited with code exit status 1
CircleCI received exit code 1

To Reproduce

Trigger a deployment via a tag.

Expected behavior

Should deploy the tag.

Additional context

I believe this has to do with the CIRCLE_TAG variable being set but not CIRCLE_BRANCH ?

Heroku Orb environment spin up error

Brought over from: CircleCI-Archived/circleci-orbs#281 after I realized it was moved to this new repo

Orb version

[email protected]

What happened

I kept getting an error when trying to do the deployment During the "Spin up Environment"

Build-agent version 1.0.26573-ff13bd88 (2020-01-30T20:25:39+0000)
Docker Engine Version: 18.09.6
Kernel Version: Linux d9e1f5589e45 4.15.0-1052-aws #54-Ubuntu SMP Tue Oct 1 15:43:26 UTC 2019 x86_64 Linux
Starting container cimg:base/stable
  image cache not found on this host, downloading cimg:base/stable

invalid reference format

Expected behavior

Ideally it should spin up the environment, I was able to get past this by manually setting the executor to be:

docker:
      - image: buildpack-deps:bionic

instead of

executor: heroku/default

It seems as if it is wrongly setting the base container to cimg:base/stable when it should be cimg/base:stable

How to override force flag?

I want to set force flag to true.

Docs do not mention the Env variable to set the force flag.
If possible please guide me.
I am new to circle ci and orbs.

Deploy via git timing out even though deploy succeeds

Orb Version
1.2.6

Describe the bug

We're seeing the deploy-via-git command provided by this orb sometimes fail because of a timeout even though the deploy has already succeeded.

We see the deploy appear successfully in Heroku before the timeout completes.

For example, for one build deploy-via-git command ran from 11:52:33 UTC to 12:10:22 UTC
From the Heroku console I can see the deploy completed successfully at 12:00:21 UTC - 10 minutes before the timeout.

Example output from a failed build:

[SNIP]
remote: -----> Discovering process types        
remote:        Procfile declares types -> [SNIP]
remote: 
remote: -----> Compressing...        
remote:        Done: [SNIP]        
remote: -----> Launching...        
remote:  !     Release command declared: this new release will not be available until the command succeeds.        
remote:        Released [SNIP]        
remote:        [SNIP] deployed to Heroku        
remote: 
remote: This app is using the Heroku-18 stack, which is supported until April 30th, 2023.        
remote: A newer stack is available: Heroku-20. To upgrade, see:        
remote: https://devcenter.heroku.com/articles/upgrading-to-the-latest-stack        
remote: 

Too long with no output (exceeded 10m0s): context deadline exceeded

To Reproduce

This is intermittent, we noticed in in 3 out of our 4 deploys this morning.

Expected behavior

The orb command completes successfully

Additional context

I'm not sure if this problem is due to a problem with the Orb or Heroku.
I've not seen any issue on Heroku's status page, and the build is reported as succeeded on Heroku's console which makes me think it's the Orb. I'd be interested in hearing from anyone else who has seen this issue (with our without using the Heroku Orb)

push-docker-image does not work either as a job or as a command

Orb Version
1.2.2

Describe the bug
First, I tried to use the heroku/push-docker-image job, and it failed in the "Login to Heroku Docker image registry" step with error:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
 ▸    Login failed with: 1

Some Googling revealed that this is caused by a missing setup_remote_docker step, so I tried my own job with that step included before the heroku/push-docker-image command. This time it failed at "Push Docker image to Heroku" with:

#!/bin/bash -eo pipefail
heroku container:push -a $HEROKU_APP_NAME \

web

 ▸    Error: Requires either
 ▸    --recursive or one or
 ▸    more process types


Exited with code exit status 1

CircleCI received exit code 1

There appears to be an extra linefeed (or a missing backslash) in the command.

To Reproduce
Set up a CircleCI project following my public GitHub repo at https://github.com/markku63/mooc-wepa-20-projekti
Define the HEROKU_APP_NAME and HEROKU_API_KEY environment variables.

Expected behavior
The project builds and deploys to Heroku.

Additional context

Sunsetting Heroku Deploy Hooks

Is your feature request related to a problem? Please describe.
I love the ease of this orb & we use it with our CI heroku deploys. I read recently that heroku is sunsetting the deploy hooks https://blog.heroku.com/deployhooks-sunset & they are being replaced with webhooks - https://devcenter.heroku.com/articles/app-webhooks

Describe the solution you'd like
I'd love to see this incorporated into the ORB before the EOL of deploy hooks so we can keep using it

Describe alternatives you've considered
If there are no plans to incorporate the new webhooks, I'd love to know so we can migrate off of this orb

Publishing process fails due to bad test

Orb Version
2.0.0

Describe the bug
During the publishing process, tests are re-ran prior to publish. This triggers different behavior in the integration-test-deploy job from heroku which will push to a tag rather than a branch, in the presence of a branch. Previously we did not use tag based deployments, so this was not a concern.

Since orb tools 11 though, this now means we will attempt to push a tag to our sample project on heroku (which is not this project), which does not exist, causing a failure.

This will block deployments.

To Reproduce

https://app.circleci.com/pipelines/github/CircleCI-Public/heroku-orb/161/workflows/1e70cea6-81cc-4692-a8f2-bbc44c1cbaed/jobs/706

Expected behavior

We may need to suppress this test on publish or find an alternative solution.

Additional context

Requires further investigation.

deploy-via-git bash script error

Orb Version

1.2.0

Describe the bug
Getting an error with bash script

/bin/bash: line 4: heroku_url: command not found

Exited with code exit status 127

I think the heroku_url has some unwanted whitespace around the = sign, so it is being treated as a command instead of as a variable assignment.

To Reproduce

I'm using this orb via CircleCI, here is my configuration:

  deploy-production:
    executor: heroku/default
    environment:
      HEROKU_APP_NAME: <our app name>
    steps:
      - checkout
      - heroku/deploy-via-git:
          force: true
          branch: HEAD

Expected behavior

No errors when executing bash script.

Additional context

We were able to successfully deploy this morning with the previous version of the bash script:

#!/bin/bash -eo pipefail
if true;then
  force="-f"
fi
git push $force https://heroku:[email protected]/$HEROKU_APP_NAME.git HEAD:master

Typo on Tag deploy prevents it from deploying

Looks to be a typo when deploying via tag which alters the tag being pushed, preventing it from actually working at all

To Reproduce

  1. try and deploy a tag

Expected behavior
It deploys the tagged version

Examples use pre/post deploy hooks

Is your feature request related to a problem? Please describe.
We currently use the commands individually because we need to execute a migration after we deploy. It would be nice if there was an example of running heroku run rake db:migrate --app <<app_name>> as a post deploy hook. I'd imagine a lot of people automatically execute migrations as part of staging deploys.

Describe the solution you'd like
Some more usage examples

Describe alternatives you've considered
We currently manually do this by executing the individual commands from the orb.

how to enter a directory to deploy?

how can i enter the backend directory to commit there on heroku?

version: 2.1
orbs:
  # node: circleci/[email protected]
  heroku: circleci/[email protected]
jobs:
  deploy:
    executor: heroku/default
    steps:
      - checkout
      - heroku/install
      - run:
          command: cd backend
      - heroku/deploy-via-git
workflows:
  heroku_deploy:
    jobs:
      - deploy

Correct title for release command

Currently the release command says "Push Docker image to Heroku", which is more descriptive of the push command.

Should be titled "Release Docker image to Heroku" instead.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.