mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[build] Add flag for using a local Kibana artifact in the Docker context (#129375)
* [build] Add flag for using a local Kibana artifact in the Docker context Currently Docker contexts always install a Kibana distribution from an http endpoint. These endpoints are only available after a release has been published, making pre-release testing difficult. This adds a flag to use a local Kibana artifact, with the intention of verifying the Docker contexts with release artifacts prior to publishing the release. * fix types
This commit is contained in:
parent
0e490e76b8
commit
4182523a2e
12 changed files with 48 additions and 17 deletions
|
@ -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,
|
||||
"dockerPush": false,
|
||||
"dockerTagQualifier": null,
|
||||
|
@ -68,6 +69,7 @@ it('builds packages if --all-platforms is passed', () => {
|
|||
"createGenericFolders": true,
|
||||
"createPlatformFolders": true,
|
||||
"createRpmPackage": true,
|
||||
"dockerContextUseLocalArtifact": null,
|
||||
"dockerCrossCompile": false,
|
||||
"dockerPush": false,
|
||||
"dockerTagQualifier": null,
|
||||
|
@ -100,6 +102,7 @@ it('limits packages if --rpm passed with --all-platforms', () => {
|
|||
"createGenericFolders": true,
|
||||
"createPlatformFolders": true,
|
||||
"createRpmPackage": true,
|
||||
"dockerContextUseLocalArtifact": null,
|
||||
"dockerCrossCompile": false,
|
||||
"dockerPush": false,
|
||||
"dockerTagQualifier": null,
|
||||
|
@ -132,6 +135,7 @@ it('limits packages if --deb passed with --all-platforms', () => {
|
|||
"createGenericFolders": true,
|
||||
"createPlatformFolders": true,
|
||||
"createRpmPackage": false,
|
||||
"dockerContextUseLocalArtifact": null,
|
||||
"dockerCrossCompile": false,
|
||||
"dockerPush": false,
|
||||
"dockerTagQualifier": null,
|
||||
|
@ -165,6 +169,7 @@ it('limits packages if --docker passed with --all-platforms', () => {
|
|||
"createGenericFolders": true,
|
||||
"createPlatformFolders": true,
|
||||
"createRpmPackage": false,
|
||||
"dockerContextUseLocalArtifact": null,
|
||||
"dockerCrossCompile": false,
|
||||
"dockerPush": false,
|
||||
"dockerTagQualifier": null,
|
||||
|
@ -205,6 +210,7 @@ it('limits packages if --docker passed with --skip-docker-ubi and --all-platform
|
|||
"createGenericFolders": true,
|
||||
"createPlatformFolders": true,
|
||||
"createRpmPackage": false,
|
||||
"dockerContextUseLocalArtifact": null,
|
||||
"dockerCrossCompile": false,
|
||||
"dockerPush": false,
|
||||
"dockerTagQualifier": null,
|
||||
|
@ -238,6 +244,7 @@ it('limits packages if --all-platforms passed with --skip-docker-ubuntu', () =>
|
|||
"createGenericFolders": true,
|
||||
"createPlatformFolders": true,
|
||||
"createRpmPackage": true,
|
||||
"dockerContextUseLocalArtifact": null,
|
||||
"dockerCrossCompile": false,
|
||||
"dockerPush": false,
|
||||
"dockerTagQualifier": null,
|
||||
|
|
|
@ -22,6 +22,7 @@ export function readCliArgs(argv: string[]) {
|
|||
'skip-os-packages',
|
||||
'rpm',
|
||||
'deb',
|
||||
'docker-context-use-local-artifact',
|
||||
'docker-cross-compile',
|
||||
'docker-images',
|
||||
'docker-push',
|
||||
|
@ -53,6 +54,7 @@ export function readCliArgs(argv: string[]) {
|
|||
rpm: null,
|
||||
deb: null,
|
||||
'docker-images': null,
|
||||
'docker-context-use-local-artifact': null,
|
||||
'docker-cross-compile': false,
|
||||
'docker-push': false,
|
||||
'docker-tag-qualifier': null,
|
||||
|
@ -114,6 +116,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']),
|
||||
dockerPush: Boolean(flags['docker-push']),
|
||||
dockerTagQualifier: flags['docker-tag-qualifier'],
|
||||
|
|
|
@ -13,6 +13,7 @@ import * as Tasks from './tasks';
|
|||
|
||||
export interface BuildOptions {
|
||||
isRelease: boolean;
|
||||
dockerContextUseLocalArtifact: boolean | null;
|
||||
dockerCrossCompile: boolean;
|
||||
dockerPush: boolean;
|
||||
dockerTagQualifier: string | null;
|
||||
|
|
|
@ -33,22 +33,23 @@ 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}
|
||||
--epr-registry {dim Specify the EPR registry to use for Fleet packages, 'production' or 'snapshot'}
|
||||
--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}
|
||||
--epr-registry {dim Specify the EPR registry to use for Fleet packages, 'production' or 'snapshot'}
|
||||
`) + '\n'
|
||||
);
|
||||
process.exit(1);
|
||||
|
|
|
@ -33,6 +33,7 @@ const config = new Config(
|
|||
buildVersion: '8.0.0',
|
||||
},
|
||||
false,
|
||||
false,
|
||||
'',
|
||||
false,
|
||||
true
|
||||
|
|
|
@ -29,6 +29,7 @@ const setup = async ({ targetAllPlatforms = true }: { targetAllPlatforms?: boole
|
|||
return await Config.create({
|
||||
isRelease: true,
|
||||
targetAllPlatforms,
|
||||
dockerContextUseLocalArtifact: false,
|
||||
dockerCrossCompile: false,
|
||||
dockerPush: false,
|
||||
dockerTagQualifier: '',
|
||||
|
|
|
@ -17,6 +17,7 @@ interface Options {
|
|||
isRelease: boolean;
|
||||
targetAllPlatforms: boolean;
|
||||
versionQualifier?: string;
|
||||
dockerContextUseLocalArtifact: boolean | null;
|
||||
dockerCrossCompile: boolean;
|
||||
dockerTagQualifier: string | null;
|
||||
dockerPush: boolean;
|
||||
|
@ -36,6 +37,7 @@ export class Config {
|
|||
isRelease,
|
||||
targetAllPlatforms,
|
||||
versionQualifier,
|
||||
dockerContextUseLocalArtifact,
|
||||
dockerCrossCompile,
|
||||
dockerTagQualifier,
|
||||
dockerPush,
|
||||
|
@ -53,6 +55,7 @@ export class Config {
|
|||
versionQualifier,
|
||||
pkg,
|
||||
}),
|
||||
dockerContextUseLocalArtifact,
|
||||
dockerCrossCompile,
|
||||
dockerTagQualifier,
|
||||
dockerPush,
|
||||
|
@ -66,6 +69,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,
|
||||
private readonly dockerTagQualifier: string | null,
|
||||
private readonly dockerPush: boolean,
|
||||
|
@ -100,6 +104,13 @@ export class Config {
|
|||
return this.dockerPush;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a local Kibana distribution when producing a docker context
|
||||
*/
|
||||
getDockerContextUseLocalArtifact() {
|
||||
return this.dockerContextUseLocalArtifact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get docker cross compile
|
||||
*/
|
||||
|
|
|
@ -50,6 +50,7 @@ const setup = async () => {
|
|||
isRelease: true,
|
||||
targetAllPlatforms: true,
|
||||
versionQualifier: '-SNAPSHOT',
|
||||
dockerContextUseLocalArtifact: false,
|
||||
dockerCrossCompile: false,
|
||||
dockerPush: false,
|
||||
dockerTagQualifier: '',
|
||||
|
|
|
@ -39,6 +39,7 @@ async function setup({ failOnUrl }: { failOnUrl?: string } = {}) {
|
|||
const config = await Config.create({
|
||||
isRelease: true,
|
||||
targetAllPlatforms: true,
|
||||
dockerContextUseLocalArtifact: false,
|
||||
dockerCrossCompile: false,
|
||||
dockerPush: false,
|
||||
dockerTagQualifier: '',
|
||||
|
|
|
@ -43,6 +43,7 @@ async function setup() {
|
|||
const config = await Config.create({
|
||||
isRelease: true,
|
||||
targetAllPlatforms: true,
|
||||
dockerContextUseLocalArtifact: false,
|
||||
dockerCrossCompile: false,
|
||||
dockerPush: false,
|
||||
dockerTagQualifier: '',
|
||||
|
|
|
@ -48,6 +48,7 @@ async function setup(actualShaSums?: Record<string, string>) {
|
|||
const config = await Config.create({
|
||||
isRelease: true,
|
||||
targetAllPlatforms: true,
|
||||
dockerContextUseLocalArtifact: false,
|
||||
dockerCrossCompile: false,
|
||||
dockerPush: false,
|
||||
dockerTagQualifier: '',
|
||||
|
|
|
@ -23,6 +23,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);
|
||||
|
@ -32,7 +33,8 @@ export async function bundleDockerFiles(config: Config, log: ToolingLog, scope:
|
|||
resolve(dockerFilesBuildDir, dockerfileTemplate.name),
|
||||
dockerfileTemplate.generator({
|
||||
...scope,
|
||||
usePublicArtifact: true,
|
||||
usePublicArtifact:
|
||||
dockerContextUseLocalArtifact !== null ? !dockerContextUseLocalArtifact : true,
|
||||
})
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue