Skip to content

Commit

Permalink
Backport PR #7202
Browse files Browse the repository at this point in the history
---------

**Commit 1:**
[build] Release packages to s3

* Original sha: d0c835d
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-05-13T16:45:41Z

**Commit 2:**
[build] Check for release files after build task

* Original sha: 032de94
* Authored by Jonathan Budzenski <jbudz@users.noreply.github.com> on 2016-05-19T18:16:11Z
  • Loading branch information
elastic-jasper committed Jun 15, 2016
1 parent 385bf8e commit d3a5e42
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 28 deletions.
18 changes: 1 addition & 17 deletions tasks/config/s3.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
var _ = require('lodash');
module.exports = function (grunt) {
var { config } = grunt;

return {
release: {
bucket: 'download.elasticsearch.org',
access: 'private',
debug: false,
upload: config.get('platforms')
.reduce(function (files, platform) {
return files.concat(
platform.tarName,
platform.tarName + '.sha1.txt',
platform.zipName,
platform.zipName + '.sha1.txt'
);
}, [])
.map(function (filename) {
return {
src: 'target/' + filename,
dest: 'kibana/kibana/' + filename
};
})
debug: false
}
};
};
56 changes: 45 additions & 11 deletions tasks/release.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
module.exports = function (grunt) {
var readline = require('readline');
var url = require('url');
var fs = require('fs');
var _ = require('lodash');

// build, then zip and upload to s3
grunt.registerTask('release', [
'_release:confirmUpload',
'_release:loadS3Config',
'build',
'_release:setS3Uploads',
's3:release',
'_release:complete'
]);
Expand Down Expand Up @@ -33,18 +37,48 @@ module.exports = function (grunt) {
});
});

grunt.registerTask('_release:setS3Uploads', function () {
var uploads = grunt.config.get('platforms')
.reduce(function (files, platform) {
return files.concat(
platform.tarName,
platform.tarName + '.sha1.txt',
platform.zipName,
platform.zipName + '.sha1.txt',
platform.rpmName,
platform.rpmName && platform.rpmName + '.sha1.txt',
platform.debName,
platform.debName && platform.debName + '.sha1.txt'
);
}, [])
.filter(function (filename) {
if (_.isUndefined(filename)) return false;
try {
fs.accessSync('target/' + filename, fs.F_OK);
return true;
} catch (e) {
return false;
}
})
.map(function (filename) {
return {
src: 'target/' + filename,
dest: 'kibana/kibana/' + filename
};
});
grunt.config.set('s3.release.upload', uploads);
});

grunt.registerTask('_release:complete', function () {
grunt.log.ok('Builds released');
grunt.log.write(
`
${grunt.config.get('platforms').reduce((t, p) => {
return (
`${t}https://download.elastic.co/kibana/kibana/${p.buildName}.tar.gz
https://download.elastic.co/kibana/kibana/${p.buildName}.zip
`
);
}, '')}
`
);
var links = grunt.config.get('s3.release.upload').reduce((t, {dest}) => {
var link = url.format({
protocol: 'https',
hostname: 'download.elastic.co',
pathname: dest
});
return `${t}${link}\n`;
}, '');
grunt.log.write(links);
});
};

0 comments on commit d3a5e42

Please sign in to comment.