@commercetools-frontend/deployment-cli 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148,12 +148,12 @@ function paginateToDeploymentPipeline(_x) {
148
148
  }
149
149
  function _paginateToDeploymentPipeline() {
150
150
  _paginateToDeploymentPipeline = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(_ref5) {
151
- var circleCiApis, buildRevision, debug, maxPages, deploymentPipeline, nextPageToken, i, _context8, _context9, pipelineRequest, pipelines, nonScheduledPipelines, _context10, _context11;
151
+ var circleCiApis, buildRevision, branch, debug, maxPages, deploymentPipeline, nextPageToken, i, _context8, _context9, pipelineRequest, pipelines, nonScheduledPipelines, _context10, _context11;
152
152
  return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context13) {
153
153
  while (1) {
154
154
  switch (_context13.prev = _context13.next) {
155
155
  case 0:
156
- circleCiApis = _ref5.circleCiApis, buildRevision = _ref5.buildRevision, debug = _ref5.debug, maxPages = _ref5.maxPages;
156
+ circleCiApis = _ref5.circleCiApis, buildRevision = _ref5.buildRevision, branch = _ref5.branch, debug = _ref5.debug, maxPages = _ref5.maxPages;
157
157
  i = 0;
158
158
  case 2:
159
159
  if (!(i < maxPages)) {
@@ -162,7 +162,8 @@ function _paginateToDeploymentPipeline() {
162
162
  }
163
163
  // eslint-disable-next-line no-await-in-loop
164
164
  pipelineRequest = circleCiApis.pipelines({
165
- pageToken: nextPageToken
165
+ pageToken: nextPageToken,
166
+ branch: branch
166
167
  });
167
168
  _context13.next = 6;
168
169
  return pipelineRequest.execute({
@@ -207,12 +208,12 @@ function collectDeploymentPipelines(_x2) {
207
208
  }
208
209
  function _collectDeploymentPipelines() {
209
210
  _collectDeploymentPipelines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(_ref6) {
210
- var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, nextPageToken, i, _context14, _context15, pipelinesRequest, pipelines, nonScheduledPipelines;
211
+ var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, nextPageToken, i, _context14, _context15, pipelinesRequest, pipelines, nonScheduledPipelines;
211
212
  return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context16) {
212
213
  while (1) {
213
214
  switch (_context16.prev = _context16.next) {
214
215
  case 0:
215
- circleCiApis = _ref6.circleCiApis, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
216
+ circleCiApis = _ref6.circleCiApis, branch = _ref6.branch, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
216
217
  deploymentPipelines = [];
217
218
  i = 0;
218
219
  case 3:
@@ -222,7 +223,8 @@ function _collectDeploymentPipelines() {
222
223
  }
223
224
  // eslint-disable-next-line no-await-in-loop
224
225
  pipelinesRequest = circleCiApis.pipelines({
225
- pageToken: nextPageToken
226
+ pageToken: nextPageToken,
227
+ branch: branch
226
228
  });
227
229
  _context16.next = 7;
228
230
  return pipelinesRequest.execute({
@@ -252,14 +254,15 @@ function waitForDeploymentPipelinePrompt(_x3) {
252
254
  }
253
255
  function _waitForDeploymentPipelinePrompt() {
254
256
  _waitForDeploymentPipelinePrompt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(_ref7) {
255
- var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
257
+ var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
256
258
  return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context17) {
257
259
  while (1) {
258
260
  switch (_context17.prev = _context17.next) {
259
261
  case 0:
260
- circleCiApis = _ref7.circleCiApis, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
262
+ circleCiApis = _ref7.circleCiApis, branch = _ref7.branch, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
261
263
  _context17.next = 3;
262
264
  return collectDeploymentPipelines({
265
+ branch: branch,
263
266
  pagesForPipelineSelection: pagesForPipelineSelection,
264
267
  circleCiApis: circleCiApis,
265
268
  debug: debug
@@ -443,6 +446,7 @@ function _approve() {
443
446
  return paginateToDeploymentPipeline({
444
447
  circleCiApis: circleCiApis,
445
448
  buildRevision: cliFlags.buildRevision,
449
+ branch: cliFlags.branch,
446
450
  debug: cliFlags.debug,
447
451
  maxPages: (_config$CircleCI$pagi = (_config$CircleCI$pagi2 = config.CircleCI.pagination) === null || _config$CircleCI$pagi2 === void 0 ? void 0 : _config$CircleCI$pagi2.maxPages) !== null && _config$CircleCI$pagi !== void 0 ? _config$CircleCI$pagi : 1
448
452
  });
@@ -453,6 +457,7 @@ function _approve() {
453
457
  case 18:
454
458
  _context8.next = 20;
455
459
  return waitForDeploymentPipelinePrompt({
460
+ branch: cliFlags.branch,
456
461
  circleCiApis: circleCiApis,
457
462
  pagesForPipelineSelection: (_config$CircleCI$pagi3 = (_config$CircleCI$pagi4 = config.CircleCI.pagination) === null || _config$CircleCI$pagi4 === void 0 ? void 0 : _config$CircleCI$pagi4.pagesForPipelineSelection) !== null && _config$CircleCI$pagi3 !== void 0 ? _config$CircleCI$pagi3 : 1,
458
463
  debug: cliFlags.debug
@@ -829,13 +834,16 @@ function _run() {
829
834
  alias: {
830
835
  help: ['h']
831
836
  },
832
- boolean: ['dry-run', 'debug', 'yes']
837
+ boolean: ['dry-run', 'debug', 'yes'],
838
+ default: {
839
+ branch: 'main'
840
+ }
833
841
  });
834
842
  cliCommands = cliFlags._;
835
843
  if (cliCommands.length === 0 ||
836
844
  // @ts-expect-error mri is not typed for the help command.
837
845
  cliCommands.help && cliCommands.length === 0) {
838
- console.log("\nUsage: deployment-cli [command] [flags]\n\nDisplays help information.\n\nCommand:\n approve Approves a job and by this triggers a deployment of a component. It requires a \"CIRCLE_TOKEN\" environment variable (https://circleci.com/docs/2.0/managing-api-tokens/).\n\nOptions:\n --approval-job The name of the approval job to approve a deployment with.\n --deployment-job (optional) The name of the deployment job triggered by the approval job. If passed the CLI will print a URL to the deployment triggered on CircleCI.\n --deployment (optional) The name of a deployment configured in the configuration file.\n --build-revision <git-sha> (optional) The git commit SHA that needs to be deployed. If not specified, the last successful pipeline is used.\n --yes (optional) Skip all confirmation prompts. Useful in Continuous integration (CI) to automatically answer confirmation questions.\n\nGeneral options:\n --dry-run (optional) Simulate a deployment.\n --debug (optional) Print additional debug information.\n");
846
+ console.log("\nUsage: deployment-cli [command] [flags]\n\nDisplays help information.\n\nCommand:\n approve Approves a job and by this triggers a deployment of a component. It requires a \"CIRCLE_TOKEN\" environment variable (https://circleci.com/docs/2.0/managing-api-tokens/).\n\nOptions:\n --approval-job The name of the approval job to approve a deployment with.\n --deployment-job (optional) The name of the deployment job triggered by the approval job. If passed the CLI will print a URL to the deployment triggered on CircleCI.\n --deployment (optional) The name of a deployment configured in the configuration file.\n --build-revision <git-sha> (optional) The git commit SHA that needs to be deployed. If not specified, the last successful pipeline is used.\n --branch (optional) The git branch to deploy from. If not specified, defaults to 'main'.\n --yes (optional) Skip all confirmation prompts. Useful in Continuous integration (CI) to automatically answer confirmation questions.\n\nGeneral options:\n --dry-run (optional) Simulate a deployment.\n --debug (optional) Print additional debug information.\n");
839
847
  process.exit(0);
840
848
  }
841
849
  cliCommand = cliCommands[0];
@@ -851,6 +859,7 @@ function _run() {
851
859
  _context2.next = 18;
852
860
  return approve({
853
861
  deployment: cliFlags.deployment,
862
+ branch: cliFlags.branch,
854
863
  approvalJob: cliFlags['approval-job'],
855
864
  deploymentJob: cliFlags['deployment-job'],
856
865
  buildRevision: cliFlags['build-revision'],
@@ -148,12 +148,12 @@ function paginateToDeploymentPipeline(_x) {
148
148
  }
149
149
  function _paginateToDeploymentPipeline() {
150
150
  _paginateToDeploymentPipeline = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(_ref5) {
151
- var circleCiApis, buildRevision, debug, maxPages, deploymentPipeline, nextPageToken, i, _context8, _context9, pipelineRequest, pipelines, nonScheduledPipelines, _context10, _context11;
151
+ var circleCiApis, buildRevision, branch, debug, maxPages, deploymentPipeline, nextPageToken, i, _context8, _context9, pipelineRequest, pipelines, nonScheduledPipelines, _context10, _context11;
152
152
  return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context13) {
153
153
  while (1) {
154
154
  switch (_context13.prev = _context13.next) {
155
155
  case 0:
156
- circleCiApis = _ref5.circleCiApis, buildRevision = _ref5.buildRevision, debug = _ref5.debug, maxPages = _ref5.maxPages;
156
+ circleCiApis = _ref5.circleCiApis, buildRevision = _ref5.buildRevision, branch = _ref5.branch, debug = _ref5.debug, maxPages = _ref5.maxPages;
157
157
  i = 0;
158
158
  case 2:
159
159
  if (!(i < maxPages)) {
@@ -162,7 +162,8 @@ function _paginateToDeploymentPipeline() {
162
162
  }
163
163
  // eslint-disable-next-line no-await-in-loop
164
164
  pipelineRequest = circleCiApis.pipelines({
165
- pageToken: nextPageToken
165
+ pageToken: nextPageToken,
166
+ branch: branch
166
167
  });
167
168
  _context13.next = 6;
168
169
  return pipelineRequest.execute({
@@ -207,12 +208,12 @@ function collectDeploymentPipelines(_x2) {
207
208
  }
208
209
  function _collectDeploymentPipelines() {
209
210
  _collectDeploymentPipelines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(_ref6) {
210
- var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, nextPageToken, i, _context14, _context15, pipelinesRequest, pipelines, nonScheduledPipelines;
211
+ var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, nextPageToken, i, _context14, _context15, pipelinesRequest, pipelines, nonScheduledPipelines;
211
212
  return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context16) {
212
213
  while (1) {
213
214
  switch (_context16.prev = _context16.next) {
214
215
  case 0:
215
- circleCiApis = _ref6.circleCiApis, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
216
+ circleCiApis = _ref6.circleCiApis, branch = _ref6.branch, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
216
217
  deploymentPipelines = [];
217
218
  i = 0;
218
219
  case 3:
@@ -222,7 +223,8 @@ function _collectDeploymentPipelines() {
222
223
  }
223
224
  // eslint-disable-next-line no-await-in-loop
224
225
  pipelinesRequest = circleCiApis.pipelines({
225
- pageToken: nextPageToken
226
+ pageToken: nextPageToken,
227
+ branch: branch
226
228
  });
227
229
  _context16.next = 7;
228
230
  return pipelinesRequest.execute({
@@ -252,14 +254,15 @@ function waitForDeploymentPipelinePrompt(_x3) {
252
254
  }
253
255
  function _waitForDeploymentPipelinePrompt() {
254
256
  _waitForDeploymentPipelinePrompt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(_ref7) {
255
- var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
257
+ var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
256
258
  return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context17) {
257
259
  while (1) {
258
260
  switch (_context17.prev = _context17.next) {
259
261
  case 0:
260
- circleCiApis = _ref7.circleCiApis, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
262
+ circleCiApis = _ref7.circleCiApis, branch = _ref7.branch, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
261
263
  _context17.next = 3;
262
264
  return collectDeploymentPipelines({
265
+ branch: branch,
263
266
  pagesForPipelineSelection: pagesForPipelineSelection,
264
267
  circleCiApis: circleCiApis,
265
268
  debug: debug
@@ -443,6 +446,7 @@ function _approve() {
443
446
  return paginateToDeploymentPipeline({
444
447
  circleCiApis: circleCiApis,
445
448
  buildRevision: cliFlags.buildRevision,
449
+ branch: cliFlags.branch,
446
450
  debug: cliFlags.debug,
447
451
  maxPages: (_config$CircleCI$pagi = (_config$CircleCI$pagi2 = config.CircleCI.pagination) === null || _config$CircleCI$pagi2 === void 0 ? void 0 : _config$CircleCI$pagi2.maxPages) !== null && _config$CircleCI$pagi !== void 0 ? _config$CircleCI$pagi : 1
448
452
  });
@@ -453,6 +457,7 @@ function _approve() {
453
457
  case 18:
454
458
  _context8.next = 20;
455
459
  return waitForDeploymentPipelinePrompt({
460
+ branch: cliFlags.branch,
456
461
  circleCiApis: circleCiApis,
457
462
  pagesForPipelineSelection: (_config$CircleCI$pagi3 = (_config$CircleCI$pagi4 = config.CircleCI.pagination) === null || _config$CircleCI$pagi4 === void 0 ? void 0 : _config$CircleCI$pagi4.pagesForPipelineSelection) !== null && _config$CircleCI$pagi3 !== void 0 ? _config$CircleCI$pagi3 : 1,
458
463
  debug: cliFlags.debug
@@ -829,13 +834,16 @@ function _run() {
829
834
  alias: {
830
835
  help: ['h']
831
836
  },
832
- boolean: ['dry-run', 'debug', 'yes']
837
+ boolean: ['dry-run', 'debug', 'yes'],
838
+ default: {
839
+ branch: 'main'
840
+ }
833
841
  });
834
842
  cliCommands = cliFlags._;
835
843
  if (cliCommands.length === 0 ||
836
844
  // @ts-expect-error mri is not typed for the help command.
837
845
  cliCommands.help && cliCommands.length === 0) {
838
- console.log("\nUsage: deployment-cli [command] [flags]\n\nDisplays help information.\n\nCommand:\n approve Approves a job and by this triggers a deployment of a component. It requires a \"CIRCLE_TOKEN\" environment variable (https://circleci.com/docs/2.0/managing-api-tokens/).\n\nOptions:\n --approval-job The name of the approval job to approve a deployment with.\n --deployment-job (optional) The name of the deployment job triggered by the approval job. If passed the CLI will print a URL to the deployment triggered on CircleCI.\n --deployment (optional) The name of a deployment configured in the configuration file.\n --build-revision <git-sha> (optional) The git commit SHA that needs to be deployed. If not specified, the last successful pipeline is used.\n --yes (optional) Skip all confirmation prompts. Useful in Continuous integration (CI) to automatically answer confirmation questions.\n\nGeneral options:\n --dry-run (optional) Simulate a deployment.\n --debug (optional) Print additional debug information.\n");
846
+ console.log("\nUsage: deployment-cli [command] [flags]\n\nDisplays help information.\n\nCommand:\n approve Approves a job and by this triggers a deployment of a component. It requires a \"CIRCLE_TOKEN\" environment variable (https://circleci.com/docs/2.0/managing-api-tokens/).\n\nOptions:\n --approval-job The name of the approval job to approve a deployment with.\n --deployment-job (optional) The name of the deployment job triggered by the approval job. If passed the CLI will print a URL to the deployment triggered on CircleCI.\n --deployment (optional) The name of a deployment configured in the configuration file.\n --build-revision <git-sha> (optional) The git commit SHA that needs to be deployed. If not specified, the last successful pipeline is used.\n --branch (optional) The git branch to deploy from. If not specified, defaults to 'main'.\n --yes (optional) Skip all confirmation prompts. Useful in Continuous integration (CI) to automatically answer confirmation questions.\n\nGeneral options:\n --dry-run (optional) Simulate a deployment.\n --debug (optional) Print additional debug information.\n");
839
847
  process.exit(0);
840
848
  }
841
849
  cliCommand = cliCommands[0];
@@ -851,6 +859,7 @@ function _run() {
851
859
  _context2.next = 18;
852
860
  return approve({
853
861
  deployment: cliFlags.deployment,
862
+ branch: cliFlags.branch,
854
863
  approvalJob: cliFlags['approval-job'],
855
864
  deploymentJob: cliFlags['deployment-job'],
856
865
  buildRevision: cliFlags['build-revision'],
@@ -124,12 +124,12 @@ function paginateToDeploymentPipeline(_x) {
124
124
  }
125
125
  function _paginateToDeploymentPipeline() {
126
126
  _paginateToDeploymentPipeline = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref5) {
127
- var circleCiApis, buildRevision, debug, maxPages, deploymentPipeline, nextPageToken, i, _context8, _context9, pipelineRequest, pipelines, nonScheduledPipelines, _context10, _context11;
127
+ var circleCiApis, buildRevision, branch, debug, maxPages, deploymentPipeline, nextPageToken, i, _context8, _context9, pipelineRequest, pipelines, nonScheduledPipelines, _context10, _context11;
128
128
  return _regeneratorRuntime.wrap(function _callee2$(_context13) {
129
129
  while (1) {
130
130
  switch (_context13.prev = _context13.next) {
131
131
  case 0:
132
- circleCiApis = _ref5.circleCiApis, buildRevision = _ref5.buildRevision, debug = _ref5.debug, maxPages = _ref5.maxPages;
132
+ circleCiApis = _ref5.circleCiApis, buildRevision = _ref5.buildRevision, branch = _ref5.branch, debug = _ref5.debug, maxPages = _ref5.maxPages;
133
133
  i = 0;
134
134
  case 2:
135
135
  if (!(i < maxPages)) {
@@ -138,7 +138,8 @@ function _paginateToDeploymentPipeline() {
138
138
  }
139
139
  // eslint-disable-next-line no-await-in-loop
140
140
  pipelineRequest = circleCiApis.pipelines({
141
- pageToken: nextPageToken
141
+ pageToken: nextPageToken,
142
+ branch: branch
142
143
  });
143
144
  _context13.next = 6;
144
145
  return pipelineRequest.execute({
@@ -183,12 +184,12 @@ function collectDeploymentPipelines(_x2) {
183
184
  }
184
185
  function _collectDeploymentPipelines() {
185
186
  _collectDeploymentPipelines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6) {
186
- var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, nextPageToken, i, _context14, _context15, pipelinesRequest, pipelines, nonScheduledPipelines;
187
+ var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, nextPageToken, i, _context14, _context15, pipelinesRequest, pipelines, nonScheduledPipelines;
187
188
  return _regeneratorRuntime.wrap(function _callee3$(_context16) {
188
189
  while (1) {
189
190
  switch (_context16.prev = _context16.next) {
190
191
  case 0:
191
- circleCiApis = _ref6.circleCiApis, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
192
+ circleCiApis = _ref6.circleCiApis, branch = _ref6.branch, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
192
193
  deploymentPipelines = [];
193
194
  i = 0;
194
195
  case 3:
@@ -198,7 +199,8 @@ function _collectDeploymentPipelines() {
198
199
  }
199
200
  // eslint-disable-next-line no-await-in-loop
200
201
  pipelinesRequest = circleCiApis.pipelines({
201
- pageToken: nextPageToken
202
+ pageToken: nextPageToken,
203
+ branch: branch
202
204
  });
203
205
  _context16.next = 7;
204
206
  return pipelinesRequest.execute({
@@ -228,14 +230,15 @@ function waitForDeploymentPipelinePrompt(_x3) {
228
230
  }
229
231
  function _waitForDeploymentPipelinePrompt() {
230
232
  _waitForDeploymentPipelinePrompt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
231
- var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
233
+ var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
232
234
  return _regeneratorRuntime.wrap(function _callee4$(_context17) {
233
235
  while (1) {
234
236
  switch (_context17.prev = _context17.next) {
235
237
  case 0:
236
- circleCiApis = _ref7.circleCiApis, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
238
+ circleCiApis = _ref7.circleCiApis, branch = _ref7.branch, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
237
239
  _context17.next = 3;
238
240
  return collectDeploymentPipelines({
241
+ branch: branch,
239
242
  pagesForPipelineSelection: pagesForPipelineSelection,
240
243
  circleCiApis: circleCiApis,
241
244
  debug: debug
@@ -419,6 +422,7 @@ function _approve() {
419
422
  return paginateToDeploymentPipeline({
420
423
  circleCiApis: circleCiApis,
421
424
  buildRevision: cliFlags.buildRevision,
425
+ branch: cliFlags.branch,
422
426
  debug: cliFlags.debug,
423
427
  maxPages: (_config$CircleCI$pagi = (_config$CircleCI$pagi2 = config.CircleCI.pagination) === null || _config$CircleCI$pagi2 === void 0 ? void 0 : _config$CircleCI$pagi2.maxPages) !== null && _config$CircleCI$pagi !== void 0 ? _config$CircleCI$pagi : 1
424
428
  });
@@ -429,6 +433,7 @@ function _approve() {
429
433
  case 18:
430
434
  _context8.next = 20;
431
435
  return waitForDeploymentPipelinePrompt({
436
+ branch: cliFlags.branch,
432
437
  circleCiApis: circleCiApis,
433
438
  pagesForPipelineSelection: (_config$CircleCI$pagi3 = (_config$CircleCI$pagi4 = config.CircleCI.pagination) === null || _config$CircleCI$pagi4 === void 0 ? void 0 : _config$CircleCI$pagi4.pagesForPipelineSelection) !== null && _config$CircleCI$pagi3 !== void 0 ? _config$CircleCI$pagi3 : 1,
434
439
  debug: cliFlags.debug
@@ -805,13 +810,16 @@ function _run() {
805
810
  alias: {
806
811
  help: ['h']
807
812
  },
808
- boolean: ['dry-run', 'debug', 'yes']
813
+ boolean: ['dry-run', 'debug', 'yes'],
814
+ default: {
815
+ branch: 'main'
816
+ }
809
817
  });
810
818
  cliCommands = cliFlags._;
811
819
  if (cliCommands.length === 0 ||
812
820
  // @ts-expect-error mri is not typed for the help command.
813
821
  cliCommands.help && cliCommands.length === 0) {
814
- console.log("\nUsage: deployment-cli [command] [flags]\n\nDisplays help information.\n\nCommand:\n approve Approves a job and by this triggers a deployment of a component. It requires a \"CIRCLE_TOKEN\" environment variable (https://circleci.com/docs/2.0/managing-api-tokens/).\n\nOptions:\n --approval-job The name of the approval job to approve a deployment with.\n --deployment-job (optional) The name of the deployment job triggered by the approval job. If passed the CLI will print a URL to the deployment triggered on CircleCI.\n --deployment (optional) The name of a deployment configured in the configuration file.\n --build-revision <git-sha> (optional) The git commit SHA that needs to be deployed. If not specified, the last successful pipeline is used.\n --yes (optional) Skip all confirmation prompts. Useful in Continuous integration (CI) to automatically answer confirmation questions.\n\nGeneral options:\n --dry-run (optional) Simulate a deployment.\n --debug (optional) Print additional debug information.\n");
822
+ console.log("\nUsage: deployment-cli [command] [flags]\n\nDisplays help information.\n\nCommand:\n approve Approves a job and by this triggers a deployment of a component. It requires a \"CIRCLE_TOKEN\" environment variable (https://circleci.com/docs/2.0/managing-api-tokens/).\n\nOptions:\n --approval-job The name of the approval job to approve a deployment with.\n --deployment-job (optional) The name of the deployment job triggered by the approval job. If passed the CLI will print a URL to the deployment triggered on CircleCI.\n --deployment (optional) The name of a deployment configured in the configuration file.\n --build-revision <git-sha> (optional) The git commit SHA that needs to be deployed. If not specified, the last successful pipeline is used.\n --branch (optional) The git branch to deploy from. If not specified, defaults to 'main'.\n --yes (optional) Skip all confirmation prompts. Useful in Continuous integration (CI) to automatically answer confirmation questions.\n\nGeneral options:\n --dry-run (optional) Simulate a deployment.\n --debug (optional) Print additional debug information.\n");
815
823
  process.exit(0);
816
824
  }
817
825
  cliCommand = cliCommands[0];
@@ -827,6 +835,7 @@ function _run() {
827
835
  _context2.next = 18;
828
836
  return approve({
829
837
  deployment: cliFlags.deployment,
838
+ branch: cliFlags.branch,
830
839
  approvalJob: cliFlags['approval-job'],
831
840
  deploymentJob: cliFlags['deployment-job'],
832
841
  buildRevision: cliFlags['build-revision'],
@@ -30,17 +30,19 @@ declare function throwIfConfigurationLacksRequiredValues(parsedConfiguration: TD
30
30
  declare function throwIfRequiredEnvironmentVariableIsUnset(requiredEnvironmentVariables: string[]): void;
31
31
  type TPaginateToDeploymentPipelineArgs = {
32
32
  circleCiApis: TCircleCiClient;
33
+ branch: string;
33
34
  buildRevision: string;
34
35
  debug: boolean;
35
36
  maxPages: number;
36
37
  };
37
- declare function paginateToDeploymentPipeline({ circleCiApis, buildRevision, debug, maxPages, }: TPaginateToDeploymentPipelineArgs): Promise<TDeploymentPipeline | undefined>;
38
+ declare function paginateToDeploymentPipeline({ circleCiApis, buildRevision, branch, debug, maxPages, }: TPaginateToDeploymentPipelineArgs): Promise<TDeploymentPipeline | undefined>;
38
39
  type TWaitForDeploymentPipelinePromptArgs = {
39
40
  circleCiApis: TCircleCiClient;
41
+ branch: string;
40
42
  pagesForPipelineSelection: number;
41
43
  debug: boolean;
42
44
  };
43
- declare function waitForDeploymentPipelinePrompt({ circleCiApis, pagesForPipelineSelection, debug, }: TWaitForDeploymentPipelinePromptArgs): Promise<TDeploymentPipeline>;
45
+ declare function waitForDeploymentPipelinePrompt({ circleCiApis, branch, pagesForPipelineSelection, debug, }: TWaitForDeploymentPipelinePromptArgs): Promise<TDeploymentPipeline>;
44
46
  type TWaitForConfirmationPromptArgs = {
45
47
  approvalJob: string;
46
48
  revision: string;
@@ -4,6 +4,7 @@ type TCliBaseFlags = {
4
4
  debug: boolean;
5
5
  yes: boolean;
6
6
  deployment: string;
7
+ branch: string;
7
8
  };
8
9
  type TAllParsedCliFlags = TCliBaseFlags & {
9
10
  buildRevision: string;
@@ -17,6 +18,6 @@ export type TCliFlags = TCliBaseFlags & {
17
18
  'deployment-job': string;
18
19
  'dry-run': boolean;
19
20
  };
20
- export type TApproveCliFlags = Pick<TAllParsedCliFlags, 'deployment' | 'approvalJob' | 'deploymentJob' | 'buildRevision' | 'yes' | 'debug' | 'dryRun'>;
21
- export type TCliCommands = 'help' | 'versions' | 'approve' | 'rollback';
21
+ export type TApproveCliFlags = Pick<TAllParsedCliFlags, 'deployment' | 'approvalJob' | 'deploymentJob' | 'buildRevision' | 'branch' | 'yes' | 'debug' | 'dryRun'>;
22
+ export type TCliCommands = 'help' | 'approve';
22
23
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/deployment-cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "CLI to manage Custom Applications deployments in Google Storage.",
5
5
  "license": "MIT",
6
6
  "keywords": ["commercetools", "cli", "deployment"],