diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1305577cff46f..1dfc15573980d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,7 +113,7 @@ Once that is complete just run: ``` sh -npm run test && npm run build +npm run test && npm run build -- --skip-os-packages ``` #### Debugging unit tests @@ -121,27 +121,27 @@ npm run test && npm run build The standard `npm run test` task runs several sub tasks and can take several minutes to complete, making debugging failures pretty painful. In order to ease the pain specialized tasks provide alternate methods for running the tests. -`npm run test:quick` +`npm run test:quick` Runs both server and browser tests, but skips linting -`npm run test:server` +`npm run test:server` Run only the server tests -`npm run test:browser` +`npm run test:browser` Run only the browser tests. Coverage reports are available for browser tests by running `npm run test:coverage`. You can find the results under the `coverage/` directory that will be created upon completion. -`npm run test:dev` -Initializes an environment for debugging the browser tests. Includes an dedicated instance of the kibana server for building the test bundle, and a karma server. When running this task the build is optimized for the first time and then a karma-owned instance of the browser is opened. Click the "debug" button to open a new tab that executes the unit tests. +`npm run test:dev` +Initializes an environment for debugging the browser tests. Includes an dedicated instance of the kibana server for building the test bundle, and a karma server. When running this task the build is optimized for the first time and then a karma-owned instance of the browser is opened. Click the "debug" button to open a new tab that executes the unit tests. ![Browser test debugging](http://i.imgur.com/DwHxgfq.png) -`npm run mocha [test file or dir]` or `npm run mocha:debug [test file or dir]` +`npm run mocha [test file or dir]` or `npm run mocha:debug [test file or dir]` Run a one off test with the local project version of mocha, babel compilation, and optional debugging. Great for development and fixing individual tests. #### Unit testing plugins This should work super if you're using the [Kibana plugin generator](https://github.com/elastic/generator-kibana-plugin). If you're not using the generator, well, you're on your own. We suggest you look at how the generator works. -`npm run test:dev -- --kbnServer.testsBundle.pluginId=some_special_plugin --kbnServer.plugin-path=../some_special_plugin` +`npm run test:dev -- --kbnServer.testsBundle.pluginId=some_special_plugin --kbnServer.plugin-path=../some_special_plugin` Run the tests for just your particular plugin. Assuming you plugin lives outside of the `installedPlugins directory`, which it should. #### Running browser automation tests: @@ -151,13 +151,13 @@ Run the tests for just your particular plugin. Assuming you plugin lives outside The following will start Kibana, Elasticsearch and Selenium for you. To run the functional UI tests use the following commands -`npm run test:ui` +`npm run test:ui` Run the functional UI tests one time and exit. This is used by the CI systems and is great for quickly checking that things pass. It is essentially a combination of the next two tasks. -`npm run test:ui:server` +`npm run test:ui:server` Start the server required for the `test:ui:runner` tasks. Once the server is started `test:ui:runner` can be run multiple times without waiting for the server to start. -`npm run test:ui:runner` +`npm run test:ui:runner` Execute the front-end selenium tests. This requires the server started by the `test:ui:server` task. ##### If you already have ElasticSearch, Kibana, and Selenium Server running: @@ -187,12 +187,12 @@ Packages are built using fpm, pleaserun, dpkg, and rpm. fpm and pleaserun can b apt-get install ruby-dev rpm gem install fpm -v 1.5.0 # required by pleaserun 0.0.16 gem install pleaserun -v 0.0.16 # higher versions fail at the moment -npm run build:ospackages +npm run build -- --skip-archives ``` To specify a package to build you can add `rpm` or `deb` as an argument. ```sh -npm run build:ospackages -- --rpm +npm run build -- --rpm ``` Distributable packages can be found in `target/` after the build completes. diff --git a/Gruntfile.js b/Gruntfile.js index 3fef79398e4fe..d6fa1c8a13819 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,7 +9,7 @@ module.exports = function (grunt) { pkg: grunt.file.readJSON('package.json'), root: __dirname, src: __dirname + '/src', - build: __dirname + '/build', // temporary build directory + buildDir: __dirname + '/build', // temporary build directory plugins: __dirname + '/src/plugins', server: __dirname + '/src/server', target: __dirname + '/target', // location of the compressed build targets @@ -69,6 +69,9 @@ module.exports = function (grunt) { grunt.config.merge(config); + // must run before even services/platforms + grunt.config.set('build', require('./tasks/config/build')(grunt)); + config.packageScriptsDir = __dirname + '/tasks/build/package_scripts'; // ensure that these run first, other configs need them config.services = require('./tasks/config/services')(grunt); diff --git a/README.md b/README.md index 113d563f58592..aba972f854b3d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Kibana 5.0.0-snapshot +# Kibana 5.0.0 Kibana is an open source ([Apache Licensed](https://github.com/elastic/kibana/blob/master/LICENSE.md)), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elasticsearch. diff --git a/package.json b/package.json index f1b6f338368a6..68b3a4542d782 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dashboarding" ], "private": false, - "version": "5.0.0-snapshot", + "version": "5.0.0", "build": { "number": 8467, "sha": "6cb7fec4e154faa0a4a3fee4b33dfef91b9870d9" @@ -48,7 +48,6 @@ "test:server": "grunt test:server", "test:coverage": "grunt test:coverage", "build": "grunt build", - "build:ospackages": "grunt build --os-packages", "start": "sh ./bin/kibana --dev", "precommit": "grunt precommit", "karma": "karma start", diff --git a/src/plugins/status_page/public/status_page.html b/src/plugins/status_page/public/status_page.html index 09ef885ac32c4..c0ae2fa404f07 100644 --- a/src/plugins/status_page/public/status_page.html +++ b/src/plugins/status_page/public/status_page.html @@ -1,8 +1,8 @@ -
+

- Status: {{ ui.serverStateMessage }} - + Status: {{ ui.serverStateMessage }} + {{ ui.name }} @@ -15,27 +15,29 @@

-
-

Installed Plugins

-
+
+

Status Breakdown

+ +
-

- No plugin status information available +

+ No status information available

- +
- - + - - - + + + diff --git a/src/plugins/status_page/public/status_page.js b/src/plugins/status_page/public/status_page.js index 2fc65f299b803..05c0ad1b1b226 100644 --- a/src/plugins/status_page/public/status_page.js +++ b/src/plugins/status_page/public/status_page.js @@ -28,9 +28,10 @@ const chrome = require('ui/chrome') const data = resp.data; ui.metrics = data.metrics; - ui.statuses = data.status.statuses; ui.name = data.name; + ui.statuses = data.status.statuses; + const overall = data.status.overall; if (!ui.serverState || (ui.serverState !== overall.state)) { ui.serverState = overall.state; diff --git a/src/plugins/status_page/public/status_page.less b/src/plugins/status_page/public/status_page.less index c18e5a3ad8c32..d82736de72784 100644 --- a/src/plugins/status_page/public/status_page.less +++ b/src/plugins/status_page/public/status_page.less @@ -5,9 +5,9 @@ @status-metric-border: #aaa; @status-metric-title-color: #666; -@status-plugins-bg: #fff; -@status-plugins-border: #bbb; -@status-plugins-headings-color: #666; +@status-statuses-bg: #fff; +@status-statuses-border: #bbb; +@status-statuses-headings-color: #666; @status-default: #7c7c7c; @status-green: #94c63d; @@ -58,13 +58,13 @@ } } -// plugin status table section -.plugin_status_wrapper { +// status status table section +.statuses_wrapper { margin-top: 25px; margin-left: -5px; margin-right: -5px; border-top:2px solid; - background-color: @status-plugins-bg; + background-color: @status-statuses-bg; padding: 10px; h3 { @@ -72,33 +72,34 @@ margin-bottom: 3px; } - .missing_statuses, - .loading_statuses { + .statuses_loading, + .statuses_missing { padding: 20px; text-align: center; } - .plugin_status_breakdown { + .statuses { margin-left: 0; margin-right: 0; + margin-bottom: 30px; - .status_row { + .status { height:30px; line-height:30px; border-bottom:1px solid; - border-bottom-color: @status-plugins-border; + border-bottom-color: @status-statuses-border; } th { - color:@status-plugins-headings-color; + color:@status-statuses-headings-color; font-weight: normal; height:25px; line-height:25px; border-bottom:1px solid; - border-bottom-color: @status-plugins-border; + border-bottom-color: @status-statuses-border; } - .status_name { + .status_id { padding:0px 5px; border-left: 2px solid; } @@ -111,17 +112,17 @@ } } -//plugin state -.plugin_state(@color, @icon) { - .plugin_state_color { +//status state +.status_state(@color, @icon) { + .status_state_color { color: @color; } - .plugin_state_icon:before { + .status_state_icon:before { content: @icon; } - .status_name { + .status_id { border-left-color: @color !important; } @@ -130,49 +131,49 @@ } } -.plugin_state_default { - .plugin_state(@status-default, @icon-default); +.status_state_default { + .status_state(@status-default, @icon-default); } -.plugin_state_green { - .plugin_state(@status-green, @icon-green); +.status_state_green { + .status_state(@status-green, @icon-green); } -.plugin_state_yellow { - .plugin_state(@status-yellow, @icon-yellow); +.status_state_yellow { + .status_state(@status-yellow, @icon-yellow); } -.plugin_state_red { - .plugin_state(@status-red, @icon-red); +.status_state_red { + .status_state(@status-red, @icon-red); } //server state .state(@color, @icon) { - .state_color { + .overall_state_color { color: @color; } - .state_icon:before { + .overall_state_icon:before { content: @icon; } - .plugin_status_wrapper { + .statuses_wrapper { border-top-color: @color; } } -.state_default { +.overall_state_default { .state(@status-default, @icon-default); } -.state_green { +.overall_state_green { .state(@status-green, @icon-green); } -.state_yellow { +.overall_state_yellow { .state(@status-yellow, @icon-yellow); } -.state_red { +.overall_state_red { .state(@status-red, @icon-red); } diff --git a/src/server/plugins/plugin.js b/src/server/plugins/plugin.js index 9b805f0c411b4..877ff2d887bb8 100644 --- a/src/server/plugins/plugin.js +++ b/src/server/plugins/plugin.js @@ -127,7 +127,7 @@ module.exports = class Plugin { server.exposeStaticDir(`/plugins/${id}/{path*}`, this.publicDir); } - this.status = kbnServer.status.create(this); + this.status = kbnServer.status.createForPlugin(this); server.expose('status', this.status); return await attempt(this.externalInit, [server, options], this); diff --git a/src/server/status/__tests__/server_status.js b/src/server/status/__tests__/server_status.js index 6c3b627c6981a..3d08250fbf81f 100644 --- a/src/server/status/__tests__/server_status.js +++ b/src/server/status/__tests__/server_status.js @@ -1,4 +1,4 @@ -import _ from 'lodash'; +import { find } from 'lodash'; import expect from 'expect.js'; import sinon from 'sinon'; @@ -17,31 +17,63 @@ describe('ServerStatus class', function () { serverStatus = new ServerStatus(server); }); - describe('#create(plugin)', function () { + describe('#create(id)', () => { + it('should create a new plugin with an id', () => { + const status = serverStatus.create('someid'); + expect(status).to.be.a(Status); + }); + }); + + describe('#createForPlugin(plugin)', function () { it('should create a new status by plugin', function () { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); expect(status).to.be.a(Status); }); }); - describe('#get(name)', function () { - it('exposes plugins by its id/name', function () { - let status = serverStatus.create(plugin); - expect(serverStatus.get('name')).to.be(status); + describe('#get(id)', () => { + it('exposes statuses by their id', () => { + const status = serverStatus.create('statusid'); + expect(serverStatus.get('statusid')).to.be(status); + }); + + it('does not get the status for a plugin', () => { + serverStatus.createForPlugin(plugin); + expect(serverStatus.get(plugin)).to.be(undefined); + }); + }); + + describe('#getForPluginId(plugin)', function () { + it('exposes plugin status for the plugin', function () { + let status = serverStatus.createForPlugin(plugin); + expect(serverStatus.getForPluginId(plugin.id)).to.be(status); + }); + + it('does not get plain statuses by their id', function () { + serverStatus.create('someid'); + expect(serverStatus.getForPluginId('someid')).to.be(undefined); + }); + }); + + describe('#getState(id)', function () { + it('should expose the state of a status by id', function () { + let status = serverStatus.create('someid'); + status.green(); + expect(serverStatus.getState('someid')).to.be('green'); }); }); - describe('#getState(name)', function () { - it('should expose the state of the plugin by name', function () { - let status = serverStatus.create(plugin); + describe('#getStateForPluginId(plugin)', function () { + it('should expose the state of a plugin by id', function () { + let status = serverStatus.createForPlugin(plugin); status.green(); - expect(serverStatus.getState('name')).to.be('green'); + expect(serverStatus.getStateForPluginId(plugin.id)).to.be('green'); }); }); describe('#overall()', function () { it('considers each status to produce a summary', function () { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); expect(serverStatus.overall().state).to.be('uninitialized'); @@ -69,25 +101,24 @@ describe('ServerStatus class', function () { it('serializes to overall status and individuals', function () { const pluginOne = {id: 'one', version: '1.0.0'}; const pluginTwo = {id: 'two', version: '2.0.0'}; - const pluginThree = {id: 'three', version: '3.0.0'}; - let one = serverStatus.create(pluginOne); - let two = serverStatus.create(pluginTwo); - let three = serverStatus.create(pluginThree); + let service = serverStatus.create('some service'); + let p1 = serverStatus.createForPlugin(pluginOne); + let p2 = serverStatus.createForPlugin(pluginTwo); - one.green(); - two.yellow(); - three.red(); + service.green(); + p1.yellow(); + p2.red(); - let obj = JSON.parse(JSON.stringify(serverStatus)); - expect(obj).to.have.property('overall'); - expect(obj.overall.state).to.eql(serverStatus.overall().state); - expect(obj.statuses).to.have.length(3); + let json = JSON.parse(JSON.stringify(serverStatus)); + expect(json).to.have.property('overall'); + expect(json.overall.state).to.eql(serverStatus.overall().state); + expect(json.statuses).to.have.length(3); - let outs = _.indexBy(obj.statuses, 'name'); - expect(outs.one).to.have.property('state', 'green'); - expect(outs.two).to.have.property('state', 'yellow'); - expect(outs.three).to.have.property('state', 'red'); + const out = status => find(json.statuses, { id: status.id }); + expect(out(service)).to.have.property('state', 'green'); + expect(out(p1)).to.have.property('state', 'yellow'); + expect(out(p2)).to.have.property('state', 'red'); }); }); diff --git a/src/server/status/__tests__/status.js b/src/server/status/__tests__/status.js index eafeb9f2f7fc6..ae8e419089628 100644 --- a/src/server/status/__tests__/status.js +++ b/src/server/status/__tests__/status.js @@ -15,11 +15,11 @@ describe('Status class', function () { }); it('should have an "uninitialized" state initially', function () { - expect(serverStatus.create(plugin)).to.have.property('state', 'uninitialized'); + expect(serverStatus.createForPlugin(plugin)).to.have.property('state', 'uninitialized'); }); it('emits change when the status is set', function (done) { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); status.once('change', function (prev, prevMsg) { expect(status.state).to.be('green'); @@ -42,7 +42,7 @@ describe('Status class', function () { }); it('should only trigger the change listener when something changes', function () { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); let stub = sinon.stub(); status.on('change', stub); status.green('Ready'); @@ -52,18 +52,17 @@ describe('Status class', function () { }); it('should create a JSON representation of the status', function () { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); status.green('Ready'); let json = status.toJSON(); - expect(json.name).to.eql(plugin.id); - expect(json.version).to.eql(plugin.version); + expect(json.id).to.eql(status.id); expect(json.state).to.eql('green'); expect(json.message).to.eql('Ready'); }); it('should call on handler if status is already matched', function (done) { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); let msg = 'Test Ready'; status.green(msg); @@ -77,7 +76,7 @@ describe('Status class', function () { }); it('should call once handler if status is already matched', function (done) { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); let msg = 'Test Ready'; status.green(msg); @@ -92,7 +91,7 @@ describe('Status class', function () { function testState(color) { it(`should change the state to ${color} when #${color}() is called`, function () { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); let message = 'testing ' + color; status[color](message); expect(status).to.have.property('state', color); @@ -100,7 +99,7 @@ describe('Status class', function () { }); it(`should trigger the "change" listner when #${color}() is called`, function (done) { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); let message = 'testing ' + color; status.on('change', function (prev, prevMsg) { expect(status.state).to.be(color); @@ -114,7 +113,7 @@ describe('Status class', function () { }); it(`should trigger the "${color}" listner when #${color}() is called`, function (done) { - let status = serverStatus.create(plugin); + let status = serverStatus.createForPlugin(plugin); let message = 'testing ' + color; status.on(color, function (prev, prevMsg) { expect(status.state).to.be(color); diff --git a/src/server/status/server_status.js b/src/server/status/server_status.js index 99cc6e69fb7a0..e292a41da0c47 100644 --- a/src/server/status/server_status.js +++ b/src/server/status/server_status.js @@ -9,8 +9,16 @@ module.exports = class ServerStatus { this._created = {}; } - create(plugin) { - return (this._created[plugin.id] = new Status(plugin, this.server)); + create(id) { + const status = new Status(id, this.server); + this._created[status.id] = status; + return status; + } + + createForPlugin(plugin) { + const status = this.create(`plugin:${plugin.id}@${plugin.version}`); + status.plugin = plugin; + return status; } each(fn) { @@ -22,12 +30,26 @@ module.exports = class ServerStatus { }); } - get(name) { - return this._created[name]; + get(id) { + return this._created[id]; + } + + getForPluginId(pluginId) { + return _.find(this._created, s => + s.plugin && s.plugin.id === pluginId + ); + } + + getState(id) { + const status = this.get(id); + if (!status) return undefined; + return status.state || 'uninitialized'; } - getState(name) { - return _.get(this._created, [name, 'state'], 'uninitialized'); + getStateForPluginId(pluginId) { + const status = this.getForPluginId(pluginId); + if (!status) return undefined; + return status.state || 'uninitialized'; } overall() { diff --git a/src/server/status/status.js b/src/server/status/status.js index e19278e6e7884..2aefc1fff1d8f 100644 --- a/src/server/status/status.js +++ b/src/server/status/status.js @@ -3,18 +3,26 @@ import states from './states'; import { EventEmitter } from 'events'; class Status extends EventEmitter { - constructor(plugin, server) { + constructor(id, server) { super(); - this.plugin = plugin; + if (!id || typeof id !== 'string') { + throw new TypeError('Status constructor requires an `id` string'); + } + + this.id = id; this.since = new Date(); this.state = 'uninitialized'; this.message = 'uninitialized'; this.on('change', function (previous, previousMsg) { this.since = new Date(); - let tags = ['status', `plugin:${this.plugin.toString()}`]; - tags.push(this.state === 'red' ? 'error' : 'info'); + + const tags = [ + 'status', + this.id, + this.state === 'red' ? 'error' : 'info' + ]; server.log(tags, { tmpl: 'Status changed from <%= prevState %> to <%= state %><%= message ? " - " + message : "" %>', @@ -28,8 +36,7 @@ class Status extends EventEmitter { toJSON() { return { - name: this.plugin.id, - version: this.plugin.version, + id: this.id, state: this.state, icon: states.get(this.state).icon, message: this.message, diff --git a/tasks/build/get_props.js b/tasks/build/get_props.js deleted file mode 100644 index 458139b7df9d8..0000000000000 --- a/tasks/build/get_props.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = function (grunt) { - var exec = require('child_process').execSync; - grunt.registerTask('_build:getProps', function () { - grunt.config.set('buildSha', String(exec('git rev-parse HEAD')).trim()); - grunt.config.set('buildNum', parseFloat(String(exec('git log --format="%h" | wc -l')).trim())); - }); -}; diff --git a/tasks/build/index.js b/tasks/build/index.js index 6a5ea09914a96..c01f2bca396a3 100644 --- a/tasks/build/index.js +++ b/tasks/build/index.js @@ -3,7 +3,6 @@ module.exports = function (grunt) { grunt.registerTask('build', 'Build packages', function () { grunt.task.run(flatten([ - '_build:getProps', 'clean:build', 'clean:target', '_build:downloadNodeBuilds:start', @@ -23,11 +22,11 @@ module.exports = function (grunt) { '_build:downloadNodeBuilds:finish', '_build:versionedLinks', '_build:osShellScripts', - '_build:archives', - grunt.option('os-packages') ? [ + grunt.option('skip-archives') ? [] : ['_build:archives'], + grunt.option('skip-os-packages') ? [] : [ '_build:pleaseRun', '_build:osPackages', - ] : [], + ], '_build:shasums' ])); }); diff --git a/tasks/build/os_packages.js b/tasks/build/os_packages.js index 87c5b83a58136..8b3d9ed8cfb7d 100644 --- a/tasks/build/os_packages.js +++ b/tasks/build/os_packages.js @@ -3,14 +3,16 @@ import { indexBy } from 'lodash'; import exec from '../utils/exec'; export default (grunt) => { - const targetDir = grunt.config.get('target'); + const { config } = grunt; + const exec = require('../utils/exec'); + const targetDir = config.get('target'); const packageScriptsDir = grunt.config.get('packageScriptsDir'); - const servicesByName = indexBy(grunt.config.get('services'), 'name'); - const config = grunt.config.get('packages'); + const servicesByName = indexBy(config.get('services'), 'name'); + const packages = config.get('packages'); const fpm = args => exec('fpm', args); grunt.registerTask('_build:osPackages', function () { - grunt.config.get('platforms') + config.get('platforms') .filter(({ name }) => /linux-x(86|64)$/.test(name)) .map(({ name, buildDir }) => { const architecture = /x64$/.test(name) ? 'x86_64' : 'i386'; @@ -25,25 +27,25 @@ export default (grunt) => { '--package', targetDir, '-s', 'dir', // input type '--architecture', architecture, - '--name', config.name, - '--description', config.description, - '--version', config.version, - '--url', config.site, - '--vendor', config.vendor, - '--maintainer', config.maintainer, - '--license', config.license, + '--name', packages.name, + '--description', packages.description, + '--version', packages.version, + '--url', packages.site, + '--vendor', packages.vendor, + '--maintainer', packages.maintainer, + '--license', packages.license, '--after-install', resolve(packageScriptsDir, 'post_install.sh'), '--before-install', resolve(packageScriptsDir, 'pre_install.sh'), '--before-remove', resolve(packageScriptsDir, 'pre_remove.sh'), '--after-remove', resolve(packageScriptsDir, 'post_remove.sh'), - '--config-files', config.path.kibanaConfig, - '--template-value', `user=${config.user}`, - '--template-value', `group=${config.group}`, - '--template-value', `optimizeDir=${config.path.home}/optimize`, + '--config-files', packages.path.kibanaConfig, + '--template-value', `user=${packages.user}`, + '--template-value', `group=${packages.group}`, + '--template-value', `optimizeDir=${packages.path.home}/optimize`, //config folder is moved to path.conf, exclude {path.home}/config //uses relative path to --prefix, strip the leading / - '--exclude', `${config.path.home.slice(1)}/config` + '--exclude', `${packages.path.home.slice(1)}/config` ]; const debOptions = [ '-t', 'deb', @@ -54,8 +56,8 @@ export default (grunt) => { '--rpm-os', 'linux' ]; const args = [ - `${buildDir}/=${config.path.home}/`, - `${buildDir}/config/=${config.path.conf}/`, + `${buildDir}/=${packages.path.home}/`, + `${buildDir}/config/=${packages.path.conf}/`, `${servicesByName.sysv.outputDir}/etc/=/etc/`, `${servicesByName.systemd.outputDir}/lib/=/lib/` ]; diff --git a/tasks/build/package_json.js b/tasks/build/package_json.js index 3f61e724033d6..a9038a2dd6d5b 100644 --- a/tasks/build/package_json.js +++ b/tasks/build/package_json.js @@ -5,6 +5,7 @@ module.exports = function (grunt) { let deepModules = grunt.config.get('deepModules'); grunt.registerTask('_build:packageJson', function () { + const { sha, number, version } = grunt.config.get('build'); grunt.file.write( 'build/kibana/package.json', @@ -12,10 +13,10 @@ module.exports = function (grunt) { name: pkg.name, description: pkg.description, keywords: pkg.keywords, - version: pkg.version, + version, build: { - number: grunt.config.get('buildNum'), - sha: grunt.config.get('buildSha') + number, + sha }, repository: pkg.repository, engines: { diff --git a/tasks/build/shasums.js b/tasks/build/shasums.js index 5d1df98b7f27b..cb0b405c2ad2c 100644 --- a/tasks/build/shasums.js +++ b/tasks/build/shasums.js @@ -8,6 +8,9 @@ module.exports = function (grunt) { grunt.registerTask('_build:shasums', function () { var targetDir = grunt.config.get('target'); + // for when shasums is run but archives and ospackages was not + grunt.file.mkdir(targetDir); + readdir(targetDir) .map(function (archive) { // only sha the archives and packages diff --git a/tasks/build/versioned_links.js b/tasks/build/versioned_links.js index 449321bd009ad..876c977fe2132 100644 --- a/tasks/build/versioned_links.js +++ b/tasks/build/versioned_links.js @@ -12,10 +12,7 @@ module.exports = function (grunt) { return resolve(rootPath, file); }); - //We don't want to build os packages with symlinks - let transferFiles = (source, link) => grunt.option('os-packages') - ? exec('cp', ['-r', source, link]) - : exec('ln', ['-s', source, link]); + let transferFiles = (source, link) => exec('cp', ['-r', source, link]); grunt.config.get('platforms').forEach(function (platform) { grunt.file.mkdir(platform.buildDir); diff --git a/tasks/config/build.js b/tasks/config/build.js new file mode 100644 index 0000000000000..c1778cd4dbf8e --- /dev/null +++ b/tasks/config/build.js @@ -0,0 +1,15 @@ +import { execSync as exec } from 'child_process'; + +export default (grunt) => { + const pkgVersion = grunt.config.get('pkg.version'); + + const sha = String(exec('git rev-parse HEAD')).trim(); + const number = parseFloat(String(exec('git log --format="%h" | wc -l')).trim()); + const version = buildVersion(grunt.option('release'), pkgVersion); + + return { sha, number, version }; +}; + +function buildVersion(isRelease, version) { + return isRelease ? version : `${version}-snapshot`; +} diff --git a/tasks/config/packages.js b/tasks/config/packages.js index 1c847168b33cd..98ce8a16094c5 100644 --- a/tasks/config/packages.js +++ b/tasks/config/packages.js @@ -1,5 +1,5 @@ export default (grunt) => { - const VERSION = grunt.config.get('pkg.version'); + const VERSION = grunt.config.get('build.version'); const FOLDER_STAGING = `kibana/staging/${VERSION.match(/\d\.\d\.\d/)[0]}-XXXXXXX/repos/${VERSION.match(/\d\./)[0]}x`; const FOLDER_PRODUCTION = `kibana/${VERSION.match(/\d\.\d/)[0]}`; diff --git a/tasks/config/platforms.js b/tasks/config/platforms.js index 4a39f1b7dcc32..2874f0d894957 100644 --- a/tasks/config/platforms.js +++ b/tasks/config/platforms.js @@ -1,7 +1,7 @@ module.exports = function (grunt) { let { resolve } = require('path'); - let version = grunt.config.get('pkg.version'); + let { version } = grunt.config.get('build'); let nodeVersion = grunt.config.get('nodeVersion'); let rootPath = grunt.config.get('root'); let baseUri = `https://nodejs.org/dist/v${nodeVersion}`; diff --git a/tasks/jenkins.js b/tasks/jenkins.js index 141f8084a9ec3..3b198b8c2acc5 100644 --- a/tasks/jenkins.js +++ b/tasks/jenkins.js @@ -12,9 +12,6 @@ module.exports = function (grunt) { path.unshift(`${HOME}/bin`); process.env.PATH = path.join(delimiter); - // always build os packages on jenkins - grunt.option('os-packages', true); - grunt.task.run(compact([ 'rejectRejFiles', 'test', diff --git a/tasks/rebuild/confirm.js b/tasks/rebuild/confirm.js index 9a4c6b310f4af..5ece1bce93b8a 100644 --- a/tasks/rebuild/confirm.js +++ b/tasks/rebuild/confirm.js @@ -6,8 +6,8 @@ import { createInterface } from 'readline'; export default (grunt) => { grunt.registerTask('_rebuild:confirm', function () { const newVersion = grunt.option('buildversion') || grunt.config.get('pkg').version; - const newBuildNum = grunt.option('buildnum') || grunt.config.get('buildNum'); - const newSha = grunt.option('buildsha') || grunt.config.get('buildSha'); + const newBuildNum = grunt.option('buildnum') || grunt.config.get('build.number'); + const newSha = grunt.option('buildsha') || grunt.config.get('build.sha'); grunt.config('rebuild', { newVersion, newBuildNum, newSha }); diff --git a/tasks/rebuild/create_archives.js b/tasks/rebuild/create_archives.js index 1593f66facaa6..852e3b52e666b 100644 --- a/tasks/rebuild/create_archives.js +++ b/tasks/rebuild/create_archives.js @@ -3,7 +3,7 @@ import { join } from 'path'; export default (grunt) => { grunt.registerTask('_rebuild:createArchives', function () { - const buildDir = grunt.config.get('build'); + const buildDir = grunt.config.get('buildDir'); const targetDir = grunt.config.get('target'); grunt.file.mkdir('target'); diff --git a/tasks/rebuild/extract_zips.js b/tasks/rebuild/extract_zips.js index 497c1ec148c49..fdd02601ad6e6 100644 --- a/tasks/rebuild/extract_zips.js +++ b/tasks/rebuild/extract_zips.js @@ -2,7 +2,7 @@ import { execFileSync } from 'child_process'; export default (grunt) => { grunt.registerTask('_rebuild:extractZips', function () { - const buildDir = grunt.config.get('build'); + const buildDir = grunt.config.get('buildDir'); const targetDir = grunt.config.get('target'); const zips = grunt.file.expand({ cwd: targetDir }, '*.zip'); diff --git a/tasks/rebuild/index.js b/tasks/rebuild/index.js index d6d73b01bbb61..4e382c06a5cc6 100644 --- a/tasks/rebuild/index.js +++ b/tasks/rebuild/index.js @@ -20,7 +20,6 @@ import { trim } from 'lodash'; export default (grunt) => { grunt.registerTask('rebuild', 'Rebuilds targets as a new version', function () { grunt.task.run([ - '_build:getProps', '_rebuild:confirm', '_rebuild:continue' ]); diff --git a/tasks/rebuild/update_builds.js b/tasks/rebuild/update_builds.js index d9a3a64caef23..afe4177804f52 100644 --- a/tasks/rebuild/update_builds.js +++ b/tasks/rebuild/update_builds.js @@ -4,7 +4,7 @@ import { join } from 'path'; export default (grunt) => { grunt.registerTask('_rebuild:updateBuilds', function () { - const buildDir = grunt.config.get('build'); + const buildDir = grunt.config.get('buildDir'); const { newVersion, newBuildNum, newSha } = grunt.config.get('rebuild'); diff --git a/test/functional/status_page/index.js b/test/functional/status_page/index.js index 5a813e632c89e..8d601df8a7454 100644 --- a/test/functional/status_page/index.js +++ b/test/functional/status_page/index.js @@ -14,12 +14,11 @@ bdd.describe('status page', function () { var self = this; return common.tryForTime(6000, function () { - return self.remote - .findByCssSelector('.plugin_status_breakdown') + return common.findTestSubject('statusBreakdown') .getVisibleText() .then(function (text) { common.saveScreenshot('Status'); - expect(text.indexOf('kibana 1.0.0 Ready')).to.be.above(-1); + expect(text.indexOf('plugin:kibana')).to.be.above(-1); }); }) .catch(common.handleError(self));
NameVersionID Status
{{status.name}}{{status.version}}
{{status.id}} - + {{status.message}}