Skip to content

Commit

Permalink
Merge branch '8.12' into backport/8.12/pr-176190
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko authored Feb 5, 2024
2 parents 07128f2 + a94310f commit da7ec4c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docs/setup/install.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ If you are running our hosted Elasticsearch Service on Elastic Cloud, you access
[float]
=== Install {kib} yourself

TIP: For a step-by-step example of setting up the {stack} on your own premises, try out our tutorial: {stack-ref}/installing-stack-demo-self.html[Installing a self-managed Elastic Stack].

NOTE: Starting with version 6.0.0, Kibana only supports 64 bit operating systems.

Kibana is provided in the following package formats:
Expand Down
2 changes: 2 additions & 0 deletions docs/setup/install/rpm.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ The latest stable version of Kibana can be found on the
link:/downloads/kibana[Download Kibana] page. Other versions can
be found on the link:/downloads/past-releases[Past Releases page].

TIP: For a step-by-step example of setting up the {stack} on your own premises, try out our tutorial: {stack-ref}/installing-stack-demo-self.html[Installing a self-managed Elastic Stack].

[[rpm-key]]
==== Import the Elastic PGP key

Expand Down
8 changes: 4 additions & 4 deletions x-pack/plugins/fleet/server/services/epm/packages/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,13 @@ async function installPackageCommon(options: {
return { error: err, installType, installSource };
}

const savedObjectsImporter = appContextService
.getSavedObjects()
.createImporter(savedObjectsClient, { importSizeLimit: 15_000 });

// Saved object client need to be scopped with the package space for saved object tagging
const savedObjectClientWithSpace = appContextService.getInternalUserSOClientForSpaceId(spaceId);

const savedObjectsImporter = appContextService
.getSavedObjects()
.createImporter(savedObjectClientWithSpace, { importSizeLimit: 15_000 });

const savedObjectTagAssignmentService = appContextService
.getSavedObjectsTagging()
.createInternalAssignmentService({ client: savedObjectClientWithSpace });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { INGEST_SAVED_OBJECT_INDEX } from '@kbn/core-saved-objects-server';
import expect from '@kbn/expect';
import { PACKAGES_SAVED_OBJECT_TYPE } from '@kbn/fleet-plugin/common';
import pRetry from 'p-retry';
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
import { skipIfNoDockerRegistry } from '../../helpers';
Expand All @@ -19,6 +21,8 @@ export default function (providerContext: FtrProviderContext) {
const dockerServers = getService('dockerServers');
const esArchiver = getService('esArchiver');
const server = dockerServers.get('registry');
const es = getService('es');

const pkgName = 'system';
const pkgVersion = '1.27.0';

Expand All @@ -37,7 +41,7 @@ export default function (providerContext: FtrProviderContext) {
};

const installPackageInSpace = async (pkg: string, version: string, spaceId: string) => {
await supertest
return supertest
.post(`/s/${spaceId}/api/fleet/epm/packages/${pkg}/${version}`)
.set('kbn-xsrf', 'xxxx')
.send({ force: true })
Expand Down Expand Up @@ -68,7 +72,7 @@ export default function (providerContext: FtrProviderContext) {
})
.catch(() => {});

describe.skip('When installing system integration in multiple spaces', async () => {
describe('When installing system integration in multiple spaces', async () => {
skipIfNoDockerRegistry(providerContext);
setupFleetAndAgents(providerContext);

Expand Down Expand Up @@ -130,5 +134,41 @@ export default function (providerContext: FtrProviderContext) {
const spaceTag = await getTag(`fleet-pkg-${pkgName}-fleet_test_space`, testSpaceId);
expect(spaceTag).not.equal(undefined);
});

it('should keep assets in space when format version is bumped', async () => {
const nginxPkgName = 'nginx';
const nginxPkgVersion = '1.17.0';

const installResponse = await installPackageInSpace(
nginxPkgName,
nginxPkgVersion,
testSpaceId
);

const firstAsset = installResponse.body.items.find((item: any) => item.type === 'dashboard');

// Bump format version directly on installation saved object, then call setup to trigger a reinstall
await es.update({
index: INGEST_SAVED_OBJECT_INDEX,
id: `${PACKAGES_SAVED_OBJECT_TYPE}:${nginxPkgName}`,
body: {
doc: {
[PACKAGES_SAVED_OBJECT_TYPE]: {
install_format_schema_version: '99.99.99',
},
},
},
});

await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxxx').send();

const res = await es.get({
index: '.kibana_analytics',
id: `${firstAsset.type}:${firstAsset.id}`,
});

expect(res.found).to.be(true);
expect((res._source as any).namespaces).to.eql([testSpaceId]);
});
});
}

0 comments on commit da7ec4c

Please sign in to comment.