-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ingest Management] main branch uses epr-snapshot. Others production #73555
Changes from 8 commits
62ba64a
0ddafdd
de149f8
35fedc2
381bbf7
4746210
65d2074
d49f968
421f3ac
61abba4
33a98da
4c9f212
86ba25a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,5 +43,4 @@ export { | |
// Defaults | ||
DEFAULT_AGENT_CONFIG, | ||
DEFAULT_OUTPUT, | ||
DEFAULT_REGISTRY_URL, | ||
} from '../../common'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,26 +3,50 @@ | |
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { DEFAULT_REGISTRY_URL } from '../../../constants'; | ||
import { appContextService, licenseService } from '../../'; | ||
|
||
// from https://github.com/elastic/package-registry#docker (maybe from OpenAPI one day) | ||
// the unused variables cause a TS warning about unused values | ||
// chose to comment them out vs @ts-ignore or @ts-expect-error on each line | ||
|
||
const PRODUCTION_REGISTRY_URL_CDN = 'https://epr.elastic.co'; | ||
// const STAGING_REGISTRY_URL_CDN = 'https://epr-staging.elastic.co'; | ||
// const EXPERIMENTAL_REGISTRY_URL_CDN = 'https://epr-experimental.elastic.co/'; | ||
const SNAPSHOT_REGISTRY_URL_CDN = 'https://epr-snapshot.elastic.co'; | ||
|
||
// const PRODUCTION_REGISTRY_URL_NO_CDN = 'https://epr.ea-web.elastic.dev'; | ||
// const STAGING_REGISTRY_URL_NO_CDN = 'https://epr-staging.ea-web.elastic.dev'; | ||
// const EXPERIMENTAL_REGISTRY_URL_NO_CDN = 'https://epr-experimental.ea-web.elastic.dev/'; | ||
// const SNAPSHOT_REGISTRY_URL_NO_CDN = 'https://epr-snapshot.ea-web.elastic.dev'; | ||
|
||
const getDefaultRegistryUrl = (): string => { | ||
let branch; | ||
try { | ||
branch = appContextService.getKibanaBranch(); | ||
} catch (error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Under what conditions can kibana branch not be set? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. During the test:ftr Endpoint tests. The error seems in the ftr:runner portion. On the phone right now, but check the stack trace in #73555 (comment) I can add details about what I saw while debugging later It was a good reminder that those methods throw :( |
||
// eslint-disable-next-line no-console | ||
console.error(error); | ||
} | ||
|
||
if (branch === 'master') { | ||
return SNAPSHOT_REGISTRY_URL_CDN; | ||
} else { | ||
return PRODUCTION_REGISTRY_URL_CDN; | ||
} | ||
}; | ||
|
||
export const getRegistryUrl = (): string => { | ||
const license = licenseService.getLicenseInformation(); | ||
const customUrl = appContextService.getConfig()?.registryUrl; | ||
const isGoldPlus = license?.isAvailable && license?.isActive && license?.hasAtLeast('gold'); | ||
|
||
if ( | ||
customUrl && | ||
license && | ||
license.isAvailable && | ||
license.hasAtLeast('gold') && | ||
license.isActive | ||
) { | ||
if (customUrl && isGoldPlus) { | ||
return customUrl; | ||
} | ||
|
||
if (customUrl) { | ||
appContextService.getLogger().warn('Gold license is required to use a custom registry url.'); | ||
} | ||
|
||
return DEFAULT_REGISTRY_URL; | ||
return getDefaultRegistryUrl(); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Experimental should not be here as this will never apply for master or anything coming out of master. Same on line 19.