mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Backport PR #6676
--------- **Commit 1:** [build] sha1 packages * Original sha:ac2ae334fc
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-09T21:03:09Z **Commit 2:** [build] Build i386 * Original sha:b0dd6706d5
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-09T21:40:16Z **Commit 3:** [build] Set group kibana * Original sha:5b3e178976
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-09T21:54:30Z **Commit 4:** [build] Add rpm, deb name and path * Original sha:6041ff8852
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-09T22:45:55Z **Commit 5:** [build] Add tasks for publishing rpm, deb packages * Original sha:cde84ecb9a
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-10T23:35:56Z **Commit 6:** [build] Rename publish to publishPackages * Original sha:da942d2f62
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-03-29T14:32:18Z **Commit 7:** [build] Move signing config to a file * Original sha:51e8633a4d
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-04-22T20:02:53Z **Commit 8:** [build] Pass env variables to rpm-s3 * Original sha:86269bca6d
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-04-22T20:12:29Z **Commit 9:** [build] Keep process env variables, re-add done * Original sha:f3cd91a0d0
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-04-27T22:23:13Z
This commit is contained in:
parent
296f76a831
commit
5bfa4be5cd
7 changed files with 154 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
|||
.aws-config.json
|
||||
.signing-config.json
|
||||
.DS_Store
|
||||
.node_binaries
|
||||
node_modules
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = function (grunt) {
|
|||
// TODO(sissel): Check if `fpm` is available
|
||||
if (!(/linux-x(86|64)$/.test(name))) return;
|
||||
|
||||
const arch = /x64$/.test(name) ? 'x86_64' : 'i686';
|
||||
const arch = /x64$/.test(name) ? 'x86_64' : 'i386';
|
||||
const fpm = args => exec('fpm', args);
|
||||
|
||||
const args = [
|
||||
|
|
|
@ -16,6 +16,7 @@ module.exports = function createServices(grunt) {
|
|||
'--install-prefix', service.outputDir,
|
||||
'--overwrite',
|
||||
'--user', 'kibana',
|
||||
'--group', 'kibana',
|
||||
'--sysv-log-path', '/var/log/kibana/',
|
||||
'-p', service.name,
|
||||
'-v', service.version,
|
||||
|
@ -25,6 +26,6 @@ module.exports = function createServices(grunt) {
|
|||
|
||||
grunt.file.mkdir(userScriptsDir);
|
||||
exec('please-manage-user', ['--output', userScriptsDir, 'kibana']);
|
||||
appendFileSync(resolve(userScriptsDir, 'installer.sh'), 'chown kibana /opt/kibana/optimize');
|
||||
appendFileSync(resolve(userScriptsDir, 'installer.sh'), 'chown kibana:kibana /opt/kibana/optimize');
|
||||
});
|
||||
};
|
||||
|
|
|
@ -8,8 +8,8 @@ module.exports = function (grunt) {
|
|||
|
||||
readdir(targetDir)
|
||||
.map(function (archive) {
|
||||
// only sha the archives
|
||||
if (!archive.match(/\.zip$|\.tar.gz$/)) return;
|
||||
// only sha the archives and packages
|
||||
if (!archive.match(/\.zip$|\.tar.gz$|\.deb$|\.rpm$/)) return;
|
||||
|
||||
return exec('shasum ' + archive + ' > ' + archive + '.sha1.txt', {
|
||||
cwd: targetDir
|
||||
|
|
20
tasks/config/packages.js
Normal file
20
tasks/config/packages.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
export default (grunt) => {
|
||||
const version = grunt.config.get('pkg.version');
|
||||
const productionPath = `kibana/${version.match(/\d\.\d/)[0]}`;
|
||||
const stagingPath = `kibana/staging/${version.match(/\d\.\d\.\d/)[0]}-XXXXXXX/repos/${version.match(/\d\./)[0]}x`;
|
||||
const rpmFolder = 'centos';
|
||||
const debFolder = 'debian';
|
||||
|
||||
return {
|
||||
staging: {
|
||||
bucket: 'download.elasticsearch.org',
|
||||
debPrefix: `${stagingPath}/${debFolder}`,
|
||||
rpmPrefix: `${stagingPath}/${rpmFolder}`
|
||||
},
|
||||
production: {
|
||||
bucket: 'packages.elasticsearch.org',
|
||||
debPrefix: `${productionPath}/${debFolder}`,
|
||||
rpmPrefix: `${productionPath}/${rpmFolder}`
|
||||
}
|
||||
};
|
||||
};
|
|
@ -26,12 +26,27 @@ module.exports = function (grunt) {
|
|||
let zipName = `${buildName}.zip`;
|
||||
let zipPath = resolve(rootPath, `target/${zipName}`);
|
||||
|
||||
let debName;
|
||||
let debPath;
|
||||
let rpmName;
|
||||
let rpmPath;
|
||||
if (name.match('linux')) {
|
||||
let debArch = name.match('x64') ? 'amd64' : 'i386';
|
||||
debName = `kibana_${version}_${debArch}.deb`;
|
||||
debPath = resolve(rootPath, `target/${debName}`);
|
||||
|
||||
let rpmArch = name.match('x64') ? 'x86_64' : 'i386';
|
||||
rpmName = `kibana-${version.replace('-', '_')}-1.${rpmArch}.rpm`;
|
||||
rpmPath = resolve(rootPath, `target/${rpmName}`);
|
||||
}
|
||||
return {
|
||||
name, win,
|
||||
nodeUrl, nodeDir,
|
||||
buildName, buildDir,
|
||||
tarName, tarPath,
|
||||
zipName, zipPath,
|
||||
debName, debPath,
|
||||
rpmName, rpmPath
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
113
tasks/release_packages.js
Normal file
113
tasks/release_packages.js
Normal file
|
@ -0,0 +1,113 @@
|
|||
import exec from './utils/exec';
|
||||
import SimpleGit from 'simple-git';
|
||||
import { promisify } from 'bluebird';
|
||||
import readline from 'readline';
|
||||
|
||||
export default (grunt) => {
|
||||
const packages = grunt.config.get('packages');
|
||||
const platforms = grunt.config.get('platforms');
|
||||
|
||||
function debS3(deb) {
|
||||
exec('deb-s3', [
|
||||
'upload',
|
||||
'--preserve-versions',
|
||||
deb.filePath,
|
||||
'--bucket', deb.bucket,
|
||||
'--prefix', deb.prefix,
|
||||
'--sign', deb.signatureKeyId,
|
||||
'--arch', deb.arch,
|
||||
`--access-key-id=${deb.awsKey}`,
|
||||
`--secret-access-key=${deb.awsSecret}`
|
||||
]);
|
||||
}
|
||||
|
||||
function rpmS3(rpm) {
|
||||
exec('rpm', [
|
||||
'--resign', rpm.filePath,
|
||||
'--define', '_signature gpg',
|
||||
'--define', `_gpg_name ${rpm.signingKeyName}`
|
||||
]);
|
||||
|
||||
exec('rpm-s3', [
|
||||
'-v',
|
||||
'-b', rpm.bucket,
|
||||
'-p', rpm.prefix,
|
||||
'--sign',
|
||||
'--visibility', 'public-read',
|
||||
'-k', '100',
|
||||
rpm.filePath,
|
||||
'-r', 'external-1'
|
||||
], {
|
||||
env: Object.assign({}, {
|
||||
'AWS_ACCESS_KEY': rpm.awsKey,
|
||||
'AWS_SECRET_KEY': rpm.awsSecret
|
||||
}, process.env)
|
||||
});
|
||||
}
|
||||
|
||||
grunt.registerTask('publishPackages:staging', [
|
||||
'_publishPackages:confirm',
|
||||
'_publishPackages:upload:staging',
|
||||
]);
|
||||
|
||||
grunt.registerTask('publishPackages:production', [
|
||||
'_publishPackages:confirm',
|
||||
'_publishPackages:upload:production',
|
||||
]);
|
||||
|
||||
grunt.registerTask('_publishPackages:confirm', function () {
|
||||
function abort() {
|
||||
grunt.fail.fatal('Aborting publish');
|
||||
}
|
||||
|
||||
var rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout
|
||||
});
|
||||
|
||||
rl.on('close', this.async());
|
||||
rl.on('SIGINT', () => abort());
|
||||
rl.question('Publish packages to s3? [N/y] ', function (resp) {
|
||||
if (resp.toLowerCase().trim()[0] === 'y') return rl.close();
|
||||
abort();
|
||||
});
|
||||
});
|
||||
|
||||
grunt.registerTask('_publishPackages:upload', function (environment) {
|
||||
const aws = grunt.file.readJSON('.aws-config.json');
|
||||
const signature = grunt.file.readJSON('.signing-config.json');
|
||||
const done = this.async();
|
||||
const simpleGit = new SimpleGit();
|
||||
const revparse = promisify(simpleGit.revparse, simpleGit);
|
||||
|
||||
return revparse(['--short', 'HEAD'])
|
||||
.then(hash => {
|
||||
const trimmedHash = hash.trim();
|
||||
platforms.forEach((platform) => {
|
||||
if (platform.debPath) {
|
||||
debS3({
|
||||
filePath: platform.debPath,
|
||||
bucket: packages[environment].bucket,
|
||||
prefix: packages[environment].debPrefix.replace('XXXXXXX', trimmedHash),
|
||||
signatureKeyId: signature.id,
|
||||
arch: platform.name.match('x64') ? 'amd64' : 'i386',
|
||||
awsKey: aws.key,
|
||||
awsSecret: aws.secret
|
||||
});
|
||||
}
|
||||
|
||||
if (platform.rpmPath) {
|
||||
rpmS3({
|
||||
filePath: platform.rpmPath,
|
||||
bucket: packages[environment].bucket,
|
||||
prefix: packages[environment].rpmPrefix.replace('XXXXXXX', trimmedHash),
|
||||
signingKeyName: signature.name,
|
||||
awsKey: aws.key,
|
||||
awsSecret: aws.secret
|
||||
});
|
||||
}
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue