diff --git a/src/api/context.ts b/src/api/context.ts index 6ba1c0478..3fa65b6ee 100644 --- a/src/api/context.ts +++ b/src/api/context.ts @@ -55,8 +55,8 @@ export namespace ChectlContext { ctx[COMMAND_ID] = command.id ctx[LOGS_DIRECTORY] = path.resolve(flags[LOG_DIRECTORY_KEY] ? flags[LOG_DIRECTORY_KEY] : path.resolve(os.tmpdir(), 'chectl-logs', Date.now().toString())) - ctx[CUSTOM_CR] = readCRFile(flags, CHE_OPERATOR_CR_YAML_KEY) - ctx[CR_PATCH] = readCRFile(flags, CHE_OPERATOR_CR_PATCH_YAML_KEY) + ctx[CUSTOM_CR] = readCRFile(flags, CHE_OPERATOR_CR_YAML_KEY) || {} + ctx[CR_PATCH] = readCRFile(flags, CHE_OPERATOR_CR_PATCH_YAML_KEY) || {} } export async function initAndGet(flags: any, command: Command): Promise { diff --git a/src/commands/server/update.ts b/src/commands/server/update.ts index 983001acb..6aba09d76 100644 --- a/src/commands/server/update.ts +++ b/src/commands/server/update.ts @@ -141,21 +141,23 @@ export default class Update extends Command { if (projectName === 'chectl' && latestChectlVersion) { // suggest update chectl first if (currentChectlVersion !== latestChectlVersion) { - cli.warn(`'chectl' tool is not up to date. -Update 'chectl' first: 'chectl update ${chectlChannel}' and then try again.`) - } else if (chectlChannel === 'stable' && !flags[CHE_OPERATOR_CR_PATCH_YAML_KEY]) { + cli.warn(`It is not possible to update Eclipse Che to a newer version +using the current '${currentChectlVersion}' version of chectl. Please, update 'chectl' +to a newer version '${latestChectlVersion}' with the command 'chectl update ${chectlChannel}' +and then try again.`) + } else if (!flags[CHE_OPERATOR_CR_PATCH_YAML_KEY]) { // same version, no patch then nothing to update cli.info('Eclipse Che is already up to date.') this.exit(0) } - } else if (projectName !== 'chectl') { + } else { // unknown project, no patch file then suggest to update if (!flags[CHE_OPERATOR_CR_PATCH_YAML_KEY]) { - cli.info(`Update '${getCurrentChectlName()}' first and then try again.`) + cli.warn(`It is not possible to update Eclipse Che to a newer version +using the current '${currentChectlVersion}' version of '${getCurrentChectlName()}'. +Please, update '${getCurrentChectlName()}' and then try again.`) this.exit(0) } - } else { - cli.warn('') } // custom operator image is used } else if (newOperatorImage !== DEFAULT_CHE_OPERATOR_IMAGE) { @@ -181,43 +183,43 @@ Consider removing '--che-operator-image' to update Eclipse Che operator to the s const crPatch = ctx[ChectlContext.CR_PATCH] if (cheCluster.spec.server.pluginRegistryImage && (!crPatch.spec || !crPatch.spec.server || !crPatch.spec.server.pluginRegistryImage)) { - imagesListMsg += `- Plugin registry image: ${cheCluster.spec.server.pluginRegistryImage}\n` + imagesListMsg += `\n - Plugin registry image: ${cheCluster.spec.server.pluginRegistryImage}` merge(ctx[ChectlContext.CR_PATCH], { spec: { server: { pluginRegistryImage: '' } } }) } if (cheCluster.spec.server.devfileRegistryImage && (!crPatch.spec || !crPatch.spec.server || !crPatch.spec.server.devfileRegistryImage)) { - imagesListMsg += `- Devfile registry image: ${cheCluster.spec.server.devfileRegistryImage}\n` + imagesListMsg += `\n - Devfile registry image: ${cheCluster.spec.server.devfileRegistryImage}` merge(ctx[ChectlContext.CR_PATCH], { spec: { server: { devfileRegistryImage: '' } } }) } if (cheCluster.spec.server.postgresImage && (!crPatch.spec || !crPatch.spec.database || !crPatch.spec.database.postgresImage)) { - imagesListMsg += `- Postgres image: ${cheCluster.spec.database.postgresImage}\n` + imagesListMsg += `\n - Postgres image: ${cheCluster.spec.database.postgresImage}` merge(ctx[ChectlContext.CR_PATCH], { spec: { database: { postgresImage: '' } } }) } if (cheCluster.spec.server.identityProviderImage && (!crPatch.spec || !crPatch.spec.auth || !crPatch.spec.auth.identityProviderImage)) { - imagesListMsg += `- Identity provider image: ${cheCluster.spec.auth.identityProviderImage}\n` + imagesListMsg += `\n - Identity provider image: ${cheCluster.spec.auth.identityProviderImage}` merge(ctx[ChectlContext.CR_PATCH], { spec: { auth: { identityProviderImage: '' } } }) } if (cheCluster.spec.server.cheImage && (!crPatch.spec || !crPatch.spec.server || !crPatch.spec.server.cheImage)) { - imagesListMsg += `- Eclipse Che server image name: ${cheCluster.spec.server.cheImage}\n` + imagesListMsg += `\n - Eclipse Che server image name: ${cheCluster.spec.server.cheImage}` merge(ctx[ChectlContext.CR_PATCH], { spec: { server: { cheImage: '' } } }) } if (cheCluster.spec.server.cheImageTag && (!crPatch.spec || !crPatch.spec.server || !crPatch.spec.server.cheImageTag)) { - imagesListMsg += `- Eclipse Che server image tag: ${cheCluster.spec.server.cheImageTag}\n` + imagesListMsg += `\n - Eclipse Che server image tag: ${cheCluster.spec.server.cheImageTag}` merge(ctx[ChectlContext.CR_PATCH], { spec: { server: { cheImageTag: '' } } }) } if (imagesListMsg) { - cli.warn(`In order to update Eclipse Che to a new version the fields defining the images in the '${cheCluster.metadata.name}' -Custom Resource of the namespace '${flags.chenamespace}' will be cleaned up.\n${imagesListMsg}`) + cli.warn(`In order to update Eclipse Che to a newer version the fields defining the images in the '${cheCluster.metadata.name}' +Custom Resource in the '${flags.chenamespace}' namespace will be cleaned up:${imagesListMsg}`) if (!flags.yes && !await cli.confirm('If you want to continue - press Y')) { this.exit(0) } diff --git a/yarn.lock b/yarn.lock index 424329003..1ac978dc9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2126,7 +2126,7 @@ ecc-jsbn@~0.1.1: "eclipse-che-devfile-workspace-operator@git://github.com/devfile/devworkspace-operator#master": version "0.0.0" - resolved "git://github.com/devfile/devworkspace-operator#b1fd56a21bdbb9865163cf46e72569262a5397b7" + resolved "git://github.com/devfile/devworkspace-operator#55769df6e901c37b38384dc231e4abc5fbcdb96e" "eclipse-che-minishift@git://github.com/minishift/minishift#master": version "0.0.0" @@ -2134,11 +2134,11 @@ ecc-jsbn@~0.1.1: "eclipse-che-operator@git://github.com/eclipse/che-operator#master": version "0.0.0" - resolved "git://github.com/eclipse/che-operator#f917b982818c46485d2027d531c30067ac2c45e8" + resolved "git://github.com/eclipse/che-operator#ed3df35359b648d19a5a775f3a2e140f5da96933" "eclipse-che@git://github.com/eclipse/che#master": version "0.0.0" - resolved "git://github.com/eclipse/che#f817a510e463d4f536fd2a97ca88942f17b31ead" + resolved "git://github.com/eclipse/che#55f29d64afc073125c7c623fe6d5f9ddf09e1100" editorconfig@^0.15.0: version "0.15.3"