import { createClusterIfNotExists , setupCluster , switchToClusterFromEnv } from 'src/lib/cluster' ; import { exitIfCelotoolHelmDryRun } from 'src/lib/helm_deploy' ; import { installPrometheusIfNotExists } from 'src/lib/prometheus' ; import { deploy } from 'src/lib/vm-testnet-utils' ; import yargs from 'yargs' ; import { InitialArgv } from '../../deploy/initial' ; export const command = 'vm-testnet' ; export const describe = 'upgrade a testnet on a VM' ; type VmTestnetArgv = InitialArgv & { skipSecretGeneration : boolean ; useExistingGenesis : boolean ; } ; export const builder = ( argv ) => { return argv . option ( 'skipSecretGeneration' , { describe : 'Skips the generation of secrets. Use sparingly, this is intended to save deploy time if you are certain no secrets will have changed.' , default : false , type : 'boolean' , } ) . option ( 'useExistingGenesis' , { type : 'boolean' , description : 'Instead of generating a new genesis, use an existing genesis in GCS' , default : false , } ) ; } ; export const handler = async ( argv ) => { exitIfCelotoolHelmDryRun ( ) ; await deploy ( argv . celoEnv , ! argv . skipSecretGeneration , argv . useExistingGenesis ) ; const createdCluster = await createClusterIfNotExists ( ) ; await switchToClusterFromEnv ( argv . celoEnv ) ; await setupCluster ( argv . celoEnv , createdCluster ) ; await installPrometheusIfNotExists ( ) ; } ;