Skip to content

Commit

Permalink
fix: solo deployment create should use email address in local config …
Browse files Browse the repository at this point in the history
…if it is already there instead of prompting the user for it (#1112)

Signed-off-by: instamenta <[email protected]>
  • Loading branch information
instamenta authored Jan 7, 2025
1 parent 3ff635b commit 362df60
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
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 {type K8} from '../k8.js';
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 @@ export class LocalConfig implements LocalConfigData {
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);
}

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

0 comments on commit 362df60

Please sign in to comment.