Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/dev/build/args.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ it('build default and oss dist for current platform, without packages, by defaul
"createGenericFolders": true,
"createPlatformFolders": true,
"createRpmPackage": false,
"dockerContextUseLocalArtifact": null,
"dockerCrossCompile": false,
"downloadFreshNode": true,
"initialize": true,
Expand Down Expand Up @@ -64,6 +65,7 @@ it('builds packages if --all-platforms is passed', () => {
"createGenericFolders": true,
"createPlatformFolders": true,
"createRpmPackage": true,
"dockerContextUseLocalArtifact": null,
"dockerCrossCompile": false,
"downloadFreshNode": true,
"initialize": true,
Expand Down Expand Up @@ -92,6 +94,7 @@ it('limits packages if --rpm passed with --all-platforms', () => {
"createGenericFolders": true,
"createPlatformFolders": true,
"createRpmPackage": true,
"dockerContextUseLocalArtifact": null,
"dockerCrossCompile": false,
"downloadFreshNode": true,
"initialize": true,
Expand Down Expand Up @@ -120,6 +123,7 @@ it('limits packages if --deb passed with --all-platforms', () => {
"createGenericFolders": true,
"createPlatformFolders": true,
"createRpmPackage": false,
"dockerContextUseLocalArtifact": null,
"dockerCrossCompile": false,
"downloadFreshNode": true,
"initialize": true,
Expand Down Expand Up @@ -149,6 +153,7 @@ it('limits packages if --docker passed with --all-platforms', () => {
"createGenericFolders": true,
"createPlatformFolders": true,
"createRpmPackage": false,
"dockerContextUseLocalArtifact": null,
"dockerCrossCompile": false,
"downloadFreshNode": true,
"initialize": true,
Expand Down Expand Up @@ -185,6 +190,7 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform
"createGenericFolders": true,
"createPlatformFolders": true,
"createRpmPackage": false,
"dockerContextUseLocalArtifact": null,
"dockerCrossCompile": false,
"downloadFreshNode": true,
"initialize": true,
Expand Down Expand Up @@ -214,6 +220,7 @@ it('limits packages if --all-platforms passed with --skip-docker-ubuntu', () =>
"createGenericFolders": true,
"createPlatformFolders": true,
"createRpmPackage": true,
"dockerContextUseLocalArtifact": null,
"dockerCrossCompile": false,
"downloadFreshNode": true,
"initialize": true,
Expand Down
3 changes: 3 additions & 0 deletions src/dev/build/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function readCliArgs(argv: string[]) {
'skip-os-packages',
'rpm',
'deb',
'docker-context-use-local-artifact',
'docker-cross-compile',
'docker-images',
'skip-docker-contexts',
Expand Down Expand Up @@ -50,6 +51,7 @@ export function readCliArgs(argv: string[]) {
rpm: null,
deb: null,
'docker-images': null,
'docker-context-use-local-artifact': null,
'docker-cross-compile': false,
'version-qualifier': '',
},
Expand Down Expand Up @@ -96,6 +98,7 @@ export function readCliArgs(argv: string[]) {
const buildOptions: BuildOptions = {
isRelease: Boolean(flags.release),
versionQualifier: flags['version-qualifier'],
dockerContextUseLocalArtifact: flags['docker-context-use-local-artifact'],
dockerCrossCompile: Boolean(flags['docker-cross-compile']),
initialize: !Boolean(flags['skip-initialize']),
downloadFreshNode: !Boolean(flags['skip-node-download']),
Expand Down
1 change: 1 addition & 0 deletions src/dev/build/build_distributables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as Tasks from './tasks';

export interface BuildOptions {
isRelease: boolean;
dockerContextUseLocalArtifact: boolean | null;
dockerCrossCompile: boolean;
downloadFreshNode: boolean;
initialize: boolean;
Expand Down
31 changes: 16 additions & 15 deletions src/dev/build/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,22 @@ if (showHelp) {
build the Kibana distributable

options:
--skip-archives {dim Don't produce tar/zip archives}
--skip-os-packages {dim Don't produce rpm/deb/docker packages}
--all-platforms {dim Produce archives for all platforms, not just this one}
--rpm {dim Only build the rpm packages}
--deb {dim Only build the deb packages}
--docker-images {dim Only build the Docker images}
--docker-cross-compile {dim Produce arm64 and amd64 Docker images}
--docker-contexts {dim Only build the Docker build contexts}
--skip-docker-ubi {dim Don't build the docker ubi image}
--skip-docker-ubuntu {dim Don't build the docker ubuntu image}
--release {dim Produce a release-ready distributable}
--version-qualifier {dim Suffix version with a qualifier}
--skip-node-download {dim Reuse existing downloads of node.js}
--verbose,-v {dim Turn on verbose logging}
--no-debug {dim Turn off debug logging}
--skip-archives {dim Don't produce tar/zip archives}
--skip-os-packages {dim Don't produce rpm/deb/docker packages}
--all-platforms {dim Produce archives for all platforms, not just this one}
--rpm {dim Only build the rpm packages}
--deb {dim Only build the deb packages}
--docker-images {dim Only build the Docker images}
--docker-context-use-local-artifact {dim Use a local artifact when building the Docker context}
--docker-cross-compile {dim Produce arm64 and amd64 Docker images}
--docker-contexts {dim Only build the Docker build contexts}
--skip-docker-ubi {dim Don't build the docker ubi image}
--skip-docker-ubuntu {dim Don't build the docker ubuntu image}
--release {dim Produce a release-ready distributable}
--version-qualifier {dim Suffix version with a qualifier}
--skip-node-download {dim Reuse existing downloads of node.js}
--verbose,-v {dim Turn on verbose logging}
--no-debug {dim Turn off debug logging}
`) + '\n'
);
process.exit(1);
Expand Down
1 change: 1 addition & 0 deletions src/dev/build/lib/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const config = new Config(
buildVersion: '8.0.0',
},
false,
false,
true
);

Expand Down
1 change: 1 addition & 0 deletions src/dev/build/lib/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const setup = async ({ targetAllPlatforms = true }: { targetAllPlatforms?: boole
return await Config.create({
isRelease: true,
targetAllPlatforms,
dockerContextUseLocalArtifact: false,
dockerCrossCompile: false,
});
};
Expand Down
11 changes: 11 additions & 0 deletions src/dev/build/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface Options {
isRelease: boolean;
targetAllPlatforms: boolean;
versionQualifier?: string;
dockerContextUseLocalArtifact: boolean | null;
dockerCrossCompile: boolean;
}

Expand All @@ -34,6 +35,7 @@ export class Config {
isRelease,
targetAllPlatforms,
versionQualifier,
dockerContextUseLocalArtifact,
dockerCrossCompile,
}: Options) {
const pkgPath = resolve(__dirname, '../../../../package.json');
Expand All @@ -49,6 +51,7 @@ export class Config {
versionQualifier,
pkg,
}),
dockerContextUseLocalArtifact,
dockerCrossCompile,
isRelease
);
Expand All @@ -60,6 +63,7 @@ export class Config {
private readonly nodeVersion: string,
private readonly repoRoot: string,
private readonly versionInfo: VersionInfo,
private readonly dockerContextUseLocalArtifact: boolean | null,
private readonly dockerCrossCompile: boolean,
public readonly isRelease: boolean
) {}
Expand All @@ -78,6 +82,13 @@ export class Config {
return this.nodeVersion;
}

/**
* Use a local Kibana distribution when producing a docker context
*/
getDockerContextUseLocalArtifact() {
return this.dockerContextUseLocalArtifact;
}

/**
* Get docker cross compile
*/
Expand Down
1 change: 1 addition & 0 deletions src/dev/build/lib/runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const setup = async () => {
isRelease: true,
targetAllPlatforms: true,
versionQualifier: '-SNAPSHOT',
dockerContextUseLocalArtifact: false,
dockerCrossCompile: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async function setup({ failOnUrl }: { failOnUrl?: string } = {}) {
const config = await Config.create({
isRelease: true,
targetAllPlatforms: true,
dockerContextUseLocalArtifact: false,
dockerCrossCompile: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function setup() {
const config = await Config.create({
isRelease: true,
targetAllPlatforms: true,
dockerContextUseLocalArtifact: false,
dockerCrossCompile: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async function setup(actualShaSums?: Record<string, string>) {
const config = await Config.create({
isRelease: true,
targetAllPlatforms: true,
dockerContextUseLocalArtifact: false,
dockerCrossCompile: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export async function bundleDockerFiles(config: Config, log: ToolingLog, scope:
const dockerFilesDirName = `kibana${scope.imageFlavor}-${scope.version}-docker-build-context`;
const dockerFilesBuildDir = resolve(scope.dockerBuildDir, dockerFilesDirName);
const dockerFilesOutputDir = config.resolveFromTarget(`${dockerFilesDirName}.tar.gz`);
const dockerContextUseLocalArtifact = config.getDockerContextUseLocalArtifact();

// Create dockerfiles dir inside docker build dir
await mkdirp(dockerFilesBuildDir);
Expand All @@ -31,7 +32,8 @@ export async function bundleDockerFiles(config: Config, log: ToolingLog, scope:
resolve(dockerFilesBuildDir, dockerfileTemplate.name),
dockerfileTemplate.generator({
...scope,
usePublicArtifact: true,
usePublicArtifact:
dockerContextUseLocalArtifact !== null ? !dockerContextUseLocalArtifact : true,
})
);

Expand Down