mitre / heimdall-mongo

A Mongo-based version of Heimdall (Deprecated)
Other
11 stars 1 forks source link

Added a version controller and used proper ruby gems to gather data. #103

Open aaronlippold opened 5 years ago

aaronlippold commented 5 years ago

I wanted to use rugged here as it is a fully cross platform solution with zero deps but still had to use the git gem due to above FR I put in at rugged.

Fixes #95

Signed-off-by: Aaron Lippold lippold@gmail.com

aaronlippold commented 5 years ago

Yes I was thinking about that last night. I think you're right. I think the only thing we can do is manage it via a file. With perhaps a rake task. I think it would be safe to get the branch and perhaps the sha that was built from. I think in the final production build we don't actually have the get database so we'll have to pull and write the information during the build process.

On Mon, Apr 22, 2019, 8:09 AM Robert Clark notifications@github.com wrote:

@rbclark commented on this pull request.

In config/initializers/version.rb https://github.com/mitre/heimdall/pull/103#discussion_r277274477:

+# config/initializers/version.rb + +if Rails.env.development?

  • we will hae to use both the git and rugged gem until

  • rugged implaments git describe

  • g = Git.open(Rails.root)
  • repo = Rugged::Repository.discover(Rails.root)
  • version = {
  • version: g.describe,
  • branch: repo.head.name.split('/').last,
  • sha: repo.head.target_id
  • }
  • File.open('config/VERSION','w') do |f|
  • f.write(JSON.pretty_generate(version))

I'm not quite sure this will work as intended. It actually might be completely impossible to add a version in this manner since adding the version to the hash itself will change what the hash should be. Also, any squashes or merges done on Github will all have the wrong SHA since rails is not run on those. Heroku used to provide a SOURCE_VERSION ENV but is seems they have removed it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mitre/heimdall/pull/103#pullrequestreview-229040983, or mute the thread https://github.com/notifications/unsubscribe-auth/AALK42AQAGDL67SBEWF4AKDPRWTHDANCNFSM4HHNB5WQ .