mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
This is useful for when a pre-release build is completely tested and could be released as-is if it weren't for the pre-release suffix and commit hash. It will extract the archives in the target, replace the version, sha, and build numbers with the current working copy's, and then recreate the archives and shas.
66 lines
2 KiB
JavaScript
66 lines
2 KiB
JavaScript
import { execSync } from 'child_process';
|
|
import { trim } from 'lodash';
|
|
|
|
/**
|
|
* Repackages all of the current archives in target/ with the same build
|
|
* number, sha, and commit hash. This is useful when all you need to do is bump
|
|
* the version of the release and do not want to introduce any other changes.
|
|
*
|
|
* Even if there are new commits, the standard build task reinstalls all npm
|
|
* dependencies, which introduces at least a small amount of risk of
|
|
* introducing bugs into the build since not all dependencies have fixed
|
|
* versions.
|
|
*
|
|
* Options:
|
|
* --skip-archives Will skip the archive step, useful for debugging
|
|
* --buildversion="1.2.3" Sets new version to 1.2.3
|
|
* --buildnum="99999" Sets new build number to 99999
|
|
* --buildsha="9a5b2c1" Sets new build sha to 9a5b2c1 (use the full sha, though)
|
|
*/
|
|
export default (grunt) => {
|
|
grunt.registerTask('rebuild', 'Rebuilds targets as a new version', function () {
|
|
grunt.task.run([
|
|
'_build:getProps',
|
|
'_rebuild:confirm',
|
|
'_rebuild:continue'
|
|
]);
|
|
});
|
|
|
|
grunt.registerTask('_rebuild:continue', function () {
|
|
grunt.task.requires('_rebuild:confirm');
|
|
|
|
if (!grunt.config.get('rebuild.continue')) {
|
|
grunt.log.writeln('Aborting without rebuilding anything');
|
|
} else {
|
|
grunt.task.run([
|
|
'_rebuild:builds',
|
|
'_rebuild:archives'
|
|
]);
|
|
}
|
|
});
|
|
|
|
grunt.registerTask('_rebuild:builds', function () {
|
|
grunt.task.requires('_rebuild:continue');
|
|
|
|
grunt.task.run([
|
|
'clean:build',
|
|
'_rebuild:extractZips',
|
|
'_rebuild:updateBuilds'
|
|
]);
|
|
});
|
|
|
|
grunt.registerTask('_rebuild:archives', function () {
|
|
grunt.task.requires('_rebuild:continue');
|
|
|
|
const skip = grunt.option('skip-archives');
|
|
if (skip) {
|
|
grunt.log.writeln('Skipping archive step since rebuild debugging was enabled');
|
|
} else {
|
|
grunt.task.run([
|
|
'clean:target',
|
|
'_rebuild:createArchives',
|
|
'_build:shasums'
|
|
]);
|
|
}
|
|
});
|
|
};
|