Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Capture svn info / git commit on deploy modules #441

Closed
rlouapre opened this issue May 15, 2015 · 4 comments
Closed

Capture svn info / git commit on deploy modules #441

rlouapre opened this issue May 15, 2015 · 4 comments

Comments

@rlouapre
Copy link
Contributor

I end up writing these 2 extensions for that purpose:
For svn:

  alias_method :original_deploy_modules, :deploy_modules
  def deploy_modules()
    modulesRoot = @properties["ml.xquery.dir"]
    svn_info_file = File.new("#{modulesRoot}/svn-info.xml", "w")
    svn_info_file.puts(`svn info --xml`)
    svn_info_file.close
    original_deploy_modules
  end

For git:

  alias_method :original_deploy_modules, :deploy_modules
  def deploy_modules()
    modulesRoot = @properties["ml.xquery.dir"]
    git_info_file = File.new("#{modulesRoot}/git-info.xml", "w")
    git_info_file.puts(`git log -1 --pretty=format:"<entry><id>%H</id><author>%an</author><date>%ai</date><subject>%s</subject><body>%b</body></entry>"`)
    git_info_file.close
  end
@rlouapre rlouapre changed the title Capture svn info / git commit on deploy module Capture svn info / git commit on deploy modules May 15, 2015
@grtjn
Copy link
Contributor

grtjn commented May 15, 2015

Interesting. How do you use that info?

I think we could integrate this, and potentially auto-detect svn or git. Maybe add a toggle to activate it.

ml.add-code-info=true/false

@rlouapre
Copy link
Contributor Author

It is essentially used during development phase when deploy modules are very frequent and unfortunately manual for some customers.
It help them to be able to tell what revision they are currently using (from qconsole).
It could even be exposed as REST endpoint and output it in ErrorLog.txt

@dmcassel
Copy link
Collaborator

Looks like you could do something like:

git rev-parse HEAD

getting the current commit hash, then add that to the repo. That does not indicate whether the repo has any uncommitted modifications, but it's something.

@grtjn grtjn added this to the 1.7.3 milestone Jul 8, 2015
dmcassel added a commit that referenced this issue Aug 25, 2015
Fixed #441: allowed saving commit info in src
@dmcassel
Copy link
Collaborator

fixed in dev

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

No branches or pull requests

3 participants