Skip to content

Commit

Permalink
[build] Remove platform from archive root directory (#93835)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
jbudz and kibanamachine authored Mar 15, 2021
1 parent cda2fb3 commit 511accd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 6 deletions.
8 changes: 8 additions & 0 deletions docs/migration/migrate_8_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
4 changes: 2 additions & 2 deletions docs/setup/install/targz.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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`.
Expand Down
7 changes: 7 additions & 0 deletions src/dev/build/lib/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"`);
});
});
});
4 changes: 4 additions & 0 deletions src/dev/build/lib/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export class Build {
);
}

getRootDirectory() {
return `${this.name}-${this.config.getBuildVersion()}`;
}

getName() {
return this.name;
}
Expand Down
12 changes: 8 additions & 4 deletions src/dev/build/lib/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -276,6 +278,7 @@ export async function compressTar({

interface CompressZipOptions {
createRootDirectory: boolean;
rootDirectoryName?: string;
source: string;
destination: string;
archiverOptions?: archiver.ZipOptions & archiver.CoreOptions;
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/dev/build/tasks/create_archives_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const CreateArchives: Task = {
},
},
createRootDirectory: true,
rootDirectoryName: build.getRootDirectory(),
}),
});
break;
Expand All @@ -63,6 +64,7 @@ export const CreateArchives: Task = {
},
},
createRootDirectory: true,
rootDirectoryName: build.getRootDirectory(),
}),
});
break;
Expand Down

0 comments on commit 511accd

Please sign in to comment.