@salesforce/plugin-devops-center 0.1.0-beta.1

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.
Files changed (135) hide show
  1. package/LICENSE.txt +12 -0
  2. package/README.md +245 -0
  3. package/lib/commands/deploy/pipeline/report.d.ts +15 -0
  4. package/lib/commands/deploy/pipeline/report.js +42 -0
  5. package/lib/commands/deploy/pipeline/report.js.map +1 -0
  6. package/lib/commands/deploy/pipeline/resume.d.ts +12 -0
  7. package/lib/commands/deploy/pipeline/resume.js +28 -0
  8. package/lib/commands/deploy/pipeline/resume.js.map +1 -0
  9. package/lib/commands/deploy/pipeline.d.ts +26 -0
  10. package/lib/commands/deploy/pipeline.js +50 -0
  11. package/lib/commands/deploy/pipeline.js.map +1 -0
  12. package/lib/common/base/abstractPromote.d.ts +69 -0
  13. package/lib/common/base/abstractPromote.js +173 -0
  14. package/lib/common/base/abstractPromote.js.map +1 -0
  15. package/lib/common/base/abstractReportOnPromote.d.ts +17 -0
  16. package/lib/common/base/abstractReportOnPromote.js +64 -0
  17. package/lib/common/base/abstractReportOnPromote.js.map +1 -0
  18. package/lib/common/base/abstractResume.d.ts +37 -0
  19. package/lib/common/base/abstractResume.js +90 -0
  20. package/lib/common/base/abstractResume.js.map +1 -0
  21. package/lib/common/constants.d.ts +9 -0
  22. package/lib/common/constants.js +20 -0
  23. package/lib/common/constants.js.map +1 -0
  24. package/lib/common/deployPipelineCache.d.ts +39 -0
  25. package/lib/common/deployPipelineCache.js +81 -0
  26. package/lib/common/deployPipelineCache.js.map +1 -0
  27. package/lib/common/flags/flags.d.ts +19 -0
  28. package/lib/common/flags/flags.js +84 -0
  29. package/lib/common/flags/flags.js.map +1 -0
  30. package/lib/common/flags/promote/promoteFlags.d.ts +12 -0
  31. package/lib/common/flags/promote/promoteFlags.js +52 -0
  32. package/lib/common/flags/promote/promoteFlags.js.map +1 -0
  33. package/lib/common/index.d.ts +2 -0
  34. package/lib/common/index.js +18 -0
  35. package/lib/common/index.js.map +1 -0
  36. package/lib/common/outputColumns.d.ts +17 -0
  37. package/lib/common/outputColumns.js +24 -0
  38. package/lib/common/outputColumns.js.map +1 -0
  39. package/lib/common/outputService/aorOutputService.d.ts +43 -0
  40. package/lib/common/outputService/aorOutputService.js +50 -0
  41. package/lib/common/outputService/aorOutputService.js.map +1 -0
  42. package/lib/common/outputService/deployCommandOutputService.d.ts +12 -0
  43. package/lib/common/outputService/deployCommandOutputService.js +28 -0
  44. package/lib/common/outputService/deployCommandOutputService.js.map +1 -0
  45. package/lib/common/outputService/deploySummaryBuilder.d.ts +32 -0
  46. package/lib/common/outputService/deploySummaryBuilder.js +185 -0
  47. package/lib/common/outputService/deploySummaryBuilder.js.map +1 -0
  48. package/lib/common/outputService/deploymentResultOutputService.d.ts +23 -0
  49. package/lib/common/outputService/deploymentResultOutputService.js +18 -0
  50. package/lib/common/outputService/deploymentResultOutputService.js.map +1 -0
  51. package/lib/common/outputService/index.d.ts +6 -0
  52. package/lib/common/outputService/index.js +20 -0
  53. package/lib/common/outputService/index.js.map +1 -0
  54. package/lib/common/outputService/outputService.d.ts +27 -0
  55. package/lib/common/outputService/outputService.js +30 -0
  56. package/lib/common/outputService/outputService.js.map +1 -0
  57. package/lib/common/outputService/outputServiceFactory.d.ts +27 -0
  58. package/lib/common/outputService/outputServiceFactory.js +39 -0
  59. package/lib/common/outputService/outputServiceFactory.js.map +1 -0
  60. package/lib/common/outputService/outputUtils.d.ts +3 -0
  61. package/lib/common/outputService/outputUtils.js +26 -0
  62. package/lib/common/outputService/outputUtils.js.map +1 -0
  63. package/lib/common/outputService/promoteOutputService.d.ts +30 -0
  64. package/lib/common/outputService/promoteOutputService.js +55 -0
  65. package/lib/common/outputService/promoteOutputService.js.map +1 -0
  66. package/lib/common/outputService/reportOutputService.d.ts +21 -0
  67. package/lib/common/outputService/reportOutputService.js +54 -0
  68. package/lib/common/outputService/reportOutputService.js.map +1 -0
  69. package/lib/common/outputService/resumeCommandOutputService.d.ts +12 -0
  70. package/lib/common/outputService/resumeCommandOutputService.js +30 -0
  71. package/lib/common/outputService/resumeCommandOutputService.js.map +1 -0
  72. package/lib/common/outputService/resumeOutputService.d.ts +15 -0
  73. package/lib/common/outputService/resumeOutputService.js +19 -0
  74. package/lib/common/outputService/resumeOutputService.js.map +1 -0
  75. package/lib/common/selectors/asyncOperationResultsSelector.d.ts +7 -0
  76. package/lib/common/selectors/asyncOperationResultsSelector.js +21 -0
  77. package/lib/common/selectors/asyncOperationResultsSelector.js.map +1 -0
  78. package/lib/common/selectors/deployComponentsSelector.d.ts +3 -0
  79. package/lib/common/selectors/deployComponentsSelector.js +18 -0
  80. package/lib/common/selectors/deployComponentsSelector.js.map +1 -0
  81. package/lib/common/selectors/deployProgressSummarySelector.d.ts +13 -0
  82. package/lib/common/selectors/deployProgressSummarySelector.js +24 -0
  83. package/lib/common/selectors/deployProgressSummarySelector.js.map +1 -0
  84. package/lib/common/selectors/deploymentResultsSelector.d.ts +7 -0
  85. package/lib/common/selectors/deploymentResultsSelector.js +24 -0
  86. package/lib/common/selectors/deploymentResultsSelector.js.map +1 -0
  87. package/lib/common/selectors/environmentSelector.d.ts +11 -0
  88. package/lib/common/selectors/environmentSelector.js +22 -0
  89. package/lib/common/selectors/environmentSelector.js.map +1 -0
  90. package/lib/common/selectors/namedCredentialSelector.d.ts +6 -0
  91. package/lib/common/selectors/namedCredentialSelector.js +24 -0
  92. package/lib/common/selectors/namedCredentialSelector.js.map +1 -0
  93. package/lib/common/selectors/pipelineStageSelector.d.ts +7 -0
  94. package/lib/common/selectors/pipelineStageSelector.js +22 -0
  95. package/lib/common/selectors/pipelineStageSelector.js.map +1 -0
  96. package/lib/common/selectors/workItemSelector.d.ts +11 -0
  97. package/lib/common/selectors/workItemSelector.js +22 -0
  98. package/lib/common/selectors/workItemSelector.js.map +1 -0
  99. package/lib/common/types.d.ts +98 -0
  100. package/lib/common/types.js +24 -0
  101. package/lib/common/types.js.map +1 -0
  102. package/lib/common/utils.d.ts +75 -0
  103. package/lib/common/utils.js +176 -0
  104. package/lib/common/utils.js.map +1 -0
  105. package/lib/configMeta.d.ts +13 -0
  106. package/lib/configMeta.js +28 -0
  107. package/lib/configMeta.js.map +1 -0
  108. package/lib/streamer/doceMonitor.d.ts +7 -0
  109. package/lib/streamer/doceMonitor.js +9 -0
  110. package/lib/streamer/doceMonitor.js.map +1 -0
  111. package/lib/streamer/doceStream.d.ts +20 -0
  112. package/lib/streamer/doceStream.js +33 -0
  113. package/lib/streamer/doceStream.js.map +1 -0
  114. package/lib/streamer/processors/asyncOpStream.d.ts +20 -0
  115. package/lib/streamer/processors/asyncOpStream.js +48 -0
  116. package/lib/streamer/processors/asyncOpStream.js.map +1 -0
  117. package/lib/streamer/sObjectStream.d.ts +22 -0
  118. package/lib/streamer/sObjectStream.js +40 -0
  119. package/lib/streamer/sObjectStream.js.map +1 -0
  120. package/messages/aorOperations.output.md +8 -0
  121. package/messages/cache.md +3 -0
  122. package/messages/commonErrors.md +31 -0
  123. package/messages/commonFlags.md +53 -0
  124. package/messages/config.md +3 -0
  125. package/messages/deploy.output.md +31 -0
  126. package/messages/deploy.pipeline.md +37 -0
  127. package/messages/deploy.pipeline.report.md +49 -0
  128. package/messages/deploy.pipeline.resume.md +23 -0
  129. package/messages/promoteFlags.md +53 -0
  130. package/messages/resume.output.md +4 -0
  131. package/oclif.manifest.json +247 -0
  132. package/package.json +115 -0
  133. package/schemas/deploy-pipeline-report.json +25 -0
  134. package/schemas/deploy-pipeline-resume.json +25 -0
  135. package/schemas/deploy-pipeline.json +25 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2023, Salesforce.com, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,245 @@
1
+ **NOTE: This command is currently in beta. Any aspect of this command can change without advanced notice. Don't use beta commands in your scripts.**
2
+
3
+ # plugin-devops-center
4
+
5
+ <!--[![NPM](https://img.shields.io/npm/v/@salesforce/plugin-template-sf.svg?label=@salesforce/plugin-template-sf)](https://www.npmjs.com/package/@salesforce/plugin-template-sf) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/plugin-template-sf.svg)](https://npmjs.org/package/@salesforce/plugin-template-sf) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/plugin-template-sf/main/LICENSE.txt) -->
6
+
7
+ ## Contributing
8
+
9
+ 1. Please read our [Code of Conduct](CODE_OF_CONDUCT.md)
10
+ 2. Create a new issue before starting your project so that we can keep track of
11
+ what you are trying to add/fix. That way, we can also offer suggestions or
12
+ let you know if there is already an effort in progress.
13
+ 3. Fork this repository.
14
+ 4. [Build the plugin locally](#build)
15
+ 5. Create a _topic_ branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
16
+ 6. Edit the code in your fork.
17
+ 7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
18
+ 8. Sign CLA (see [CLA](#cla) below).
19
+ 9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
20
+
21
+ ### CLA
22
+
23
+ External contributors will be required to sign a Contributor's License
24
+ Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
25
+
26
+ ### Build
27
+
28
+ To build the plugin locally, make sure to have yarn installed and run the following commands:
29
+
30
+ ```bash
31
+ # Clone the repository
32
+ git clone git@github.com:salesforcecli/plugin-devops-center
33
+
34
+ # Install the dependencies and compile
35
+ yarn && yarn build
36
+ ```
37
+
38
+ To use your plugin, run using the local `./bin/dev` or `./bin/dev.cmd` file.
39
+
40
+ ```bash
41
+ # Run using local run file.
42
+ ./bin/dev deploy pipeline
43
+ ```
44
+
45
+ There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
46
+
47
+ ```bash
48
+ # Link your plugin to the sf cli
49
+ sf plugins link .
50
+ # To verify
51
+ sf plugins
52
+ ```
53
+
54
+ ## Commands
55
+
56
+ <!-- commands -->
57
+
58
+ - [`sf deploy pipeline`](#sf-deploy-pipeline)
59
+ - [`sf deploy pipeline report`](#sf-deploy-pipeline-report)
60
+ - [`sf deploy pipeline resume`](#sf-deploy-pipeline-resume)
61
+
62
+ ## `sf deploy pipeline`
63
+
64
+ Deploy changes from a branch to the pipeline stage’s org.
65
+
66
+ ```
67
+ USAGE
68
+ $ sf deploy pipeline [--json] [-c <value>] [-p <value>] [-b <value>] [-v <value>] [-a] [--async | -w <value>] [--concise | --verbose]
69
+ [-t <value>] [-l NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg]
70
+
71
+ FLAGS
72
+ -a, --deploy-all Deploy all metadata in the branch.
73
+ -b, --branch-name=<value> Name of the branch in the source control repository from which to deploy changes to the stage’s org.
74
+ -c, --devops-center-username=<value> Username or alias for the DevOps Center org.
75
+ -l, --test-level=<option> [default: NoTestRun] Deployment Apex testing level.
76
+ <options: NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg>
77
+ -p, --devops-center-project-name=<value> Name of the DevOps Center project.
78
+ -t, --tests=<value>... Apex tests to run when --test-level is RunSpecifiedTests.
79
+ -v, --bundle-version-name=<value> Version name of the bundle.
80
+ -w, --wait=<minutes> Number of minutes to wait for command to complete and display results.
81
+ --async Run the command asynchronously.
82
+ --concise Show concise output of the deploy result.
83
+ --verbose Show verbose output of the deploy result.
84
+
85
+ GLOBAL FLAGS
86
+ --json Format output as json.
87
+
88
+ DESCRIPTION
89
+ Before you run this command, changes in the branch must be merged in the source control repository.
90
+
91
+ EXAMPLES
92
+ Deploy changes in the Staging branch to the Staging environment (sandbox), if the previous stage is the bundling stage:
93
+
94
+ $ sf deploy pipeline —-devops-center-project-name “Recruiting App” —-branch-name staging —-devops-center-username MyStagingSandbox —-bundle-version-name 1.0
95
+
96
+ Deploy all changes in the main branch to the release environment:
97
+
98
+ $ sf deploy pipeline —-devops-center-project-name “Recruiting App” —-branch-name main —-devops-center-username MyReleaseOrg —-deploy-all
99
+
100
+ FLAG DESCRIPTIONS
101
+ -a, --deploy-all Deploy all metadata in the branch
102
+
103
+ If you don’t specify this flag, only changes in the stage’s branch are deployed.
104
+
105
+ -b, --branch-name=<value> Name of the branch in the source control repository from which to deploy changes to the stage’s org.
106
+
107
+ -c, --devops-center-username=<value> Username or alias for the DevOps Center org.
108
+
109
+ -l, --test-level=NoTestRun|RunSpecifiedTests|RunLocalTests|RunAllTestsInOrg Deployment Apex testing level.
110
+
111
+ Valid values are:
112
+
113
+ - NoTestRun — No tests are run. This test level applies only to deployments to development environments, such as
114
+ sandbox, Developer Edition, or trial orgs. This test level is the default for development environments.
115
+
116
+ - RunSpecifiedTests — Runs only the tests that you specify with the --run-tests flag. Code coverage requirements
117
+ differ from the default coverage requirements when using this test level. Executed tests must comprise a minimum of
118
+ 75% code coverage for each class and trigger in the deployment package. This coverage is computed for each class and
119
+ trigger individually and is different than the overall coverage percentage.
120
+
121
+ - RunLocalTests — All tests in your org are run, except the ones that originate from installed managed and unlocked
122
+ packages. This test level is the default for production deployments that include Apex classes or triggers.
123
+
124
+ - RunAllTestsInOrg — All tests in your org are run, including tests of managed packages.
125
+
126
+ If you don’t specify a test level, the default behavior depends on the contents of your deployment package. For more
127
+ information, see [Running Tests in a
128
+ Deployment](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_running_tests.htm)
129
+ in the "Metadata API Developer Guide".
130
+
131
+ -p, --devops-center-project-name=<value> Name of the DevOps Center project.
132
+
133
+ -t, --tests=<value>... Apex tests to run when --test-level is RunSpecifiedTests.
134
+
135
+ Separate multiple test names with commas, and enclose the entire flag value in double quotes if a test contains a space.
136
+
137
+ -v, --bundle-version-name=<value> Version name of the bundle
138
+
139
+ You must indicate the bundle version if deploying to the environment that corresponds to the first stage after the bundling stage.
140
+
141
+ -w, --wait=<minutes> Number of minutes to wait for command to complete and display results.
142
+
143
+ If the command continues to run after the wait period, the CLI returns control of the terminal window to you and returns the job ID.
144
+ To check the status of the deploy operation, run "sf deploy pipeline report".
145
+
146
+ --async Run the command asynchronously.
147
+
148
+ The command immediately returns the job ID and control of the terminal to you. This way, you can continue to use the CLI. To resume the deployment,
149
+ run "sf deploy pipeline resume". To check the status of the deployment, run "sf deploy pipeline report".
150
+ ```
151
+
152
+ ## `sf deploy pipeline report`
153
+
154
+ Check the status of a pipeline deploy operation.
155
+
156
+ ```
157
+ USAGE
158
+ $ sf deploy pipeline report [--json] [-c <value>] [-i <value>] [-r]
159
+
160
+ FLAGS
161
+ -c, --devops-center-username=<value> Username or alias for the DevOps Center org.
162
+ -i, --job-id=<value> Job ID of the pipeline deployment you want to check the status of.
163
+ -r, --use-most-recent Use the job ID of the most recent deploy operation.
164
+
165
+ GLOBAL FLAGS
166
+ --json Format output as json.
167
+
168
+ DESCRIPTION
169
+ Check the status of a pipeline deploy operation.
170
+
171
+ Run this command by either passing it a job ID or specifying the —use-most-recent flag to use the job ID of the most recent deploy operation.
172
+
173
+ EXAMPLES
174
+ Check the status using a job ID:
175
+
176
+ $ sf deploy pipeline report --devops-center-username MyStagingSandbox --job-id 0Af0x000017yLUFCA2
177
+
178
+ Check the status of the most recent deploy operation:
179
+
180
+ $ sf deploy pipeline report --devops-center-username MyStagingSandbox --use-most-recent
181
+
182
+ FLAG DESCRIPTIONS
183
+ -c, --devops-center-username=<value> Username or alias for the DevOps Center org.
184
+
185
+ -i, --job-id=<value> Job ID of the pipeline deployment you want to check the status of.
186
+
187
+ The job ID is valid for 10 days from when you started the deploy operation.
188
+
189
+ -r, --use-most-recent Use the job ID of the most recent deploy operation.
190
+
191
+ For performance reasons, this flag uses job IDs for deploy operations that started in the past 3 days or fewer. If your most recent operation was longer than 3 days ago, this flag won't find a job ID.
192
+
193
+ ```
194
+
195
+ ## `sf deploy pipeline resume`
196
+
197
+ Resume watching a pipeline deploy operation.
198
+
199
+ ```
200
+ USAGE
201
+ $ sf deploy pipeline resume [--json] [-c <value>] [-i <value>] [-r] [-w <value>]
202
+
203
+ FLAGS
204
+ -c, --devops-center-username=<value> Username or alias of the DevOps Center org.
205
+ -i, --job-id=<value> Job ID of the pipeline deploy operation you want to resume.
206
+ -r, --use-most-recent Use the job ID of the most recent deploy operation.
207
+ -w, --wait=<minutes> Number of minutes to wait for command to complete and display results.
208
+
209
+ GLOBAL FLAGS
210
+ --json Format output as json.
211
+
212
+ DESCRIPTION
213
+ Resume watching a pipeline deploy operation.
214
+
215
+ Use this command to resume watching a pipeline deploy operation if the original command times out or you specified the --async flag.
216
+ Run this command by either passing it a job ID or specifying the --use-most-recent flag to use the job ID of the most recent deploy operation.
217
+
218
+ EXAMPLES
219
+ Resume watching a deploy operation using a job ID:
220
+
221
+ $ sf deploy pipeline resume --job-id 0Af0x000017yLUFCA2
222
+
223
+ Resume watching the most recent deploy operation:
224
+
225
+ $ sf deploy pipeline resume --use-most-recent
226
+
227
+ FLAG DESCRIPTIONS
228
+ -i, --job-id=<value> Job ID of the pipeline deploy operation you want to resume.
229
+
230
+ These commands return a job ID if they time out or you specified the --async flag:
231
+
232
+ - sf deploy pipeline
233
+ - sf deploy pipeline validate
234
+ - sf deploy pipeline quick
235
+
236
+ The job ID is valid for 10 days from when you started the deploy operation.
237
+
238
+ -r, --use-most-recent Use the job ID of the most recent deploy operation.
239
+
240
+ For performance reasons, this flag uses job IDs for operations that started in the past 3 days or fewer. If your most recent operation was longer than 3 days ago, this flag won't find a job ID.
241
+
242
+ -w, --wait=<minutes> Number of minutes to wait for command to complete and display results.
243
+
244
+ If the command continues to run after the wait period, the CLI returns control of the terminal window to you and returns the job ID. To check the status of the operation, run "sf deploy pipeline resume report".
245
+ ```
@@ -0,0 +1,15 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { PromotePipelineResult } from '../../../common';
3
+ import { ReportOnPromoteCommand } from '../../../common/base/abstractReportOnPromote';
4
+ export default class DeployPipelineReport extends ReportOnPromoteCommand<typeof SfCommand> {
5
+ static readonly description: string;
6
+ static readonly summary: string;
7
+ static readonly examples: string[];
8
+ static readonly state = "beta";
9
+ static flags: {
10
+ 'job-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
11
+ 'use-most-recent': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ protected operationName: string;
14
+ run(): Promise<PromotePipelineResult>;
15
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+ * Copyright (c) 2023, salesforce.com, inc.
5
+ * All rights reserved.
6
+ * Licensed under the BSD 3-Clause license.
7
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
+ */
9
+ const core_1 = require("@salesforce/core");
10
+ const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
11
+ const abstractReportOnPromote_1 = require("../../../common/base/abstractReportOnPromote");
12
+ core_1.Messages.importMessagesDirectory(__dirname);
13
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-devops-center', 'deploy.pipeline.report');
14
+ class DeployPipelineReport extends abstractReportOnPromote_1.ReportOnPromoteCommand {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.operationName = 'Deploy';
18
+ }
19
+ async run() {
20
+ return this.getOperationReport();
21
+ }
22
+ }
23
+ exports.default = DeployPipelineReport;
24
+ DeployPipelineReport.description = messages.getMessage('description');
25
+ DeployPipelineReport.summary = messages.getMessage('summary');
26
+ DeployPipelineReport.examples = messages.getMessages('examples');
27
+ DeployPipelineReport.state = 'beta';
28
+ DeployPipelineReport.flags = {
29
+ 'job-id': sf_plugins_core_1.Flags.salesforceId({
30
+ char: 'i',
31
+ description: messages.getMessage('flags.job-id.description'),
32
+ summary: messages.getMessage('flags.job-id.summary'),
33
+ exactlyOne: ['use-most-recent', 'job-id'],
34
+ }),
35
+ 'use-most-recent': sf_plugins_core_1.Flags.boolean({
36
+ char: 'r',
37
+ description: messages.getMessage('flags.use-most-recent.description'),
38
+ summary: messages.getMessage('flags.use-most-recent.summary'),
39
+ exactlyOne: ['use-most-recent', 'job-id'],
40
+ }),
41
+ };
42
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../../src/commands/deploy/pipeline/report.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,2CAA4C;AAC5C,iEAA+D;AAE/D,0FAAsF;AAEtF,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC;AAErG,MAAqB,oBAAqB,SAAQ,gDAAwC;IAA1F;;QAmBY,kBAAa,GAAG,QAAQ,CAAC;IAKrC,CAAC;IAHQ,KAAK,CAAC,GAAG;QACd,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;IACnC,CAAC;;AAvBH,uCAwBC;AAvBwB,gCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,4BAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,6BAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,0BAAK,GAAG,MAAM,CAAC;AACxB,0BAAK,GAAG;IACpB,QAAQ,EAAE,uBAAK,CAAC,YAAY,CAAC;QAC3B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;QAC5D,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,sBAAsB,CAAC;QACpD,UAAU,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC;KAC1C,CAAC;IACF,iBAAiB,EAAE,uBAAK,CAAC,OAAO,CAAC;QAC/B,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,mCAAmC,CAAC;QACrE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,+BAA+B,CAAC;QAC7D,UAAU,EAAE,CAAC,iBAAiB,EAAE,QAAQ,CAAC;KAC1C,CAAC;CACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { PromotePipelineResult } from '../../../common';
3
+ import { ResumeCommand } from '../../../common/base/abstractResume';
4
+ export default class DeployPipelineResume extends ResumeCommand<typeof SfCommand> {
5
+ static readonly summary: string;
6
+ static readonly description: string;
7
+ static readonly examples: string[];
8
+ static readonly state = "beta";
9
+ protected operationType: string;
10
+ protected baseCommand: string;
11
+ run(): Promise<PromotePipelineResult>;
12
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2022, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const core_1 = require("@salesforce/core");
10
+ const abstractResume_1 = require("../../../common/base/abstractResume");
11
+ core_1.Messages.importMessagesDirectory(__dirname);
12
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-devops-center', 'deploy.pipeline.resume');
13
+ class DeployPipelineResume extends abstractResume_1.ResumeCommand {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.operationType = 'Deployment';
17
+ this.baseCommand = 'deploy pipeline';
18
+ }
19
+ async run() {
20
+ return this.resumeOperation();
21
+ }
22
+ }
23
+ exports.default = DeployPipelineResume;
24
+ DeployPipelineResume.summary = messages.getMessage('summary');
25
+ DeployPipelineResume.description = messages.getMessage('description');
26
+ DeployPipelineResume.examples = messages.getMessages('examples');
27
+ DeployPipelineResume.state = 'beta';
28
+ //# sourceMappingURL=resume.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/commands/deploy/pipeline/resume.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAA4C;AAG5C,wEAAoE;AAEpE,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC;AAErG,MAAqB,oBAAqB,SAAQ,8BAA+B;IAAjF;;QAMY,kBAAa,GAAG,YAAY,CAAC;QAC7B,gBAAW,GAAG,iBAAiB,CAAC;IAK5C,CAAC;IAHQ,KAAK,CAAC,GAAG;QACd,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;;AAXH,uCAYC;AAXwB,4BAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,gCAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,6BAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,0BAAK,GAAG,MAAM,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { PromoteCommand } from '../../common/base/abstractPromote';
3
+ import { PromoteOptions, PromotePipelineResult } from '../../common';
4
+ /**
5
+ * Contains the logic to execute the sf deploy pipeline command.
6
+ */
7
+ export default class DeployPipeline extends PromoteCommand<typeof SfCommand> {
8
+ static readonly summary: string;
9
+ static readonly description: string;
10
+ static readonly examples: string[];
11
+ static readonly state = "beta";
12
+ private readonly isUndeployedOnly;
13
+ run(): Promise<PromotePipelineResult>;
14
+ /**
15
+ * Computes the source stage Id for deployOnly promotions. If the given stage has a previous stage
16
+ * then the source stage is the previous stage. If not the it means this is the
17
+ * first stage of the pipeline and source stage Id = Approved.
18
+ *
19
+ * @returns: string. It is the source stage Id.
20
+ */
21
+ protected getSourceStageId(): string;
22
+ /**
23
+ * Returns the promote option necessary to performs an undeployed only promotion
24
+ */
25
+ protected getPromoteOptions(): Partial<PromoteOptions>;
26
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2022, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const core_1 = require("@salesforce/core");
10
+ const abstractPromote_1 = require("../../common/base/abstractPromote");
11
+ const constants_1 = require("../../common/constants");
12
+ core_1.Messages.importMessagesDirectory(__dirname);
13
+ const messages = core_1.Messages.loadMessages('@salesforce/plugin-devops-center', 'deploy.pipeline');
14
+ /**
15
+ * Contains the logic to execute the sf deploy pipeline command.
16
+ */
17
+ class DeployPipeline extends abstractPromote_1.PromoteCommand {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.isUndeployedOnly = true;
21
+ }
22
+ async run() {
23
+ return this.executePromotion();
24
+ }
25
+ /**
26
+ * Computes the source stage Id for deployOnly promotions. If the given stage has a previous stage
27
+ * then the source stage is the previous stage. If not the it means this is the
28
+ * first stage of the pipeline and source stage Id = Approved.
29
+ *
30
+ * @returns: string. It is the source stage Id.
31
+ */
32
+ getSourceStageId() {
33
+ const targetStage = this.getTargetStage();
34
+ return targetStage.sf_devops__Pipeline_Stages__r
35
+ ? targetStage.sf_devops__Pipeline_Stages__r.records[0].Id
36
+ : constants_1.APPROVED;
37
+ }
38
+ /**
39
+ * Returns the promote option necessary to performs an undeployed only promotion
40
+ */
41
+ getPromoteOptions() {
42
+ return { undeployedOnly: this.isUndeployedOnly };
43
+ }
44
+ }
45
+ exports.default = DeployPipeline;
46
+ DeployPipeline.summary = messages.getMessage('summary');
47
+ DeployPipeline.description = messages.getMessage('description');
48
+ DeployPipeline.examples = messages.getMessages('examples');
49
+ DeployPipeline.state = 'beta';
50
+ //# sourceMappingURL=pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/commands/deploy/pipeline.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2CAA4C;AAE5C,uEAAmE;AAEnE,sDAAkD;AAElD,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,iBAAiB,CAAC,CAAC;AAE9F;;GAEG;AACH,MAAqB,cAAe,SAAQ,gCAAgC;IAA5E;;QAKmB,qBAAgB,GAAG,IAAI,CAAC;IA0B3C,CAAC;IAxBQ,KAAK,CAAC,GAAG;QACd,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACO,gBAAgB;QACxB,MAAM,WAAW,GAAkB,IAAI,CAAC,cAAc,EAAE,CAAC;QACzD,OAAO,WAAW,CAAC,6BAA6B;YAC9C,CAAC,CAAC,WAAW,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE;YACzD,CAAC,CAAC,oBAAQ,CAAC;IACf,CAAC;IAED;;OAEG;IACO,iBAAiB;QACzB,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACnD,CAAC;;AA9BH,iCA+BC;AA9BwB,sBAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACzC,0BAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,uBAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC5C,oBAAK,GAAG,MAAM,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { Org, SfError } from '@salesforce/core';
2
+ import { SfCommand } from '@salesforce/sf-plugins-core';
3
+ import { Interfaces } from '@oclif/core';
4
+ import { PipelineStage, PromoteOptions, PromotePipelineResult } from '..';
5
+ export type Flags<T extends typeof SfCommand> = Interfaces.InferredFlags<(typeof PromoteCommand)['baseFlags'] & T['flags']>;
6
+ export declare abstract class PromoteCommand<T extends typeof SfCommand> extends SfCommand<PromotePipelineResult> {
7
+ static baseFlags: {
8
+ 'branch-name': Interfaces.OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
9
+ 'bundle-version-name': Interfaces.OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
10
+ 'deploy-all': Interfaces.BooleanFlag<boolean>;
11
+ 'devops-center-project-name': Interfaces.OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
12
+ 'devops-center-username': Interfaces.OptionFlag<Org | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
13
+ tests: Interfaces.OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
14
+ 'test-level': Interfaces.OptionFlag<import("..").TestLevel | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
15
+ async: Interfaces.BooleanFlag<boolean>;
16
+ wait: Interfaces.OptionFlag<import("@salesforce/kit").Duration, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
17
+ verbose: Interfaces.BooleanFlag<boolean>;
18
+ concise: Interfaces.BooleanFlag<boolean>;
19
+ };
20
+ protected flags: Flags<T>;
21
+ private targetStage;
22
+ private sourceStageId;
23
+ private deployOptions;
24
+ private numRetries409;
25
+ private outputService;
26
+ init(): Promise<void>;
27
+ protected executePromotion(): Promise<PromotePipelineResult>;
28
+ /**
29
+ *
30
+ * Sends an Http request to the target org to initiate a promotion.
31
+ *
32
+ * @param doceOrg target org.
33
+ * @returns Aor Id of promote operation.
34
+ */
35
+ protected requestPromotionFlow(doceOrg: Org): Promise<string>;
36
+ /**
37
+ *
38
+ * Sends an Http request to the target org to initiate a promotion.
39
+ * If it gets a 409/Conflict it will retry till the request successes,
40
+ * gets a differenct error or run out of retry attempts.
41
+ *
42
+ * @param doceOrg target org.
43
+ * @param numRetries Amount of remaining retry attempts.
44
+ * @returns Aor Id of promote operation
45
+ */
46
+ protected retryRequestPromotion(doceOrg: Org, numRetries: number): Promise<string>;
47
+ protected getTargetStage(): PipelineStage;
48
+ /**
49
+ * Default function for catching commands errors.
50
+ *
51
+ * @param error
52
+ * @returns
53
+ */
54
+ protected catch(error: Error | SfError): Promise<SfCommand.Error>;
55
+ private requestPromotion;
56
+ private buildPromoteOptions;
57
+ /**
58
+ * Knows how to compute the target pipeline stage Id based on the type of promotion.
59
+ *
60
+ * @returns: string. It is the source stage Id.
61
+ */
62
+ protected abstract getSourceStageId(): string;
63
+ /**
64
+ * Returns the specific promote options specific for every concrete implementations.
65
+ *
66
+ * @returns: Partial<PromoteOptions>.
67
+ */
68
+ protected abstract getPromoteOptions(): Partial<PromoteOptions>;
69
+ }