diff --git a/README.md b/README.md index c36f02b..7b506fd 100644 --- a/README.md +++ b/README.md @@ -87,16 +87,17 @@ buddy-cli pl r [pipeline] ``` Options: ``` - -v, --version Show version - -h, --help Show help - -j, --json Output json - -t, --token The token used to authenticate the request - -u, --url The base URL for the app (default: api.buddy.works) - -w, --workspace The name of the workspace in which the command is run - -p, --project The name of the project in which the command is run - -r, --revision The revision from the repository that will be executed in the pipeline - -c, --comment The execution comment - -f, --refresh Execute from scratch + -v, --version Show version + -h, --help Show help + -j, --json Output json + -t, --token The token used to authenticate the request + -u, --url The base URL for the app (default: api.buddy.works) + -w, --workspace The name of the workspace in which the command is run + -p, --project The name of the project in which the command is run + -r, --revision The revision from the repository that will be executed in the pipeline + -c, --comment The execution comment + -f, --refresh Execute from scratch + -e, --environment Set environment variables for this execution ``` #### Retry pipeline diff --git a/src/api.js b/src/api.js index 44cd6a8..63a2420 100644 --- a/src/api.js +++ b/src/api.js @@ -183,6 +183,14 @@ function Api() { } if (args.comment) params.comment = args.comment; if (args.refresh) params.refresh = true; + if (args.environment) { + let variables = args.environment; + if (!Array.isArray(variables)) variables = [variables]; + params.variables = variables.map((pair) => { + let [key, value] = pair.split(/=(.+)/); + return {key, value}; + }); + } client.post('/workspaces/:workspace/projects/:project/pipelines/:pipeline/executions', {}, args, params, done); }; /** diff --git a/src/cmds/pipeline/run.js b/src/cmds/pipeline/run.js index 4ae18aa..cee5031 100644 --- a/src/cmds/pipeline/run.js +++ b/src/cmds/pipeline/run.js @@ -60,6 +60,11 @@ module.exports.builder = { describe: 'Execute from scratch', type: 'boolean', }, + e: { + alias: 'environment', + describe: 'Set environment variables', + type: 'string', + }, }; module.exports.request = (args, done) => api.runPipeline(args, done);