@commercetools-frontend/deployment-cli 0.0.0 → 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.
- package/README.md +0 -3
- package/cli/dist/commercetools-frontend-deployment-cli-cli.cjs.dev.js +19 -13
- package/cli/dist/commercetools-frontend-deployment-cli-cli.cjs.prod.js +19 -13
- package/cli/dist/commercetools-frontend-deployment-cli-cli.esm.js +19 -13
- package/dist/declarations/src/helpers.d.ts +5 -3
- package/dist/declarations/src/types.d.ts +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,9 +90,6 @@ function throwIfConfigurationLacksRequiredValues(parsedConfiguration) {
|
|
|
90
90
|
if (!parsedConfiguration.CircleCI.projectName) {
|
|
91
91
|
throw new Error("Missing 'projectName' in 'CircleCI' on configuration. Make sure it exists!");
|
|
92
92
|
}
|
|
93
|
-
if (!parsedConfiguration.MerchantCenter.mcUrl) {
|
|
94
|
-
throw new Error("Missing 'mcUrl' in 'MerchantCenter' on configuration. Make sure it exists!");
|
|
95
|
-
}
|
|
96
93
|
}
|
|
97
94
|
function throwIfRequiredEnvironmentVariableIsUnset(requiredEnvironmentVariables) {
|
|
98
95
|
_forEachInstanceProperty__default["default"](requiredEnvironmentVariables).call(requiredEnvironmentVariables, function (nameOfRequiredEnvironmentVariable) {
|
|
@@ -151,12 +148,12 @@ function paginateToDeploymentPipeline(_x) {
|
|
|
151
148
|
}
|
|
152
149
|
function _paginateToDeploymentPipeline() {
|
|
153
150
|
_paginateToDeploymentPipeline = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(_ref5) {
|
|
154
|
-
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;
|
|
155
152
|
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context13) {
|
|
156
153
|
while (1) {
|
|
157
154
|
switch (_context13.prev = _context13.next) {
|
|
158
155
|
case 0:
|
|
159
|
-
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;
|
|
160
157
|
i = 0;
|
|
161
158
|
case 2:
|
|
162
159
|
if (!(i < maxPages)) {
|
|
@@ -165,7 +162,8 @@ function _paginateToDeploymentPipeline() {
|
|
|
165
162
|
}
|
|
166
163
|
// eslint-disable-next-line no-await-in-loop
|
|
167
164
|
pipelineRequest = circleCiApis.pipelines({
|
|
168
|
-
pageToken: nextPageToken
|
|
165
|
+
pageToken: nextPageToken,
|
|
166
|
+
branch: branch
|
|
169
167
|
});
|
|
170
168
|
_context13.next = 6;
|
|
171
169
|
return pipelineRequest.execute({
|
|
@@ -210,12 +208,12 @@ function collectDeploymentPipelines(_x2) {
|
|
|
210
208
|
}
|
|
211
209
|
function _collectDeploymentPipelines() {
|
|
212
210
|
_collectDeploymentPipelines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(_ref6) {
|
|
213
|
-
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;
|
|
214
212
|
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context16) {
|
|
215
213
|
while (1) {
|
|
216
214
|
switch (_context16.prev = _context16.next) {
|
|
217
215
|
case 0:
|
|
218
|
-
circleCiApis = _ref6.circleCiApis, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
|
|
216
|
+
circleCiApis = _ref6.circleCiApis, branch = _ref6.branch, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
|
|
219
217
|
deploymentPipelines = [];
|
|
220
218
|
i = 0;
|
|
221
219
|
case 3:
|
|
@@ -225,7 +223,8 @@ function _collectDeploymentPipelines() {
|
|
|
225
223
|
}
|
|
226
224
|
// eslint-disable-next-line no-await-in-loop
|
|
227
225
|
pipelinesRequest = circleCiApis.pipelines({
|
|
228
|
-
pageToken: nextPageToken
|
|
226
|
+
pageToken: nextPageToken,
|
|
227
|
+
branch: branch
|
|
229
228
|
});
|
|
230
229
|
_context16.next = 7;
|
|
231
230
|
return pipelinesRequest.execute({
|
|
@@ -255,14 +254,15 @@ function waitForDeploymentPipelinePrompt(_x3) {
|
|
|
255
254
|
}
|
|
256
255
|
function _waitForDeploymentPipelinePrompt() {
|
|
257
256
|
_waitForDeploymentPipelinePrompt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(_ref7) {
|
|
258
|
-
var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
|
|
257
|
+
var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
|
|
259
258
|
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context17) {
|
|
260
259
|
while (1) {
|
|
261
260
|
switch (_context17.prev = _context17.next) {
|
|
262
261
|
case 0:
|
|
263
|
-
circleCiApis = _ref7.circleCiApis, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
|
|
262
|
+
circleCiApis = _ref7.circleCiApis, branch = _ref7.branch, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
|
|
264
263
|
_context17.next = 3;
|
|
265
264
|
return collectDeploymentPipelines({
|
|
265
|
+
branch: branch,
|
|
266
266
|
pagesForPipelineSelection: pagesForPipelineSelection,
|
|
267
267
|
circleCiApis: circleCiApis,
|
|
268
268
|
debug: debug
|
|
@@ -446,6 +446,7 @@ function _approve() {
|
|
|
446
446
|
return paginateToDeploymentPipeline({
|
|
447
447
|
circleCiApis: circleCiApis,
|
|
448
448
|
buildRevision: cliFlags.buildRevision,
|
|
449
|
+
branch: cliFlags.branch,
|
|
449
450
|
debug: cliFlags.debug,
|
|
450
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
|
|
451
452
|
});
|
|
@@ -456,6 +457,7 @@ function _approve() {
|
|
|
456
457
|
case 18:
|
|
457
458
|
_context8.next = 20;
|
|
458
459
|
return waitForDeploymentPipelinePrompt({
|
|
460
|
+
branch: cliFlags.branch,
|
|
459
461
|
circleCiApis: circleCiApis,
|
|
460
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,
|
|
461
463
|
debug: cliFlags.debug
|
|
@@ -832,13 +834,16 @@ function _run() {
|
|
|
832
834
|
alias: {
|
|
833
835
|
help: ['h']
|
|
834
836
|
},
|
|
835
|
-
boolean: ['dry-run', 'debug', 'yes']
|
|
837
|
+
boolean: ['dry-run', 'debug', 'yes'],
|
|
838
|
+
default: {
|
|
839
|
+
branch: 'main'
|
|
840
|
+
}
|
|
836
841
|
});
|
|
837
842
|
cliCommands = cliFlags._;
|
|
838
843
|
if (cliCommands.length === 0 ||
|
|
839
844
|
// @ts-expect-error mri is not typed for the help command.
|
|
840
845
|
cliCommands.help && cliCommands.length === 0) {
|
|
841
|
-
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");
|
|
842
847
|
process.exit(0);
|
|
843
848
|
}
|
|
844
849
|
cliCommand = cliCommands[0];
|
|
@@ -854,6 +859,7 @@ function _run() {
|
|
|
854
859
|
_context2.next = 18;
|
|
855
860
|
return approve({
|
|
856
861
|
deployment: cliFlags.deployment,
|
|
862
|
+
branch: cliFlags.branch,
|
|
857
863
|
approvalJob: cliFlags['approval-job'],
|
|
858
864
|
deploymentJob: cliFlags['deployment-job'],
|
|
859
865
|
buildRevision: cliFlags['build-revision'],
|
|
@@ -90,9 +90,6 @@ function throwIfConfigurationLacksRequiredValues(parsedConfiguration) {
|
|
|
90
90
|
if (!parsedConfiguration.CircleCI.projectName) {
|
|
91
91
|
throw new Error("Missing 'projectName' in 'CircleCI' on configuration. Make sure it exists!");
|
|
92
92
|
}
|
|
93
|
-
if (!parsedConfiguration.MerchantCenter.mcUrl) {
|
|
94
|
-
throw new Error("Missing 'mcUrl' in 'MerchantCenter' on configuration. Make sure it exists!");
|
|
95
|
-
}
|
|
96
93
|
}
|
|
97
94
|
function throwIfRequiredEnvironmentVariableIsUnset(requiredEnvironmentVariables) {
|
|
98
95
|
_forEachInstanceProperty__default["default"](requiredEnvironmentVariables).call(requiredEnvironmentVariables, function (nameOfRequiredEnvironmentVariable) {
|
|
@@ -151,12 +148,12 @@ function paginateToDeploymentPipeline(_x) {
|
|
|
151
148
|
}
|
|
152
149
|
function _paginateToDeploymentPipeline() {
|
|
153
150
|
_paginateToDeploymentPipeline = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(_ref5) {
|
|
154
|
-
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;
|
|
155
152
|
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context13) {
|
|
156
153
|
while (1) {
|
|
157
154
|
switch (_context13.prev = _context13.next) {
|
|
158
155
|
case 0:
|
|
159
|
-
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;
|
|
160
157
|
i = 0;
|
|
161
158
|
case 2:
|
|
162
159
|
if (!(i < maxPages)) {
|
|
@@ -165,7 +162,8 @@ function _paginateToDeploymentPipeline() {
|
|
|
165
162
|
}
|
|
166
163
|
// eslint-disable-next-line no-await-in-loop
|
|
167
164
|
pipelineRequest = circleCiApis.pipelines({
|
|
168
|
-
pageToken: nextPageToken
|
|
165
|
+
pageToken: nextPageToken,
|
|
166
|
+
branch: branch
|
|
169
167
|
});
|
|
170
168
|
_context13.next = 6;
|
|
171
169
|
return pipelineRequest.execute({
|
|
@@ -210,12 +208,12 @@ function collectDeploymentPipelines(_x2) {
|
|
|
210
208
|
}
|
|
211
209
|
function _collectDeploymentPipelines() {
|
|
212
210
|
_collectDeploymentPipelines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(_ref6) {
|
|
213
|
-
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;
|
|
214
212
|
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context16) {
|
|
215
213
|
while (1) {
|
|
216
214
|
switch (_context16.prev = _context16.next) {
|
|
217
215
|
case 0:
|
|
218
|
-
circleCiApis = _ref6.circleCiApis, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
|
|
216
|
+
circleCiApis = _ref6.circleCiApis, branch = _ref6.branch, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
|
|
219
217
|
deploymentPipelines = [];
|
|
220
218
|
i = 0;
|
|
221
219
|
case 3:
|
|
@@ -225,7 +223,8 @@ function _collectDeploymentPipelines() {
|
|
|
225
223
|
}
|
|
226
224
|
// eslint-disable-next-line no-await-in-loop
|
|
227
225
|
pipelinesRequest = circleCiApis.pipelines({
|
|
228
|
-
pageToken: nextPageToken
|
|
226
|
+
pageToken: nextPageToken,
|
|
227
|
+
branch: branch
|
|
229
228
|
});
|
|
230
229
|
_context16.next = 7;
|
|
231
230
|
return pipelinesRequest.execute({
|
|
@@ -255,14 +254,15 @@ function waitForDeploymentPipelinePrompt(_x3) {
|
|
|
255
254
|
}
|
|
256
255
|
function _waitForDeploymentPipelinePrompt() {
|
|
257
256
|
_waitForDeploymentPipelinePrompt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(_ref7) {
|
|
258
|
-
var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
|
|
257
|
+
var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
|
|
259
258
|
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context17) {
|
|
260
259
|
while (1) {
|
|
261
260
|
switch (_context17.prev = _context17.next) {
|
|
262
261
|
case 0:
|
|
263
|
-
circleCiApis = _ref7.circleCiApis, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
|
|
262
|
+
circleCiApis = _ref7.circleCiApis, branch = _ref7.branch, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
|
|
264
263
|
_context17.next = 3;
|
|
265
264
|
return collectDeploymentPipelines({
|
|
265
|
+
branch: branch,
|
|
266
266
|
pagesForPipelineSelection: pagesForPipelineSelection,
|
|
267
267
|
circleCiApis: circleCiApis,
|
|
268
268
|
debug: debug
|
|
@@ -446,6 +446,7 @@ function _approve() {
|
|
|
446
446
|
return paginateToDeploymentPipeline({
|
|
447
447
|
circleCiApis: circleCiApis,
|
|
448
448
|
buildRevision: cliFlags.buildRevision,
|
|
449
|
+
branch: cliFlags.branch,
|
|
449
450
|
debug: cliFlags.debug,
|
|
450
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
|
|
451
452
|
});
|
|
@@ -456,6 +457,7 @@ function _approve() {
|
|
|
456
457
|
case 18:
|
|
457
458
|
_context8.next = 20;
|
|
458
459
|
return waitForDeploymentPipelinePrompt({
|
|
460
|
+
branch: cliFlags.branch,
|
|
459
461
|
circleCiApis: circleCiApis,
|
|
460
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,
|
|
461
463
|
debug: cliFlags.debug
|
|
@@ -832,13 +834,16 @@ function _run() {
|
|
|
832
834
|
alias: {
|
|
833
835
|
help: ['h']
|
|
834
836
|
},
|
|
835
|
-
boolean: ['dry-run', 'debug', 'yes']
|
|
837
|
+
boolean: ['dry-run', 'debug', 'yes'],
|
|
838
|
+
default: {
|
|
839
|
+
branch: 'main'
|
|
840
|
+
}
|
|
836
841
|
});
|
|
837
842
|
cliCommands = cliFlags._;
|
|
838
843
|
if (cliCommands.length === 0 ||
|
|
839
844
|
// @ts-expect-error mri is not typed for the help command.
|
|
840
845
|
cliCommands.help && cliCommands.length === 0) {
|
|
841
|
-
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");
|
|
842
847
|
process.exit(0);
|
|
843
848
|
}
|
|
844
849
|
cliCommand = cliCommands[0];
|
|
@@ -854,6 +859,7 @@ function _run() {
|
|
|
854
859
|
_context2.next = 18;
|
|
855
860
|
return approve({
|
|
856
861
|
deployment: cliFlags.deployment,
|
|
862
|
+
branch: cliFlags.branch,
|
|
857
863
|
approvalJob: cliFlags['approval-job'],
|
|
858
864
|
deploymentJob: cliFlags['deployment-job'],
|
|
859
865
|
buildRevision: cliFlags['build-revision'],
|
|
@@ -66,9 +66,6 @@ function throwIfConfigurationLacksRequiredValues(parsedConfiguration) {
|
|
|
66
66
|
if (!parsedConfiguration.CircleCI.projectName) {
|
|
67
67
|
throw new Error("Missing 'projectName' in 'CircleCI' on configuration. Make sure it exists!");
|
|
68
68
|
}
|
|
69
|
-
if (!parsedConfiguration.MerchantCenter.mcUrl) {
|
|
70
|
-
throw new Error("Missing 'mcUrl' in 'MerchantCenter' on configuration. Make sure it exists!");
|
|
71
|
-
}
|
|
72
69
|
}
|
|
73
70
|
function throwIfRequiredEnvironmentVariableIsUnset(requiredEnvironmentVariables) {
|
|
74
71
|
_forEachInstanceProperty(requiredEnvironmentVariables).call(requiredEnvironmentVariables, function (nameOfRequiredEnvironmentVariable) {
|
|
@@ -127,12 +124,12 @@ function paginateToDeploymentPipeline(_x) {
|
|
|
127
124
|
}
|
|
128
125
|
function _paginateToDeploymentPipeline() {
|
|
129
126
|
_paginateToDeploymentPipeline = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref5) {
|
|
130
|
-
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;
|
|
131
128
|
return _regeneratorRuntime.wrap(function _callee2$(_context13) {
|
|
132
129
|
while (1) {
|
|
133
130
|
switch (_context13.prev = _context13.next) {
|
|
134
131
|
case 0:
|
|
135
|
-
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;
|
|
136
133
|
i = 0;
|
|
137
134
|
case 2:
|
|
138
135
|
if (!(i < maxPages)) {
|
|
@@ -141,7 +138,8 @@ function _paginateToDeploymentPipeline() {
|
|
|
141
138
|
}
|
|
142
139
|
// eslint-disable-next-line no-await-in-loop
|
|
143
140
|
pipelineRequest = circleCiApis.pipelines({
|
|
144
|
-
pageToken: nextPageToken
|
|
141
|
+
pageToken: nextPageToken,
|
|
142
|
+
branch: branch
|
|
145
143
|
});
|
|
146
144
|
_context13.next = 6;
|
|
147
145
|
return pipelineRequest.execute({
|
|
@@ -186,12 +184,12 @@ function collectDeploymentPipelines(_x2) {
|
|
|
186
184
|
}
|
|
187
185
|
function _collectDeploymentPipelines() {
|
|
188
186
|
_collectDeploymentPipelines = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6) {
|
|
189
|
-
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;
|
|
190
188
|
return _regeneratorRuntime.wrap(function _callee3$(_context16) {
|
|
191
189
|
while (1) {
|
|
192
190
|
switch (_context16.prev = _context16.next) {
|
|
193
191
|
case 0:
|
|
194
|
-
circleCiApis = _ref6.circleCiApis, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
|
|
192
|
+
circleCiApis = _ref6.circleCiApis, branch = _ref6.branch, pagesForPipelineSelection = _ref6.pagesForPipelineSelection, debug = _ref6.debug;
|
|
195
193
|
deploymentPipelines = [];
|
|
196
194
|
i = 0;
|
|
197
195
|
case 3:
|
|
@@ -201,7 +199,8 @@ function _collectDeploymentPipelines() {
|
|
|
201
199
|
}
|
|
202
200
|
// eslint-disable-next-line no-await-in-loop
|
|
203
201
|
pipelinesRequest = circleCiApis.pipelines({
|
|
204
|
-
pageToken: nextPageToken
|
|
202
|
+
pageToken: nextPageToken,
|
|
203
|
+
branch: branch
|
|
205
204
|
});
|
|
206
205
|
_context16.next = 7;
|
|
207
206
|
return pipelinesRequest.execute({
|
|
@@ -231,14 +230,15 @@ function waitForDeploymentPipelinePrompt(_x3) {
|
|
|
231
230
|
}
|
|
232
231
|
function _waitForDeploymentPipelinePrompt() {
|
|
233
232
|
_waitForDeploymentPipelinePrompt = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref7) {
|
|
234
|
-
var circleCiApis, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
|
|
233
|
+
var circleCiApis, branch, pagesForPipelineSelection, debug, deploymentPipelines, deploymentPipelinePrompt, revision;
|
|
235
234
|
return _regeneratorRuntime.wrap(function _callee4$(_context17) {
|
|
236
235
|
while (1) {
|
|
237
236
|
switch (_context17.prev = _context17.next) {
|
|
238
237
|
case 0:
|
|
239
|
-
circleCiApis = _ref7.circleCiApis, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
|
|
238
|
+
circleCiApis = _ref7.circleCiApis, branch = _ref7.branch, pagesForPipelineSelection = _ref7.pagesForPipelineSelection, debug = _ref7.debug;
|
|
240
239
|
_context17.next = 3;
|
|
241
240
|
return collectDeploymentPipelines({
|
|
241
|
+
branch: branch,
|
|
242
242
|
pagesForPipelineSelection: pagesForPipelineSelection,
|
|
243
243
|
circleCiApis: circleCiApis,
|
|
244
244
|
debug: debug
|
|
@@ -422,6 +422,7 @@ function _approve() {
|
|
|
422
422
|
return paginateToDeploymentPipeline({
|
|
423
423
|
circleCiApis: circleCiApis,
|
|
424
424
|
buildRevision: cliFlags.buildRevision,
|
|
425
|
+
branch: cliFlags.branch,
|
|
425
426
|
debug: cliFlags.debug,
|
|
426
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
|
|
427
428
|
});
|
|
@@ -432,6 +433,7 @@ function _approve() {
|
|
|
432
433
|
case 18:
|
|
433
434
|
_context8.next = 20;
|
|
434
435
|
return waitForDeploymentPipelinePrompt({
|
|
436
|
+
branch: cliFlags.branch,
|
|
435
437
|
circleCiApis: circleCiApis,
|
|
436
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,
|
|
437
439
|
debug: cliFlags.debug
|
|
@@ -808,13 +810,16 @@ function _run() {
|
|
|
808
810
|
alias: {
|
|
809
811
|
help: ['h']
|
|
810
812
|
},
|
|
811
|
-
boolean: ['dry-run', 'debug', 'yes']
|
|
813
|
+
boolean: ['dry-run', 'debug', 'yes'],
|
|
814
|
+
default: {
|
|
815
|
+
branch: 'main'
|
|
816
|
+
}
|
|
812
817
|
});
|
|
813
818
|
cliCommands = cliFlags._;
|
|
814
819
|
if (cliCommands.length === 0 ||
|
|
815
820
|
// @ts-expect-error mri is not typed for the help command.
|
|
816
821
|
cliCommands.help && cliCommands.length === 0) {
|
|
817
|
-
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");
|
|
818
823
|
process.exit(0);
|
|
819
824
|
}
|
|
820
825
|
cliCommand = cliCommands[0];
|
|
@@ -830,6 +835,7 @@ function _run() {
|
|
|
830
835
|
_context2.next = 18;
|
|
831
836
|
return approve({
|
|
832
837
|
deployment: cliFlags.deployment,
|
|
838
|
+
branch: cliFlags.branch,
|
|
833
839
|
approvalJob: cliFlags['approval-job'],
|
|
834
840
|
deploymentJob: cliFlags['deployment-job'],
|
|
835
841
|
buildRevision: cliFlags['build-revision'],
|
|
@@ -18,7 +18,7 @@ export type TDeploymentCLIConfig = {
|
|
|
18
18
|
};
|
|
19
19
|
deployments?: {
|
|
20
20
|
[key: string]: {
|
|
21
|
-
|
|
21
|
+
jobs: {
|
|
22
22
|
approval: string;
|
|
23
23
|
deployment: string;
|
|
24
24
|
};
|
|
@@ -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' | '
|
|
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