Ruby on Rails的Heroku和Circle CI 2.0身份验证

时间:2018-07-23 23:08:00

标签: ruby-on-rails heroku circleci

我正在尝试从Circle CI 1.0迁移到2.0,这似乎是一个真正的痛苦。

我对Circle 2.0具有以下配置:

  
      
  • 步骤:

         
        
    • 结帐
    •   
    • 运行:捆绑执行wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh

    •   
    • 运行:heroku scale worker = 0 --app xxxx-yyy

    •   
    • 运行:“ [[!-s \” $(git rev-parse --git-dir)/ shallow \“]] || git fetch --unshallow”

    •   
    • 运行:git push git@heroku.com:xxxx-yyy.git $ CIRCLE_SHA1:refs / heads / master
    •   
    • 运行:heroku运行rake db:migrate --app xxxx-yyy
    •   
  •   

在大多数情况下,它都有效。它将通过以下命令-但是,当与Heroku进行交互时,我会收到以下错误消息:

  

缩放测功...!    ▸无效的凭证    ▸提供。   heroku:输入您的登录凭据   电子邮件:扩展测功...!    ▸无效的凭证    ▸提供。   输入您的Heroku凭据:   电子邮件:

这很奇怪,因为在1.0分支上,我可以扩展Heroku并运行db:migrate,而无需任何其他配置。

有人对此有任何建议吗?

1 个答案:

答案 0 :(得分:1)

1.0和2.0的CircleCI文档都表明他们希望您正在配置Heroku API密钥:

2.0说明的摘录:

Add the name of your Heroku application and your Heroku API key as environment variables. See Adding Project Environment Variables for instructions. In this example, these variables are defined as HEROKU_APP_NAME and HEROKU_API_KEY, respectively. ... git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master

来源:https://circleci.com/docs/2.0/deployment-integrations/#heroku

我个人还使用了SSH密钥,但是使用API​​密钥方法看起来非常明确和直接。