e-merlin/eMERLIN_CASA_pipeline

Adding version numbers

Closed this issue · 1 comments

It would be nice to introduce version numbers to the pipeline, through the releases functionality in Github. In this way, users can report version along any problems which simplifies bugfixing.

It would be nice to have the version in the log. Without release versions, one way to do this is to read the latest commit ID from the repo. This however only works if the users checked out the pipeline with git, i.e. not if downloading as zipfile. And if the user has git installed. If these requirements are satisfied, then it is possible to write it to log using the following command. (Now assuming the the script was run using the casa -c and not using execfile within casa)

import subprocess
repoversion = subprocess.check_output(['git', '--git-dir=' + pipeline_path + '/.git', 'rev-parse', 'HEAD'])
logger.info('Starting pipeline version ' + repoversion)

The optimal way to handle version numbers should probably be to use releases instead, and hence I'm only putting this here as a note while we're investigating the releases route.

Solved by b3f7f84. It includes branch name and last commit to the log produced by the pipeline. It uses information in the .git folder.

Eskil will investigate adding hooks when commiting. If that is a robust way and, it does not need the commiter to do anything special, we will use it by default.