Skip to content

Commit

Permalink
[kbn-test] export fleet package registry image
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko committed Jan 10, 2025
1 parent 41a4255 commit 9b77908
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import { format as formatUrl } from 'url';
import Fs from 'fs';

import { CA_CERT_PATH, kibanaDevServiceAccount } from '@kbn/dev-utils';
import { defineDockerServersConfig, getDockerFileMountPath } from '@kbn/test';
import {
fleetPackageRegistryDockerImage,
defineDockerServersConfig,
getDockerFileMountPath,
} from '@kbn/test';
import { MOCK_IDP_REALM_NAME } from '@kbn/mock-idp-utils';

import { dockerImage } from '@kbn/test-suites-xpack/fleet_api_integration/config.base';
import { REPO_ROOT } from '@kbn/repo-info';
import { ScoutServerConfig } from '../../types';
import { SAML_IDP_PLUGIN_PATH, SERVERLESS_IDP_METADATA_PATH, JWKS_PATH } from '../constants';
Expand Down Expand Up @@ -55,7 +57,7 @@ export const defaultConfig: ScoutServerConfig = {
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: dockerImage,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
Expand Down
7 changes: 2 additions & 5 deletions packages/kbn-scout/src/config/stateful/base.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ import {
MOCK_IDP_ATTRIBUTE_EMAIL,
MOCK_IDP_ATTRIBUTE_NAME,
} from '@kbn/mock-idp-utils';
import { defineDockerServersConfig } from '@kbn/test';
import { fleetPackageRegistryDockerImage, defineDockerServersConfig } from '@kbn/test';
import path from 'path';

import { MOCK_IDP_REALM_NAME } from '@kbn/mock-idp-utils';

import { dockerImage } from '@kbn/test-suites-xpack/fleet_api_integration/config.base';
import { REPO_ROOT } from '@kbn/repo-info';
import { STATEFUL_ROLES_ROOT_PATH } from '@kbn/es';
import type { ScoutServerConfig } from '../../types';
Expand Down Expand Up @@ -66,7 +63,7 @@ export const defaultConfig: ScoutServerConfig = {
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: dockerImage,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-scout/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@kbn/es-archiver",
"@kbn/dev-utils",
"@kbn/mock-idp-utils",
"@kbn/test-suites-xpack",
"@kbn/test-subj-selector",
"@kbn/scout-info",
"@kbn/scout-reporting"
Expand Down
7 changes: 7 additions & 0 deletions packages/kbn-test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,10 @@ export * from './src/kbn_client';
export * from './src/find_test_plugin_paths';

export { getDockerFileMountPath } from '@kbn/es';

// Docker image to use for Fleet API integration tests.
// This image comes from the latest successful build of https://buildkite.com/elastic/kibana-package-registry-promote
// which is promoted after acceptance tests succeed against docker.elastic.co/package-registry/distribution:lite
export const fleetPackageRegistryDockerImage =
process.env.FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE ||
'docker.elastic.co/kibana-ci/package-registry-distribution:lite';
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrConfigProviderContext, Config, defineDockerServersConfig } from '@kbn/test';
import {
fleetPackageRegistryDockerImage,
FtrConfigProviderContext,
Config,
defineDockerServersConfig,
} from '@kbn/test';

import { ServerlessProjectType } from '@kbn/es';
import path from 'path';
import { dockerImage } from '../../../fleet_api_integration/config.base';
import { DeploymentAgnosticCommonServices, services } from '../services';

interface CreateTestConfigOptions<T extends DeploymentAgnosticCommonServices> {
Expand Down Expand Up @@ -88,7 +92,7 @@ export function createServerlessTestConfig<T extends DeploymentAgnosticCommonSer
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: dockerImage,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
MOCK_IDP_ATTRIBUTE_NAME,
} from '@kbn/mock-idp-utils';
import {
fleetPackageRegistryDockerImage,
esTestConfig,
kbnTestConfig,
systemIndicesSuperuser,
Expand All @@ -22,7 +23,6 @@ import {
import path from 'path';
import { REPO_ROOT } from '@kbn/repo-info';
import { STATEFUL_ROLES_ROOT_PATH } from '@kbn/es';
import { dockerImage } from '../../../fleet_api_integration/config.base';
import { DeploymentAgnosticCommonServices, services } from '../services';

interface CreateTestConfigOptions<T extends DeploymentAgnosticCommonServices> {
Expand Down Expand Up @@ -88,7 +88,7 @@ export function createStatefulTestConfig<T extends DeploymentAgnosticCommonServi
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: dockerImage,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

import path from 'path';

import { defineDockerServersConfig } from '@kbn/test';
import { dockerImage as ingestDockerImage } from '../../../fleet_api_integration/config.base';
import {
fleetPackageRegistryDockerImage as ingestDockerImage,
defineDockerServersConfig,
} from '@kbn/test';

export function SecuritySolutionEndpointRegistryHelpers() {
/**
Expand Down
9 changes: 6 additions & 3 deletions x-pack/test/dataset_quality_api_integration/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ import {
DATASET_QUALITY_TEST_PASSWORD,
DatasetQualityUsername,
} from '@kbn/dataset-quality-plugin/server/test_helpers/create_dataset_quality_users/authentication';
import { FtrConfigProviderContext, defineDockerServersConfig } from '@kbn/test';
import {
fleetPackageRegistryDockerImage,
FtrConfigProviderContext,
defineDockerServersConfig,
} from '@kbn/test';
import path from 'path';
import supertest from 'supertest';
import { UrlObject, format } from 'url';
import { dockerImage } from '../../fleet_api_integration/config.base';
import { DatasetQualityFtrConfigName } from '../configs';
import { createDatasetQualityApiClient } from './dataset_quality_api_supertest';
import {
Expand Down Expand Up @@ -119,7 +122,7 @@ export function createTestConfig(
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: dockerImage,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
Expand Down
13 changes: 5 additions & 8 deletions x-pack/test/fleet_api_integration/config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,13 @@
import path from 'path';

import {
fleetPackageRegistryDockerImage,
FtrConfigProviderContext,
defineDockerServersConfig,
getKibanaCliLoggers,
} from '@kbn/test';

const getFullPath = (relativePath: string) => path.join(path.dirname(__filename), relativePath);
// Docker image to use for Fleet API integration tests.
// This image comes from the latest successful build of https://buildkite.com/elastic/kibana-package-registry-promote
// which is promoted after acceptance tests succeed against docker.elastic.co/package-registry/distribution:lite
export const dockerImage =
process.env.FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE ||
'docker.elastic.co/kibana-ci/package-registry-distribution:lite';

export const BUNDLED_PACKAGE_DIR = '/tmp/fleet_bundled_packages';

Expand Down Expand Up @@ -47,7 +42,7 @@ export default async function ({ readConfigFile, log }: FtrConfigProviderContext
? defineDockerServersConfig({
registry: {
enabled: !!registryPort,
image: dockerImage,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: registryPort,
args: dockerArgs,
Expand All @@ -58,7 +53,9 @@ export default async function ({ readConfigFile, log }: FtrConfigProviderContext
: undefined;

if (skipRunningDockerRegistry) {
const cmd = `docker run ${dockerArgs.join(' ')} -p ${registryPort}:8080 ${dockerImage}`;
const cmd = `docker run ${dockerArgs.join(
' '
)} -p ${registryPort}:8080 ${fleetPackageRegistryDockerImage}`;
log.warning(`Not running docker registry, you can run it with the following command: ${cmd}`);
}

Expand Down
8 changes: 0 additions & 8 deletions x-pack/test/functional/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,9 @@
*/

import { resolve } from 'path';

import { services } from './services';
import { pageObjects } from './page_objects';

// Docker image to use for Fleet API integration tests.
// This image comes from the latest successful build of https://buildkite.com/elastic/kibana-package-registry-promote
// which is promoted after acceptance tests succeed against docker.elastic.co/package-registry/distribution:lite
export const dockerImage =
process.env.FLEET_PACKAGE_REGISTRY_DOCKER_IMAGE ||
'docker.elastic.co/kibana-ci/package-registry-distribution:lite';

// the default export of config files must be a config provider
// that returns an object with the projects config values
export default async function ({ readConfigFile }) {
Expand Down
5 changes: 2 additions & 3 deletions x-pack/test_serverless/shared/config.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import { CA_CERT_PATH, kibanaDevServiceAccount } from '@kbn/dev-utils';
import { commonFunctionalServices } from '@kbn/ftr-common-functional-services';
import { MOCK_IDP_REALM_NAME } from '@kbn/mock-idp-utils';
import path from 'path';
import { defineDockerServersConfig } from '@kbn/test';
import { dockerImage } from '@kbn/test-suites-xpack/fleet_api_integration/config.base';
import { fleetPackageRegistryDockerImage, defineDockerServersConfig } from '@kbn/test';
import { services } from './services';

export default async () => {
Expand Down Expand Up @@ -66,7 +65,7 @@ export default async () => {
dockerServers: defineDockerServersConfig({
registry: {
enabled: !!dockerRegistryPort,
image: dockerImage,
image: fleetPackageRegistryDockerImage,
portInContainer: 8080,
port: dockerRegistryPort,
args: dockerArgs,
Expand Down

0 comments on commit 9b77908

Please sign in to comment.