From c648720d55cb0f732007acab0252a3119bc6a160 Mon Sep 17 00:00:00 2001
From: MJB <mjb@it-innovation.soton.ac.uk>
Date: Mon, 26 Mar 2018 22:29:18 +0100
Subject: [PATCH] commit ref name test

---
 .githooks/post-commit | 10 +++++++---
 .gitlab-ci.yml        |  6 ++++--
 setup.py              |  6 ++----
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/.githooks/post-commit b/.githooks/post-commit
index fffb01b..cbe7852 100644
--- a/.githooks/post-commit
+++ b/.githooks/post-commit
@@ -1,4 +1,8 @@
 #!/bin/bash
-mkdir .build-config
-git rev-list --count integration > .build-config/git-commit-count
-git describe --all --long > .build-config/git-commit-version
\ No newline at end of file
+
+mkdir -p .build-config
+
+CI_COMMIT_REF_NAME=`git rev-parse --abbrev-ref HEAD`
+CI_COMMIT_SHA=`git rev-parse HEAD`
+
+echo $CI_COMMIT_REF_NAME"-"$CI_COMMIT_SHA > .build-config/git-commit-ref
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e728047..012667d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,13 +1,15 @@
 variables:
-  TEST_PACKAGE_NAME: clmctest-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHA.tar.gz
+  TEST_PACKAGE_NAME: clmctest-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHA-.tar.gz
 
 stages:  
   - build
   - test
-    
+
 build:tests:
   stage: build
   script:
+    - mkdir -p .build-config
+    - echo CI_COMMIT_REF_NAME-$CI_COMMIT_SHA > ./build-config/git-commit-ref  
     - python setup.py sdist --dist-dir=build
     - echo $TEST_PACKAGE_NAME
 
diff --git a/setup.py b/setup.py
index 7eb4dc6..ebec626 100644
--- a/setup.py
+++ b/setup.py
@@ -6,14 +6,12 @@ def read(fname):
 
 setup(
     name = "clmctest",
-    #version = read('.build-config/git-commit-version'),
-    version = "SNAPSHOT",
+    version = read('.build-config/git-commit-ref'),
     author = "Michael Boniface",
     author_email = "mjb@it-innovation.soton.ac.uk",
     description = "FLAME CLMC Testing Module",
     license = "license",
-    keywords = "example documentation",
-    url = "http://packages.python.org/an_example_pypi_project",
+    keywords = "FLAME CLMC test",
     packages=find_packages(exclude=["services"]),
     include_package_data=True,
     package_data={'': ['*.yml', '*.sh']},        
-- 
GitLab