Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heroku: not found #65

Closed
patrickmead opened this issue Feb 12, 2021 · 5 comments
Closed

heroku: not found #65

patrickmead opened this issue Feb 12, 2021 · 5 comments

Comments

@patrickmead
Copy link

I’m trying to use heroku-deploy. My build fails because heroku is not found. My understanding is that the heroku-cli is preinstalled.

/bin/sh: 1: heroku: not found
Error: Error: Command failed: heroku login

I uninstalled heroku-cli then installed heroku globally via npm. That didn’t work. Then I tried adding heroku to my package.json. That didn’t work.

Any suggestions are greatly appreciated. Thank you.

@AkhileshNS
Copy link
Owner

You're right in that the Heroku Cli should be installed by default. Could you provide your buildlog and workflow file if possible?

@patrickmead
Copy link
Author

Thank you very much, @AkhileshNS

`# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node

For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Dendra API CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
container: node:10.18-jessie
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
strategy:
matrix:
node-version: [14.x]

steps:
# - name: setup ssh
#   uses: webfactory/ssh-agent@v0.4.1
#   with:
#     ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up node.js v${{ matrix.node-version }}
  uses: actions/setup-node@v2
  with:
    node-version: ${{ matrix.node-version }}


- name: Clone Dendra Repo
  uses: actions/checkout@v2

- name: Setup NPM Private Github Packages
  run: |
    echo "@general-galactic:registry=https://npm.pkg.github.com" > .npmrc
    echo "//npm.pkg.github.com/:_authToken=${{secrets.GH_NPM_REGISTRY_TOKEN}}" >> .npmrc
    echo "always-auth=true" >> .npmrc

# - name: Print working directory
#   run: pwd

# - name: Print npm info
#   run: cat .npmrc

# - name: Print env
#   run: env



# - name: git clone a private repo
#   run: git clone --depth=1 -q -b master git://github.com/general-galactic/hapi-swagger.git ./crap && ls ./crap

# - name: npm install from a private github repo
#   run: npm i git://github.com/general-galactic/hapi-swagger && ls node_modules/hapi-swagger

# - name: npm install private github package
#   run: npm i @general-galactic/dendra-jwt && ls node_modules/@general-galactic/dendra-jwt

# - name: verify ssh key works
#   run: ssh -T git@github.com

# - name: Authenticate to Github Package Registry for private NPM modules
#   run: echo "//npm.pkg.github.com/:_authToken=${{secrets.GH_NPM_REGISTRY_TOKEN}}" >> .npmrc

- name: Install Dendra API Dependencies
  # Skiping post-install scripts here, as a malicious script could steal NODE_AUTH_TOKEN.
  # running bcrypt separately since it requires a post-install script
  run: npm ci

- name: Install hapi-swagger
  run: npm i git://github.com/general-galactic/hapi-swagger

- name: Lint Dendra API
  run: npm run lint:ci

- name: Run Tests
  env:
    DATABASE_URL: postgres://postgres:postgres@postgres:5432/dendra-test # the github postgres container chose all the defaults.
  run: npm test

- name: Deploy to Heroku
  uses: akhileshns/heroku-deploy@v3.10.9 
  with:
      heroku_api_key: ${{secrets.HEROKU_API_KEY}}
      heroku_app_name: "dendra-api-stage" 
      heroku_email: "patrick@generalgalactic.io"  
      justlogin: true
      remote_branch: main

- name: Notify Slack Failure
  if: failure()
  env:
    SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
  uses: voxmedia/github-action-slack-notify-build@v1
  with:
    channel: build-updates
    status: Dendra API Build Failed
    color: danger

- name: Notify Slack Success
  if: success()
  env:
    SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
  uses: voxmedia/github-action-slack-notify-build@v1
  with:
    channel: build-updates
    status: SUCCESS
    color: good

`

@patrickmead
Copy link
Author

This is the portion of the build output for the deploy. I can post the rest of the output if this isn't sufficient.

I'm new to GitHub Actions but I have experience with Jenkins and Travis. Perhaps I'm missing something obvious.

Thanks again.

`##[debug]Evaluating condition for step: 'Deploy to Heroku'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Deploy to Heroku
##[debug]Loading inputs
##[debug]Evaluating: secrets.HEROKU_API_KEY
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'HEROKU_API_KEY'
##[debug]=> ''
##[debug]Result: '
'
##[debug]Loading env
Run akhileshns/heroku-deploy@v3.10.9
with:
heroku_api_key: ***
heroku_app_name: dendra-api-stage
heroku_email: patrick@generalgalactic.io
justlogin: true
remote_branch: main
branch: HEAD
dontuseforce: false
dontautocreate: false
usedocker: false
docker_heroku_process_type: web
delay: 0
rollbackonhealthcheckfailed: false
/usr/bin/docker exec d224d0edefcad3d011012710e18d99607e0374004dc00290bba841bf1aa1937a sh -c "cat /etc/*release | grep ^ID"
##[debug]ID=debian
##[debug]Running JavaScript Action with default external tool: node12
Created and wrote to ~/.netrc
/bin/sh: 1: heroku: not found
Error: Error: Command failed: heroku login
/bin/sh: 1: heroku: not found

##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Deploy to Heroku`

@AkhileshNS
Copy link
Owner

I think it might have something to do with you using container: node:10.18-jessie. It's possible that it's because the node: 10.18-jessie image doesn't have heroku installed by default unlike the default ones used in github actions. Can you try adding the following step before the heroku deploy step and see if this works:

- name: Install Heroku Cli
  run: curl https://cli-assets.heroku.com/install-ubuntu.sh | sh

@patrickmead
Copy link
Author

@AkhileshNS
That was it!

My last build ran with login only so I'm actually trying to deploy now.

I truly appreciate your quick reply and the assistance. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants