Skip to content

Commit

Permalink
Merge pull request #7847 from elastic/jasper/backport/7571/4.x
Browse files Browse the repository at this point in the history
[backport] PR #7571 to 4.x
  • Loading branch information
jbudz authored Jul 26, 2016
2 parents 21a5de2 + 608ca55 commit b397370
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 35 deletions.
7 changes: 4 additions & 3 deletions tasks/config/packages.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export default (grunt) => {
const VERSION = grunt.config.get('build.version');
const SHORT_SHA = grunt.config.get('build.sha').substr(0, 7);

const FOLDER_STAGING = `kibana/staging/${VERSION.match(/\d\.\d\.\d/)[0]}-XXXXXXX/repos/${VERSION.match(/\d\./)[0]}x`;
const FOLDER_STAGING = `kibana/staging/${VERSION}-${SHORT_SHA}/repos/${VERSION.match(/\d\./)[0]}x`;
const FOLDER_PRODUCTION = `kibana/${VERSION.match(/\d\./)[0]}x`;

const FOLDERNAME_DEB = 'debian';
Expand Down Expand Up @@ -30,8 +31,8 @@ export default (grunt) => {
},
production: {
bucket: 'packages.elasticsearch.org',
debPrefix: PREFIX_STAGING_DEB,
rpmPrefix: PREFIX_STAGING_RPM
debPrefix: PREFIX_PRODUCTION_DEB,
rpmPrefix: PREFIX_PRODUCTION_RPM
}
},
user: 'kibana',
Expand Down
55 changes: 23 additions & 32 deletions tasks/release_packages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import exec from './utils/exec';
import SimpleGit from 'simple-git';
import { promisify } from 'bluebird';
import readline from 'readline';

export default (grunt) => {
Expand Down Expand Up @@ -76,38 +74,31 @@ export default (grunt) => {
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: publishConfig[environment].bucket,
prefix: publishConfig[environment].debPrefix.replace('XXXXXXX', trimmedHash),
signatureKeyId: signature.id,
arch: platform.debArch,
awsKey: aws.key,
awsSecret: aws.secret
});
}
platforms.forEach((platform) => {
if (platform.debPath) {
debS3({
filePath: platform.debPath,
bucket: publishConfig[environment].bucket,
prefix: publishConfig[environment].debPrefix,
signatureKeyId: signature.id,
arch: platform.debArch,
awsKey: aws.key,
awsSecret: aws.secret
});
}

if (platform.rpmPath) {
rpmS3({
filePath: platform.rpmPath,
bucket: publishConfig[environment].bucket,
prefix: publishConfig[environment].rpmPrefix.replace('XXXXXXX', trimmedHash),
signingKeyName: signature.name,
awsKey: aws.key,
awsSecret: aws.secret
});
}
});
done();
if (platform.rpmPath) {
rpmS3({
filePath: platform.rpmPath,
bucket: publishConfig[environment].bucket,
prefix: publishConfig[environment].rpmPrefix,
signingKeyName: signature.name,
awsKey: aws.key,
awsSecret: aws.secret
});
}
});

});
};

0 comments on commit b397370

Please sign in to comment.