Browse Source

Merge "Script to easily build a package"

tags/0.2.0
Jenkins 3 years ago
parent
commit
fca2c7e325
3 changed files with 36 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 3
    0
      build-fast
  3. 32
    0
      version-properties.sh

+ 1
- 0
.gitignore View File

@@ -1,3 +1,4 @@
1 1
 /target
2
+/version.properties
2 3
 /work
3 4
 /.config

+ 3
- 0
build-fast View File

@@ -0,0 +1,3 @@
1
+#!/bin/bash -eux
2
+. version-properties.sh
3
+mvn -Dproject-version="$PROJECT_VER" -DskipTests=true  clean package

+ 32
- 0
version-properties.sh View File

@@ -0,0 +1,32 @@
1
+#!/bin/bash -ex
2
+#
3
+# This is a script that helps us version build artifacts.  It retrieves
4
+# git info and generates version strings.
5
+#
6
+# Source:
7
+# http://git.openstack.org/cgit/openstack-infra/project-config/tree/jenkins/scripts/version-properties.sh
8
+#
9
+
10
+# get version info from scm
11
+SCM_TAG=$(git describe --abbrev=0 --tags) || true
12
+SCM_SHA=$(git rev-parse --short HEAD) || true
13
+
14
+# assumes format is like this  '0.0.4-2-g135721c'
15
+COMMITS_SINCE_TAG=$(git describe | awk '{split($0,a,"-"); print a[2]}') || true
16
+
17
+# just use git sha if there is no tag yet.
18
+if [[ "${SCM_TAG}" == "" ]]; then
19
+    SCM_TAG=$SCM_SHA
20
+fi
21
+
22
+# General build version should be something like '0.0.4.3.d4ee90c'
23
+# Release build version should be something like '0.0.5'
24
+if [[ "${COMMITS_SINCE_TAG}" == "" ]]; then
25
+    PROJECT_VER=$SCM_TAG
26
+else
27
+    PROJECT_VER="$SCM_TAG.$COMMITS_SINCE_TAG.$SCM_SHA";
28
+fi
29
+
30
+echo "SCM_SHA=$SCM_SHA" >version.properties
31
+echo "PROJECT_VER=$PROJECT_VER" >>version.properties
32
+echo "COMMITS_SINCE_TAG=$COMMITS_SINCE_TAG" >>version.properties

Loading…
Cancel
Save