Skip to content

Commit

Permalink
[Fleet] Fix branch conditions to check against main and add skip ve…
Browse files Browse the repository at this point in the history
…rsion check config option (#116530) (#116787)
  • Loading branch information
kibanamachine authored Oct 29, 2021
1 parent 69cb2d3 commit 4e9b779
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions x-pack/plugins/fleet/common/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export interface FleetConfigType {
packages?: PreconfiguredPackage[];
outputs?: PreconfiguredOutput[];
agentIdVerificationEnabled?: boolean;
developer?: {
disableRegistryVersionCheck?: boolean;
};
}

// Calling Object.entries(PackagesGroupedByStatus) gave `status: string`
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/fleet/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ export const config: PluginConfigDescriptor = {
agentPolicies: PreconfiguredAgentPoliciesSchema,
outputs: PreconfiguredOutputsSchema,
agentIdVerificationEnabled: schema.boolean({ defaultValue: true }),
developer: schema.object({
// TODO: change default to false as soon as EPR issue fixed. Blocker for 8.0.
disableRegistryVersionCheck: schema.boolean({ defaultValue: true }),
}),
}),
};

Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/fleet/server/mocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export const createAppContextStartContractMock = (): MockedFleetAppContext => {
agentIdVerificationEnabled: true,
},
config$,
kibanaVersion: '8.0.0',
kibanaBranch: 'master',
kibanaVersion: '8.99.0', // Fake version :)
kibanaBranch: 'main',
};
};

Expand Down
7 changes: 7 additions & 0 deletions x-pack/plugins/fleet/server/services/epm/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ export async function fetchFile(filePath: string): Promise<Response> {
}

function setKibanaVersion(url: URL) {
// TODO: change default to false as soon as EPR issue fixed. Blocker for 8.0.
const disableVersionCheck =
appContextService.getConfig()?.developer?.disableRegistryVersionCheck ?? true;
if (disableVersionCheck) {
return;
}

const kibanaVersion = appContextService.getKibanaVersion().split('-')[0]; // may be x.y.z-SNAPSHOT
const kibanaBranch = appContextService.getKibanaBranch();

Expand Down

0 comments on commit 4e9b779

Please sign in to comment.