Re: Database Change Control Process

From: Freek D'Hooge <freek.dhooge_at_gmail.com>
Date: Thu, 27 Feb 2014 11:37:35 +0100
Message-ID: <1393497455.28211.7.camel_at_dhoogfr-lpt1>



What I do with git is to have a "$$__GITVERSION" keyword in the comments and when making a release (using a script), this version string is then replaced by a generated version number

So, in the make-release script I have a procedure to generate a version string (which also stores it into a version file)

store_version()
{ git update-index -q --refresh
  version="$(git describe HEAD 2>/dev/null)"   if [ -z ${version} ]
  then
    version="$(git rev-parse --short HEAD)"   fi
  if [ -n "$(git diff-index --name-only HEAD --)" ]   then
    version=${version}"-dirty"
  fi
  echo ${version} > ${release_dir}/${release}/version }

And later on in the script, I have a line to search trough all files in that particular release dir and replace the $$_GITVERSION keyword with the generated version string:

find ./${release}/ -type f -print0 | xargs -r -0 sed -i "s/\$\$__GITVERSION/${version}/"

regards,

-- 
Freek D'Hooge
Exitas NV
Senior Oracle DBA
email: freek.dhooge_at_exitas.be
tel +32(03) 443 12 38
http://www.exitas.be 

On wo, 2014-02-26 at 14:30 +0000, Nigel Thomas wrote:

> Git (with suitable configuration) supports the ident attribute, which
> results in $Id...$ being replaced not with a version or revision
> number like CVS or SVN, but with a SHA1 hash of the file (which
> you can then match back to specific file versions). The hash is a
> little less developer friendly than a revision or version number but
> it does aid verification. The issue for database objects is that some
> **** developer may have edited your code in place; so whether you use
> a CVS version, SVN revision or Git hash, you can only truly verify the
> code is valid by comparing it with the authorised version.
>
>
>
> I guess it might at least be feasible to build a package that reads
> from USER_SOURCE (I am thinking mainly about stored routines) and
> calculates the SHA-1 hash; it can compare it with the presented hash
> to ensure the routine hasn't been interfered with. That's something
> you couldn't do so easily with version numbers, especially if the
> version control repository isn't accessible from the database server.
>
>
> See http://stackoverflow.com/questions/1792838/how-do-i-enable-ident-string-for-git-repos
>
>
> Regards Nigel
>
>
>
> On 26 February 2014 14:11, William Robertson
> <william_at_williamrobertson.net> wrote:
>
>
>
> I recently learned that Git does not have this feature, and
> that the whole idea is regarded as somewhat passé by 3GL
> developers who can only conceive of compiling executables from
> a directory structure. I can't find it now but one discussion
> on Stackexchange linked to some comments from Thorvalds about
> how trivial it was to find the version of something without it
> <remainder snipped...>
>
-- http://www.freelists.org/webpage/oracle-l
Received on Thu Feb 27 2014 - 11:37:35 CET

Original text of this message