[build] Remove platform from archive root directory (#93835)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Jonathan Budzenski 2021-03-15 14:41:18 -05:00 committed by GitHub
parent cda2fb3d5a
commit 511accdb6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 6 deletions

View file

@ -202,5 +202,13 @@ All supported operating systems support using systemd service files. Any system
*Impact:*
Any installations using `.deb` or `.rpm` packages using SysV will need to migrate to systemd.
[float]
=== Platform removed from root folder name for `.tar.gz` and `.zip` archives
*Details:*
The output directory after extracting an archive no longer includes the target platform. For example, `kibana-8.0.0-linux-aarch64.tar.gz` will produce a folder named `kibana-8.0.0`.
*Impact:*
Configuration management tools and automation will need to be updated to use the new directory.
// end::notable-breaking-changes[]

View file

@ -34,7 +34,7 @@ The Linux archive for Kibana v{version} can be downloaded and installed as follo
curl -O https://artifacts.elastic.co/downloads/kibana/kibana-{version}-linux-x86_64.tar.gz
curl https://artifacts.elastic.co/downloads/kibana/kibana-{version}-linux-x86_64.tar.gz.sha512 | shasum -a 512 -c - <1>
tar -xzf kibana-{version}-linux-x86_64.tar.gz
cd kibana-{version}-linux-x86_64/ <2>
cd kibana-{version}/ <2>
--------------------------------------------
<1> Compares the SHA of the downloaded `.tar.gz` archive and the published checksum, which should output
`kibana-{version}-linux-x86_64.tar.gz: OK`.
@ -82,7 +82,7 @@ The Darwin archive for Kibana v{version} can be downloaded and installed as foll
curl -O https://artifacts.elastic.co/downloads/kibana/kibana-{version}-darwin-x86_64.tar.gz
curl https://artifacts.elastic.co/downloads/kibana/kibana-{version}-darwin-x86_64.tar.gz.sha512 | shasum -a 512 -c - <1>
tar -xzf kibana-{version}-darwin-x86_64.tar.gz
cd kibana-{version}-darwin-x86_64/ <2>
cd kibana-{version}/ <2>
--------------------------------------------
<1> Compares the SHA of the downloaded `.tar.gz` archive and the published checksum, which should output
`kibana-{version}-darwin-x86_64.tar.gz: OK`.

View file

@ -107,4 +107,11 @@ describe('#getPlatformArchivePath()', () => {
`<absolute path>/target/kibana-oss-8.0.0-windows-x86_64.zip`
);
});
describe('#getRootDirectory()', () => {
it('creates correct root directory name', () => {
expect(ossBuild.getRootDirectory()).toMatchInlineSnapshot(`"kibana-oss-8.0.0"`);
expect(defaultBuild.getRootDirectory()).toMatchInlineSnapshot(`"kibana-8.0.0"`);
});
});
});

View file

@ -42,6 +42,10 @@ export class Build {
);
}
getRootDirectory() {
return `${this.name}-${this.config.getBuildVersion()}`;
}
getName() {
return this.name;
}

View file

@ -246,6 +246,7 @@ export async function gunzip(source: string, destination: string) {
interface CompressTarOptions {
createRootDirectory: boolean;
rootDirectoryName?: string;
source: string;
destination: string;
archiverOptions?: archiver.TarOptions & archiver.CoreOptions;
@ -255,11 +256,12 @@ export async function compressTar({
destination,
archiverOptions,
createRootDirectory,
rootDirectoryName,
}: CompressTarOptions) {
const output = fs.createWriteStream(destination);
const archive = archiver('tar', archiverOptions);
const name = createRootDirectory ? source.split(sep).slice(-1)[0] : false;
const folder = rootDirectoryName ? rootDirectoryName : source.split(sep).slice(-1)[0];
const name = createRootDirectory ? folder : false;
archive.pipe(output);
let fileCount = 0;
@ -276,6 +278,7 @@ export async function compressTar({
interface CompressZipOptions {
createRootDirectory: boolean;
rootDirectoryName?: string;
source: string;
destination: string;
archiverOptions?: archiver.ZipOptions & archiver.CoreOptions;
@ -285,11 +288,12 @@ export async function compressZip({
destination,
archiverOptions,
createRootDirectory,
rootDirectoryName,
}: CompressZipOptions) {
const output = fs.createWriteStream(destination);
const archive = archiver('zip', archiverOptions);
const name = createRootDirectory ? source.split(sep).slice(-1)[0] : false;
const folder = rootDirectoryName ? rootDirectoryName : source.split(sep).slice(-1)[0];
const name = createRootDirectory ? folder : false;
archive.pipe(output);
let fileCount = 0;

View file

@ -45,6 +45,7 @@ export const CreateArchives: Task = {
},
},
createRootDirectory: true,
rootDirectoryName: build.getRootDirectory(),
}),
});
break;
@ -63,6 +64,7 @@ export const CreateArchives: Task = {
},
},
createRootDirectory: true,
rootDirectoryName: build.getRootDirectory(),
}),
});
break;