Skip to content
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

fix: solo deployment create should use email address in local config if it is already there instead of prompting the user for it #1112

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/commands/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export class DeploymentCommand extends BaseCommand {
self.configManager.update(argv);
self.logger.debug('Updated config with argv', {config: self.configManager.config});

await self.configManager.executePrompt(task, DeploymentCommand.DEPLOY_FLAGS_LIST);
await self.configManager.executePrompt(task, [
flags.contextClusterUnparsed,
flags.namespace,
flags.deploymentClusters,
]);

ctx.config = {
contextClusterUnparsed: self.configManager.getFlag<string>(flags.contextClusterUnparsed),
Expand Down
10 changes: 7 additions & 3 deletions src/core/config/local_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*
*/
import {IsEmail, IsNotEmpty, IsObject, IsString, validateSync} from 'class-validator';
import type {ListrTask, ListrTaskWrapper} from 'listr2';
import fs from 'fs';
import * as yaml from 'yaml';
import {Flags as flags} from '../../commands/flags.js';
Expand All @@ -35,6 +34,7 @@
import {splitFlagInput} from '../helpers.js';
import {inject, injectable} from 'tsyringe-neo';
import {patchInject} from '../container_helper.js';
import type {SoloListrTask, SoloListrTaskWrapper} from '../../types/index.js';

@injectable()
export class LocalConfig implements LocalConfigData {
Expand Down Expand Up @@ -162,13 +162,17 @@
this.logger.info(`Wrote local config to ${this.filePath}: ${yamlContent}`);
}

public promptLocalConfigTask(k8: K8): ListrTask<any, any, any> {
public promptLocalConfigTask(k8: K8): SoloListrTask<any> {
const self = this;

return {
title: 'Prompt local configuration',
skip: this.skipPromptTask,
task: async (_: any, task: ListrTaskWrapper<any, any, any>): Promise<void> => {
task: async (_: any, task: SoloListrTaskWrapper<any>): Promise<void> => {
if (self.configFileExists) {
self.configManager.setFlag(flags.userEmailAddress, self.userEmailAddress);
}

Check warning on line 175 in src/core/config/local_config.ts

View check run for this annotation

Codecov / codecov/patch

src/core/config/local_config.ts#L171-L175

Added lines #L171 - L175 were not covered by tests
const isQuiet = self.configManager.getFlag<boolean>(flags.quiet);
const contexts = self.configManager.getFlag<string>(flags.context);
const deploymentName = self.configManager.getFlag<Namespace>(flags.namespace);
Expand Down
Loading