diff --git a/src/kibana/index.html b/src/kibana/index.html
index 124ea3bcfdb5..6daafc059a04 100644
--- a/src/kibana/index.html
+++ b/src/kibana/index.html
@@ -12,6 +12,11 @@
+
diff --git a/src/kibana/index.js b/src/kibana/index.js
index 2e5c70c6fb13..51d565d0faa3 100644
--- a/src/kibana/index.js
+++ b/src/kibana/index.js
@@ -25,11 +25,15 @@ define(function (require) {
kibana
// This stores the Kibana revision number, @REV@ is replaced by grunt.
- .constant('kbnVersion', '@REV@')
+ .constant('kbnVersion', window.KIBANA_VERSION)
+ // The build number is placed by grunt, represents a sequence to provide nothing really but order.
+ .constant('buildNum', window.KIBANA_BUILD_NUM)
+ // This stores the build number, @REV@ is replaced by grunt.
+ .constant('commitSha', window.KIBANA_COMMIT_SHA)
+ // Use this for cache busting partials
+ .constant('cacheBust', window.KIBANA_COMMIT_SHA)
// The minimum Elasticsearch version required to run Kibana
.constant('minimumElasticsearchVersion', '1.4.0.Beta1')
- // Use this for cache busting partials
- .constant('cacheBust', 'cache-bust=' + Date.now())
// When we need to identify the current session of the app, ef shard preference
.constant('sessionId', Date.now())
// attach the route manager's known routes
diff --git a/tasks/build.js b/tasks/build.js
index 97daea41de59..0dee4e4253cf 100644
--- a/tasks/build.js
+++ b/tasks/build.js
@@ -1,5 +1,6 @@
module.exports = function (grunt) {
grunt.registerTask('build', [
+ 'get_build_props',
'clean:target',
'clean:build',
'require_css_deps:copy',
diff --git a/tasks/config/replace.js b/tasks/config/replace.js
index 883f8d9d1710..eb3d327a4e59 100644
--- a/tasks/config/replace.js
+++ b/tasks/config/replace.js
@@ -1,13 +1,16 @@
var join = require('path').join;
module.exports = function (grunt) {
- var pkg = grunt.config.get('pkg');
var build = grunt.config.get('build');
var src = grunt.config.get('src');
+ var app = grunt.config.get('app');
+
var config = {
dist: {
options: {
patterns: [
- { match: 'version', replacement: pkg.version }
+ { match: 'version', replacement: '<%= pkg.version %>' },
+ { match: 'buildNum', replacement: '<%= buildNum %>' },
+ { match: 'commitSha', replacement: '<%= commitSha %>' }
]
},
files: [
@@ -19,6 +22,10 @@ module.exports = function (grunt) {
{
src: [join(src, 'server', 'bin', 'kibana.bat')],
dest: join(build, 'dist', 'kibana', 'bin', 'kibana.bat')
+ },
+ {
+ src: [join(app, 'index.html')],
+ dest: join(build, 'kibana', 'public', 'index.html')
}
]
}
diff --git a/tasks/get_build_props.js b/tasks/get_build_props.js
new file mode 100644
index 000000000000..ec809ab3eaaa
--- /dev/null
+++ b/tasks/get_build_props.js
@@ -0,0 +1,16 @@
+module.exports = function (grunt) {
+ var Promise = require('bluebird');
+ var spawn = require('./utils/spawn');
+
+ grunt.registerTask('get_build_props', function () {
+ Promise.props({
+ sha: spawn.silent('git', ['log', '--format=%H', '-n1'])(),
+ num: spawn.silent('sh', ['-c', 'git log --format="%h" | wc -l'])()
+ })
+ .then(function (props) {
+ grunt.config.set('commitSha', props.sha.trim());
+ grunt.config.set('buildNum', props.num.trim());
+ })
+ .nodeify(this.async());
+ });
+};
\ No newline at end of file