UNPKG

steadybit

Version:

Command-line interface to interact with the Steadybit API

56 lines 4.32 kB
#!/usr/bin/env node "use strict"; // SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2022 Steadybit GmbH Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const exec_1 = require("../experiment/exec"); const get_1 = require("../experiment/get"); const dump_1 = require("../experiment/dump"); const apply_1 = require("../experiment/apply"); const delete_1 = require("../experiment/delete"); const requirements_1 = require("./requirements"); const program = new commander_1.Command(); program .command('run') .alias('exec') .description('Executes an experiment run. If a file is specified the experiment is saved before execution.') .addOption(new commander_1.Option('-k, --key <key>', 'The experiment key.').conflicts('file')) .addOption(new commander_1.Option('-f, --file <files...>', 'The path to the experiment file or a directory containing multiple files.').conflicts('key')) .addOption(new commander_1.Option('-R, --recursive', 'Process the directory used in -f, --file recursively. Useful when you want to manage related experiments organized within the same directory.').default(false)) .addOption(new commander_1.Option('--no-wait', 'Do not wait for experiment run to finish.')) .addOption(new commander_1.Option('--yes', 'Skip the prompt asking for experiment run confirmation. Not necessary when no TTY is attached.').default(false)) .addOption(new commander_1.Option('--allowParallel', 'Skip the prompt warning about another experiment running and allow always parallel execution.').default(false)) .addOption(new commander_1.Option('--retries <number>', 'Number of retries when the experiment fails validation (e.g., missing targets). 0 means no retry.') .default(0) .argParser(parseInt)) .addOption(new commander_1.Option('--retryInterval <seconds>', 'Interval in seconds between retries.').default(10).argParser(parseInt)) .action((0, requirements_1.requirePlatformAccess)(exec_1.executeExperiments)); program .command('get') .description('Get an experiment from Steadybit. Output is written to file or stdout.') .addOption(new commander_1.Option('-k, --key <key>', 'The experiment key.').makeOptionMandatory(true)) .addOption(new commander_1.Option('-f, --file <file>', 'The path to the experiment file.')) .addOption(new commander_1.Option('-t, --type <type>', 'The output format of the experiment ("json" or "yaml"). (default: if a file with ".json"-suffix is given: "json", "yaml" otherwise.)' // intentionally documented here and not using .default(flags, description) as otherwise the file-extension-logic isn't working )) .action((0, requirements_1.requirePlatformAccess)(get_1.getExperiment)); program .command('apply') .description('Upload an experiment to Steadybit. If a key is provided, an update is performed. Otherwise, the externalId from the file is used to create or update the experiment.') .addOption(new commander_1.Option('-k, --key <key>', 'The experiment key.')) .addOption(new commander_1.Option('-f, --file <files...>', 'The path to the experiment file or a directory containing multiple files').makeOptionMandatory(true)) .addOption(new commander_1.Option('-R, --recursive', 'Process the directory used in -f, --file recursively. Useful when you want to manage related experiments organized within the same directory.').default(false)) .action((0, requirements_1.requirePlatformAccess)(apply_1.applyExperiments)); program .command('delete') .description('Delete an experiment from Steadybit.') .addOption(new commander_1.Option('-k, --key <key>', 'The experiment key.').makeOptionMandatory(true)) .action((0, requirements_1.requirePlatformAccess)(delete_1.deleteExperiment)); program .command('dump') .description('Dump all experiments and executions from all teams in Steadybit.') .addOption(new commander_1.Option('-d, --directory <dir>', 'The path to dump all the experiments to').default('.')) .addOption(new commander_1.Option('-t, --type <type>', 'The output format of the experiment ("json" or "yaml").').default('yaml')) .action((0, requirements_1.requirePlatformAccess)(dump_1.dump)); program.parseAsync(process.argv); //# sourceMappingURL=steadybit-experiment.js.map