Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport CI scripts to 4.x #7660

Merged
merged 5 commits into from
Jul 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ The task above takes a little time to start the servers. You can also start the
Packages are built using fpm, pleaserun, dpkg, and rpm. fpm and pleaserun can be installed using gem. Package building has only been tested on Linux and is not supported on any other platform.
```sh
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
gem install fpm -v 1.5.0
gem install pleaserun -v 0.0.24
npm run build:ospackages
```

Expand Down
4 changes: 1 addition & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ module.exports = function (grunt) {
switch (require('os').platform()) {
case 'win32':
return 'IE';
case 'darwin':
return 'Chrome';
default:
return 'Firefox';
return 'Chrome';
}
}()),

Expand Down
2 changes: 1 addition & 1 deletion tasks/build/osPackages.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default (grunt) => {
`${buildDir}/=${config.path.home}/`,
`${buildDir}/installedPlugins/.data/=${config.path.data}/`,
`${servicesByName.sysv.outputDir}/etc/=/etc/`,
`${servicesByName.systemd.outputDir}/lib/=/lib/`
`${servicesByName.systemd.outputDir}/etc/=/etc/`
];

//Manually find flags, multiple args without assignment are not entirely parsed
Expand Down
33 changes: 24 additions & 9 deletions tasks/jenkins.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@ import { compact } from 'lodash';
import { delimiter } from 'path';

module.exports = function (grunt) {
grunt.registerTask('jenkins', 'Jenkins build script', function () {
// TODO: remove after migration to new CI is complete
grunt.registerTask('jenkins', compact([
'jenkins:env',
'rejectRejFiles',
'test',
process.env.JOB_NAME === 'kibana_core' ? 'build' : null
]));

grunt.registerTask('jenkins:env', () => {
// make sure JAVA_HOME points to JDK8
const HOME = '/usr/lib/jvm/jdk8';
process.env.JAVA_HOME = HOME;
Expand All @@ -11,15 +19,22 @@ module.exports = function (grunt) {
const path = process.env.PATH.split(delimiter);
path.unshift(`${HOME}/bin`);
process.env.PATH = path.join(delimiter);
});

// always build os packages on jenkins
grunt.option('os-packages', true);
grunt.registerTask('jenkins:unit', [
'jenkins:env',
'rejectRejFiles',

grunt.task.run(compact([
'rejectRejFiles',
'test',
process.env.JOB_NAME === 'kibana_core' ? 'build' : null
]));
});
'eslint:source',
'test:server',
'test:browser',
]);

grunt.registerTask('jenkins:selenium', [
'jenkins:env',
'rejectRejFiles',

'test:ui'
]);

};
39 changes: 39 additions & 0 deletions test/scripts/_jenkins_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -e

###*****###
### CWD ###
###*****###
if [ -n "$WORKSPACE" ]; then
cd "$WORKSPACE"
else
echo 'Unable to find the $WORKSPACE environment variable, is this jenkins?'
exit 1
fi


###*****###
### NVM ###
###*****###
export NVM_DIR="/var/lib/jenkins/.nvm"
NVM_SCRIPT="$NVM_DIR/nvm.sh"
if [ -s "$NVM_SCRIPT" ]; then
. "$NVM_SCRIPT" # load nvm
else
echo "Unable to find the nvm script at \"$NVM_SCRIPT\""
exit 1
fi

nvm install "$(cat .node-version)"

###*****###
### NPM ###
###*****###
npm install


if [ -z "$(npm bin)" ]; then
echo "npm does not know where it stores executables..... huh??"
exit 1
fi
6 changes: 6 additions & 0 deletions test/scripts/jenkins_build_snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e
source "$(dirname $0)/_jenkins_setup.sh"

"$(npm bin)/grunt" build;
6 changes: 6 additions & 0 deletions test/scripts/jenkins_selenium.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e
source "$(dirname $0)/_jenkins_setup.sh"

xvfb-run "$(npm bin)/grunt" jenkins:selenium;
6 changes: 6 additions & 0 deletions test/scripts/jenkins_unit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e
source "$(dirname $0)/_jenkins_setup.sh"

xvfb-run "$(npm bin)/grunt" jenkins:unit;