Recompile Heroku slug without push or config change

后端 未结 8 472
無奈伤痛
無奈伤痛 2020-12-02 04:55

I\'m wondering if there is a way to force Heroku to recompile the slug without pushing new commits and/or updating the config variables.

Why would I want to do this?

相关标签:
8条回答
  • 2020-12-02 05:25

    Update: heroku repo:rebuild has been removed.

    Heroku has a Build API you can use, see: Building and Releasing Using the API


    You can use the repo:rebuild command if the heroku-repo add-on.

    heroku repo:rebuild -a appname
    

    https://github.com/heroku/heroku-repo

    0 讨论(0)
  • 2020-12-02 05:34

    Heroku have release a plugin that what is asked: https://github.com/heroku/heroku-repo

    To install it:

    $ heroku plugins:install heroku-repo
    

    To force a rebuild:

    $ heroku repo:purge_cache -a appname
    $ heroku repo:reset -a appname
    $ git push heroku
    
    0 讨论(0)
  • 2020-12-02 05:36

    The simplest workaround for now is to push an empty commit.

    git commit --allow-empty -m "empty commit"
    git push heroku master
    
    0 讨论(0)
  • 2020-12-02 05:41

    Remove the branch, then re-push it. No need to use a plugin.

    git push heroku :master
    git push heroku master
    
    0 讨论(0)
  • 2020-12-02 05:42

    There is a heroku plugin for this.

    $ heroku plugins:install heroku-releases-retry
    Installing plugin heroku-releases-retry... done
    $ heroku releases:retry
    Retrying v16 on ⬢ murmuring-lowlands-3398... done, v17
    
    0 讨论(0)
  • 2020-12-02 05:44

    My general approach is to do:

    git commit --amend -C HEAD
    git push heroku master -f
    

    Not sure I'd do this in production without being certain, as it does technically rewrite the last commit but it shouldn't cause any issues in theory. It's perfectly fine for when you are testing things in staging though.

    As an added bonus since most people are problem using Vim to edit commit messages SHIFT-ZZ will quickly save and exit the commit message for you without making any changes to it.

    On a related note I'm mildly shocked Heroku still doesn't have this feature. I've often seen Heroku fail to deploy due to problems on their end.

    Thanks to Michael Mior for the idea to use -C HEAD to avoid opening up an editor.

    0 讨论(0)
提交回复
热议问题