mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge pull request #7317 from epixa/newbuild
Apply -snapshot suffix during build task
This commit is contained in:
commit
dbfee59b66
19 changed files with 72 additions and 64 deletions
|
@ -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.
|
||||

|
||||
|
||||
`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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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()));
|
||||
});
|
||||
};
|
|
@ -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'
|
||||
]));
|
||||
});
|
||||
|
|
|
@ -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/`
|
||||
];
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
15
tasks/config/build.js
Normal file
15
tasks/config/build.js
Normal file
|
@ -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`;
|
||||
}
|
|
@ -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]}`;
|
||||
|
|
|
@ -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}`;
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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 });
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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'
|
||||
]);
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue