Skip to content

Heroku release version sometimes inaccurate  #563

@nfm

Description

@nfm

Related to #377.

It looks like ENV['HEROKU_SLUG_COMMIT'] is only available for git-push based deploys. We used to use git-push to deploy, and switched to Heroku's Pipelines feature several months ago. The HEROKU_SLUG_COMMIT environment variable remains present, but is set to a very old value - the last SHA that we deployed via git-push.

I couldn't find another environment variable that Heroku supplies that contains the SHA from a Pipeline deploy. However, heroku labs:enable runtime-dyno-metadata writes this metadata to /etc/heroku/dyno (see https://github.com/heroku/fix/blob/6c8ab7a/lib/heroku_dyno_metadata.rb).

There might be a better way to do this, I'm not sure - this was the only solution I could find!

Would you be open to a PR that read the metadata from this file first, then fell back to HEROKU_SLUG_COMMIT, and finally to git rev-parse --short HEAD?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions