@salesforce/plugin-devops-center 1.2.27 → 1.3.0
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/LICENSE.txt +200 -6
- package/README.md +515 -19
- package/bin/dev.js +15 -0
- package/bin/run.js +5 -0
- package/lib/commands/devops/pipeline/activate.d.ts +14 -0
- package/lib/commands/devops/pipeline/activate.js +82 -0
- package/lib/commands/devops/pipeline/activate.js.map +1 -0
- package/lib/commands/devops/pipeline/attach-project.d.ts +15 -0
- package/lib/commands/devops/pipeline/attach-project.js +82 -0
- package/lib/commands/devops/pipeline/attach-project.js.map +1 -0
- package/lib/commands/devops/pipeline/create.d.ts +23 -0
- package/lib/commands/devops/pipeline/create.js +136 -0
- package/lib/commands/devops/pipeline/create.js.map +1 -0
- package/lib/commands/devops/pipeline/stage/add.d.ts +16 -0
- package/lib/commands/devops/pipeline/stage/add.js +94 -0
- package/lib/commands/devops/pipeline/stage/add.js.map +1 -0
- package/lib/commands/devops/project/create.d.ts +15 -0
- package/lib/commands/devops/project/create.js +72 -0
- package/lib/commands/devops/project/create.js.map +1 -0
- package/lib/commands/devops/project/list.d.ts +20 -0
- package/lib/commands/devops/project/list.js +59 -0
- package/lib/commands/devops/project/list.js.map +1 -0
- package/lib/commands/devops/pull-request/create.d.ts +17 -0
- package/lib/commands/devops/pull-request/create.js +104 -0
- package/lib/commands/devops/pull-request/create.js.map +1 -0
- package/lib/commands/devops/stage/add-branch.d.ts +17 -0
- package/lib/commands/devops/stage/add-branch.js +110 -0
- package/lib/commands/devops/stage/add-branch.js.map +1 -0
- package/lib/commands/devops/stage/add-environment.d.ts +18 -0
- package/lib/commands/devops/stage/add-environment.js +136 -0
- package/lib/commands/devops/stage/add-environment.js.map +1 -0
- package/lib/commands/devops/work-item/create.d.ts +16 -0
- package/lib/commands/devops/work-item/create.js +76 -0
- package/lib/commands/devops/work-item/create.js.map +1 -0
- package/lib/commands/devops/work-item/list.d.ts +17 -0
- package/lib/commands/devops/work-item/list.js +72 -0
- package/lib/commands/devops/work-item/list.js.map +1 -0
- package/lib/commands/devops/work-item/status/update.d.ts +16 -0
- package/lib/commands/devops/work-item/status/update.js +90 -0
- package/lib/commands/devops/work-item/status/update.js.map +1 -0
- package/lib/commands/project/deploy/pipeline/quick.d.ts +2 -2
- package/lib/commands/project/deploy/pipeline/quick.js +24 -21
- package/lib/commands/project/deploy/pipeline/quick.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/report.d.ts +4 -4
- package/lib/commands/project/deploy/pipeline/report.js +38 -35
- package/lib/commands/project/deploy/pipeline/report.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/resume.d.ts +2 -2
- package/lib/commands/project/deploy/pipeline/resume.js +24 -21
- package/lib/commands/project/deploy/pipeline/resume.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/start.d.ts +3 -3
- package/lib/commands/project/deploy/pipeline/start.js +26 -23
- package/lib/commands/project/deploy/pipeline/start.js.map +1 -1
- package/lib/commands/project/deploy/pipeline/validate.d.ts +3 -3
- package/lib/commands/project/deploy/pipeline/validate.js +24 -21
- package/lib/commands/project/deploy/pipeline/validate.js.map +1 -1
- package/lib/common/base/abstractAsyncOperation.d.ts +3 -3
- package/lib/common/base/abstractAsyncOperation.js +31 -23
- package/lib/common/base/abstractAsyncOperation.js.map +1 -1
- package/lib/common/base/abstractPromote.d.ts +5 -4
- package/lib/common/base/abstractPromote.js +52 -38
- package/lib/common/base/abstractPromote.js.map +1 -1
- package/lib/common/base/abstractQuick.d.ts +4 -3
- package/lib/common/base/abstractQuick.js +44 -43
- package/lib/common/base/abstractQuick.js.map +1 -1
- package/lib/common/base/abstractReportOnPromote.d.ts +2 -1
- package/lib/common/base/abstractReportOnPromote.js +31 -24
- package/lib/common/base/abstractReportOnPromote.js.map +1 -1
- package/lib/common/base/abstractResume.d.ts +3 -2
- package/lib/common/base/abstractResume.js +40 -33
- package/lib/common/base/abstractResume.js.map +1 -1
- package/lib/common/constants.js +19 -13
- package/lib/common/constants.js.map +1 -1
- package/lib/common/deployPipelineCache.js +20 -15
- package/lib/common/deployPipelineCache.js.map +1 -1
- package/lib/common/flags/flags.d.ts +2 -2
- package/lib/common/flags/flags.js +34 -29
- package/lib/common/flags/flags.js.map +1 -1
- package/lib/common/flags/promote/promoteFlags.d.ts +3 -3
- package/lib/common/flags/promote/promoteFlags.js +26 -20
- package/lib/common/flags/promote/promoteFlags.js.map +1 -1
- package/lib/common/index.d.ts +3 -2
- package/lib/common/index.js +2 -17
- package/lib/common/index.js.map +1 -1
- package/lib/common/outputColumns.d.ts +3 -13
- package/lib/common/outputColumns.js +23 -19
- package/lib/common/outputColumns.js.map +1 -1
- package/lib/common/outputService/aorOutputService.d.ts +4 -4
- package/lib/common/outputService/aorOutputService.js +27 -20
- package/lib/common/outputService/aorOutputService.js.map +1 -1
- package/lib/common/outputService/deployCommandOutputService.d.ts +2 -2
- package/lib/common/outputService/deployCommandOutputService.js +17 -12
- package/lib/common/outputService/deployCommandOutputService.js.map +1 -1
- package/lib/common/outputService/deploySummaryBuilder.d.ts +1 -1
- package/lib/common/outputService/deploySummaryBuilder.js +45 -31
- package/lib/common/outputService/deploySummaryBuilder.js.map +1 -1
- package/lib/common/outputService/deploymentResultOutputService.d.ts +4 -4
- package/lib/common/outputService/deploymentResultOutputService.js +16 -10
- package/lib/common/outputService/deploymentResultOutputService.js.map +1 -1
- package/lib/common/outputService/index.d.ts +8 -6
- package/lib/common/outputService/index.js +5 -19
- package/lib/common/outputService/index.js.map +1 -1
- package/lib/common/outputService/outputService.d.ts +6 -4
- package/lib/common/outputService/outputService.js +20 -14
- package/lib/common/outputService/outputService.js.map +1 -1
- package/lib/common/outputService/outputServiceFactory.d.ts +8 -8
- package/lib/common/outputService/outputServiceFactory.js +21 -16
- package/lib/common/outputService/outputServiceFactory.js.map +1 -1
- package/lib/common/outputService/outputUtils.d.ts +1 -1
- package/lib/common/outputService/outputUtils.js +24 -19
- package/lib/common/outputService/outputUtils.js.map +1 -1
- package/lib/common/outputService/promoteOutputService.d.ts +4 -5
- package/lib/common/outputService/promoteOutputService.js +19 -13
- package/lib/common/outputService/promoteOutputService.js.map +1 -1
- package/lib/common/outputService/reportOutputService.d.ts +5 -6
- package/lib/common/outputService/reportOutputService.js +32 -27
- package/lib/common/outputService/reportOutputService.js.map +1 -1
- package/lib/common/outputService/resumeCommandOutputService.d.ts +3 -3
- package/lib/common/outputService/resumeCommandOutputService.js +19 -13
- package/lib/common/outputService/resumeCommandOutputService.js.map +1 -1
- package/lib/common/outputService/resumeOutputService.d.ts +3 -3
- package/lib/common/outputService/resumeOutputService.js +23 -17
- package/lib/common/outputService/resumeOutputService.js.map +1 -1
- package/lib/common/selectors/asyncOperationResultsSelector.d.ts +1 -1
- package/lib/common/selectors/asyncOperationResultsSelector.js +16 -10
- package/lib/common/selectors/asyncOperationResultsSelector.js.map +1 -1
- package/lib/common/selectors/deployComponentsSelector.d.ts +1 -1
- package/lib/common/selectors/deployComponentsSelector.js +18 -13
- package/lib/common/selectors/deployComponentsSelector.js.map +1 -1
- package/lib/common/selectors/deployProgressSummarySelector.d.ts +2 -2
- package/lib/common/selectors/deployProgressSummarySelector.js +16 -10
- package/lib/common/selectors/deployProgressSummarySelector.js.map +1 -1
- package/lib/common/selectors/deploymentResultsSelector.d.ts +2 -2
- package/lib/common/selectors/deploymentResultsSelector.js +20 -16
- package/lib/common/selectors/deploymentResultsSelector.js.map +1 -1
- package/lib/common/selectors/environmentSelector.d.ts +2 -2
- package/lib/common/selectors/environmentSelector.js +16 -10
- package/lib/common/selectors/environmentSelector.js.map +1 -1
- package/lib/common/selectors/namedCredentialSelector.d.ts +1 -1
- package/lib/common/selectors/namedCredentialSelector.js +16 -10
- package/lib/common/selectors/namedCredentialSelector.js.map +1 -1
- package/lib/common/selectors/pipelineStageSelector.d.ts +1 -1
- package/lib/common/selectors/pipelineStageSelector.js +18 -13
- package/lib/common/selectors/pipelineStageSelector.js.map +1 -1
- package/lib/common/selectors/selectorUtils.d.ts +1 -1
- package/lib/common/selectors/selectorUtils.js +17 -11
- package/lib/common/selectors/selectorUtils.js.map +1 -1
- package/lib/common/selectors/validateDeploySelector.d.ts +1 -1
- package/lib/common/selectors/validateDeploySelector.js +16 -10
- package/lib/common/selectors/validateDeploySelector.js.map +1 -1
- package/lib/common/selectors/workItemSelector.d.ts +2 -2
- package/lib/common/selectors/workItemSelector.js +16 -10
- package/lib/common/selectors/workItemSelector.js.map +1 -1
- package/lib/common/types.d.ts +4 -4
- package/lib/common/types.js +4 -7
- package/lib/common/types.js.map +1 -1
- package/lib/common/utils.d.ts +4 -4
- package/lib/common/utils.js +42 -43
- package/lib/common/utils.js.map +1 -1
- package/lib/configMeta.js +21 -15
- package/lib/configMeta.js.map +1 -1
- package/lib/streamer/doceMonitor.d.ts +3 -2
- package/lib/streamer/doceMonitor.js +14 -6
- package/lib/streamer/doceMonitor.js.map +1 -1
- package/lib/streamer/doceStream.d.ts +1 -1
- package/lib/streamer/doceStream.js +19 -11
- package/lib/streamer/doceStream.js.map +1 -1
- package/lib/streamer/processors/asyncOpStream.d.ts +2 -2
- package/lib/streamer/processors/asyncOpStream.js +22 -15
- package/lib/streamer/processors/asyncOpStream.js.map +1 -1
- package/lib/streamer/sObjectStream.d.ts +1 -1
- package/lib/streamer/sObjectStream.js +9 -10
- package/lib/streamer/sObjectStream.js.map +1 -1
- package/lib/utils/activatePipeline.d.ts +17 -0
- package/lib/utils/activatePipeline.js +35 -0
- package/lib/utils/activatePipeline.js.map +1 -0
- package/lib/utils/addPipelineStage.d.ts +20 -0
- package/lib/utils/addPipelineStage.js +43 -0
- package/lib/utils/addPipelineStage.js.map +1 -0
- package/lib/utils/addStageBranch.d.ts +22 -0
- package/lib/utils/addStageBranch.js +48 -0
- package/lib/utils/addStageBranch.js.map +1 -0
- package/lib/utils/addStageEnvironment.d.ts +92 -0
- package/lib/utils/addStageEnvironment.js +120 -0
- package/lib/utils/addStageEnvironment.js.map +1 -0
- package/lib/utils/attachProject.d.ts +21 -0
- package/lib/utils/attachProject.js +44 -0
- package/lib/utils/attachProject.js.map +1 -0
- package/lib/utils/createPipeline.d.ts +34 -0
- package/lib/utils/createPipeline.js +77 -0
- package/lib/utils/createPipeline.js.map +1 -0
- package/lib/utils/createProject.d.ts +17 -0
- package/lib/utils/createProject.js +39 -0
- package/lib/utils/createProject.js.map +1 -0
- package/lib/utils/createPullRequest.d.ts +49 -0
- package/lib/utils/createPullRequest.js +204 -0
- package/lib/utils/createPullRequest.js.map +1 -0
- package/lib/utils/createWorkItem.d.ts +19 -0
- package/lib/utils/createWorkItem.js +58 -0
- package/lib/utils/createWorkItem.js.map +1 -0
- package/lib/utils/pipelineUtils.d.ts +8 -0
- package/lib/utils/pipelineUtils.js +51 -0
- package/lib/utils/pipelineUtils.js.map +1 -0
- package/lib/utils/types.d.ts +57 -0
- package/lib/utils/types.js +17 -0
- package/lib/utils/types.js.map +1 -0
- package/lib/utils/updateWorkItemStatus.d.ts +34 -0
- package/lib/utils/updateWorkItemStatus.js +71 -0
- package/lib/utils/updateWorkItemStatus.js.map +1 -0
- package/lib/utils/workItems.d.ts +3 -0
- package/lib/utils/workItems.js +181 -0
- package/lib/utils/workItems.js.map +1 -0
- package/messages/commonErrors.md +5 -1
- package/messages/devops.pipeline.activate.md +29 -0
- package/messages/devops.pipeline.attach-project.md +29 -0
- package/messages/devops.pipeline.create.md +81 -0
- package/messages/devops.pipeline.stage.add.md +37 -0
- package/messages/devops.project.create.md +29 -0
- package/messages/devops.project.list.md +17 -0
- package/messages/devops.pull-request.create.md +57 -0
- package/messages/devops.stage.add-branch.md +46 -0
- package/messages/devops.stage.add-environment.md +61 -0
- package/messages/devops.work-item.create.md +29 -0
- package/messages/devops.work-item.list.md +21 -0
- package/messages/devops.work-item.status.update.md +29 -0
- package/npm-shrinkwrap.json +4197 -4471
- package/oclif.lock +3380 -3272
- package/oclif.manifest.json +1056 -11
- package/package.json +53 -23
- package/schemas/devops-pipeline-activate.json +28 -0
- package/schemas/devops-pipeline-attach__project.json +25 -0
- package/schemas/devops-pipeline-create.json +50 -0
- package/schemas/devops-pipeline-stage-add.json +31 -0
- package/schemas/devops-project-create.json +28 -0
- package/schemas/devops-project-list.json +35 -0
- package/schemas/devops-pull__request-create.json +34 -0
- package/schemas/devops-stage-add__branch.json +34 -0
- package/schemas/devops-stage-add__environment.json +47 -0
- package/schemas/devops-work__item-create.json +28 -0
- package/schemas/devops-work__item-list.json +75 -0
- package/schemas/devops-work__item-status-update.json +28 -0
- package/schemas/project-deploy-pipeline-report.json +2 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { ActivatePipelineResult } from '../../../utils/activatePipeline.js';
|
|
4
|
+
export default class DevopsPipelineActivate extends SfCommand<ActivatePipelineResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<ActivatePipelineResult>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { activatePipeline } from '../../../utils/activatePipeline.js';
|
|
19
|
+
import { fetchPipelineStages } from '../../../utils/pipelineUtils.js';
|
|
20
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
21
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.activate');
|
|
22
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
23
|
+
export default class DevopsPipelineActivate extends SfCommand {
|
|
24
|
+
static summary = messages.getMessage('summary');
|
|
25
|
+
static description = messages.getMessage('description');
|
|
26
|
+
static examples = messages.getMessages('examples');
|
|
27
|
+
static flags = {
|
|
28
|
+
'target-org': Flags.requiredOrg(),
|
|
29
|
+
'api-version': Flags.orgApiVersion(),
|
|
30
|
+
'pipeline-id': Flags.salesforceId({
|
|
31
|
+
summary: messages.getMessage('flags.pipeline-id.summary'),
|
|
32
|
+
required: true,
|
|
33
|
+
char: undefined,
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
async run() {
|
|
37
|
+
const { flags } = await this.parse(DevopsPipelineActivate);
|
|
38
|
+
const org = flags['target-org'];
|
|
39
|
+
const connection = org.getConnection(flags['api-version']);
|
|
40
|
+
const pipelineId = flags['pipeline-id'];
|
|
41
|
+
let stages;
|
|
42
|
+
try {
|
|
43
|
+
stages = await fetchPipelineStages(connection, pipelineId);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
47
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
48
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
if (stages.length === 0) {
|
|
53
|
+
this.error(messages.getMessage('error.NoStages', [pipelineId]));
|
|
54
|
+
}
|
|
55
|
+
let result;
|
|
56
|
+
try {
|
|
57
|
+
result = await activatePipeline({ connection, pipelineId });
|
|
58
|
+
result.stageCount = stages.length;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
62
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
63
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
64
|
+
}
|
|
65
|
+
if (errMsg.includes('already active') || errMsg.includes('ALREADY_ACTIVE')) {
|
|
66
|
+
this.error(messages.getMessage('error.AlreadyActive', [pipelineId]));
|
|
67
|
+
}
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
if (result.success) {
|
|
71
|
+
this.log('Successfully activated the pipeline.');
|
|
72
|
+
this.log(` Pipeline ID: ${pipelineId}`);
|
|
73
|
+
this.log(` Status: ${result.status ?? 'Active'}`);
|
|
74
|
+
this.log(` Stages: ${result.stageCount ?? stages.length}`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.error(`Failed to activate pipeline: ${result.error ?? ''}`);
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=activate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activate.js","sourceRoot":"","sources":["../../../../src/commands/devops/pipeline/activate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SA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,CAAC,8BAA8B,CAAC,CAAC,CAAC;YAC7E,CAAC;YACD,IAAI,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBAC3E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YACvE,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;YACjD,IAAI,CAAC,GAAG,CAAC,kBAAkB,UAAU,EAAE,CAAC,CAAC;YACzC,IAAI,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC,CAAC;YACxD,IAAI,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,gCAAgC,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { AttachProjectResult } from '../../../utils/attachProject.js';
|
|
4
|
+
export default class DevopsPipelineAttachProject extends SfCommand<AttachProjectResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'project-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<AttachProjectResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { attachProject, findExistingAttachment } from '../../../utils/attachProject.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.attach-project');
|
|
21
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
22
|
+
export default class DevopsPipelineAttachProject extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static flags = {
|
|
27
|
+
'target-org': Flags.requiredOrg(),
|
|
28
|
+
'api-version': Flags.orgApiVersion(),
|
|
29
|
+
'pipeline-id': Flags.salesforceId({
|
|
30
|
+
summary: messages.getMessage('flags.pipeline-id.summary'),
|
|
31
|
+
required: true,
|
|
32
|
+
char: undefined,
|
|
33
|
+
}),
|
|
34
|
+
'project-id': Flags.salesforceId({
|
|
35
|
+
summary: messages.getMessage('flags.project-id.summary'),
|
|
36
|
+
required: true,
|
|
37
|
+
char: undefined,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
async run() {
|
|
41
|
+
const { flags } = await this.parse(DevopsPipelineAttachProject);
|
|
42
|
+
const org = flags['target-org'];
|
|
43
|
+
const connection = org.getConnection(flags['api-version']);
|
|
44
|
+
const projectId = flags['project-id'];
|
|
45
|
+
const pipelineId = flags['pipeline-id'];
|
|
46
|
+
let existingPipelineId;
|
|
47
|
+
try {
|
|
48
|
+
existingPipelineId = await findExistingAttachment(connection, projectId);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
52
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
53
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
if (existingPipelineId) {
|
|
58
|
+
this.error(messages.getMessage('error.AlreadyAttached', [projectId, existingPipelineId]));
|
|
59
|
+
}
|
|
60
|
+
let result;
|
|
61
|
+
try {
|
|
62
|
+
result = await attachProject({ connection, projectId, pipelineId });
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
66
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
67
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
68
|
+
}
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
if (result.success) {
|
|
72
|
+
this.log('Successfully attached project to pipeline.');
|
|
73
|
+
this.log(` Project ID: ${projectId}`);
|
|
74
|
+
this.log(` Pipeline ID: ${pipelineId}`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.error(`Failed to attach project to pipeline: ${result.error ?? ''}`);
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=attach-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attach-project.js","sourceRoot":"","sources":["../../../../src/commands/devops/pipeline/attach-project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAuB,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE7G,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,gCAAgC,CAAC,CAAC;AAC7G,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,SAA8B;IAC9E,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE;QAC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AAE,CAAC;YACvB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,uBAAuB,EAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;QAC5F,CAAC;QAED,IAAI,MAA2B,CAAC;QAChC,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,aAAa,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtE,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAC3E,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,CAAC;YAC7E,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,kBAAkB,SAAS,EAAE,CAAC,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,kBAAkB,UAAU,EAAE,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,yCAAyC,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { CreatePipelineResult } from '../../../utils/createPipeline.js';
|
|
4
|
+
export default class DevopsPipelineCreate extends SfCommand<CreatePipelineResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
repo: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'repo-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'create-repo': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
'repo-owner': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'bitbucket-project': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<CreatePipelineResult>;
|
|
20
|
+
private resolveRepoType;
|
|
21
|
+
private handleApiError;
|
|
22
|
+
private printSuccessOutput;
|
|
23
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { createPipeline, detectRepoType } from '../../../utils/createPipeline.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.create');
|
|
21
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
22
|
+
export default class DevopsPipelineCreate extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static flags = {
|
|
27
|
+
'target-org': Flags.requiredOrg(),
|
|
28
|
+
'api-version': Flags.orgApiVersion(),
|
|
29
|
+
name: Flags.string({
|
|
30
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
31
|
+
char: 'n',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
repo: Flags.string({
|
|
35
|
+
summary: messages.getMessage('flags.repo.summary'),
|
|
36
|
+
char: 'r',
|
|
37
|
+
required: true,
|
|
38
|
+
}),
|
|
39
|
+
'repo-type': Flags.string({
|
|
40
|
+
summary: messages.getMessage('flags.repo-type.summary'),
|
|
41
|
+
options: ['github', 'bitbucket'],
|
|
42
|
+
}),
|
|
43
|
+
'create-repo': Flags.boolean({
|
|
44
|
+
summary: messages.getMessage('flags.create-repo.summary'),
|
|
45
|
+
default: false,
|
|
46
|
+
}),
|
|
47
|
+
'repo-owner': Flags.string({
|
|
48
|
+
summary: messages.getMessage('flags.repo-owner.summary'),
|
|
49
|
+
}),
|
|
50
|
+
'bitbucket-project': Flags.string({
|
|
51
|
+
summary: messages.getMessage('flags.bitbucket-project.summary'),
|
|
52
|
+
}),
|
|
53
|
+
description: Flags.string({
|
|
54
|
+
summary: messages.getMessage('flags.description.summary'),
|
|
55
|
+
char: 'd',
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
async run() {
|
|
59
|
+
const { flags } = await this.parse(DevopsPipelineCreate);
|
|
60
|
+
const org = flags['target-org'];
|
|
61
|
+
const connection = org.getConnection(flags['api-version']);
|
|
62
|
+
const repoType = this.resolveRepoType(flags['repo-type'], flags['repo'], flags['create-repo']);
|
|
63
|
+
if (flags['create-repo'] && !flags['repo-owner']) {
|
|
64
|
+
this.error(messages.getMessage('error.RepoOwnerRequired'));
|
|
65
|
+
}
|
|
66
|
+
let result;
|
|
67
|
+
try {
|
|
68
|
+
result = await createPipeline({
|
|
69
|
+
connection,
|
|
70
|
+
name: flags['name'],
|
|
71
|
+
description: flags['description'],
|
|
72
|
+
repo: flags['repo'],
|
|
73
|
+
repoType,
|
|
74
|
+
createRepo: flags['create-repo'],
|
|
75
|
+
repoOwner: flags['repo-owner'],
|
|
76
|
+
bitbucketProject: flags['bitbucket-project'],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
81
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
82
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
83
|
+
}
|
|
84
|
+
this.handleApiError(errMsg, flags['repo']);
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
if (result.success) {
|
|
88
|
+
this.printSuccessOutput(result, flags['repo'], org.getUsername());
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
this.error(`Failed to create pipeline: ${result.error ?? ''}`);
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
resolveRepoType(flagRepoType, repo, isCreateRepo) {
|
|
96
|
+
if (isCreateRepo && !flagRepoType) {
|
|
97
|
+
this.error(messages.getMessage('error.RepoTypeRequired'));
|
|
98
|
+
}
|
|
99
|
+
if (flagRepoType)
|
|
100
|
+
return flagRepoType;
|
|
101
|
+
const detected = detectRepoType(repo);
|
|
102
|
+
if (!detected) {
|
|
103
|
+
this.error(messages.getMessage('error.RepoTypeDetectionFailed', [repo]));
|
|
104
|
+
}
|
|
105
|
+
return detected;
|
|
106
|
+
}
|
|
107
|
+
handleApiError(errMsg, repo) {
|
|
108
|
+
if (errMsg.includes('REPOSITORY_CREATION_FAILED')) {
|
|
109
|
+
this.error(messages.getMessage('error.RepoCreationFailed', [repo, errMsg]));
|
|
110
|
+
}
|
|
111
|
+
if (errMsg.includes('REPO_NOT_FOUND_OR_UNAUTHORIZED')) {
|
|
112
|
+
this.error(messages.getMessage('error.RepoNotFound', [repo]));
|
|
113
|
+
}
|
|
114
|
+
if (errMsg.includes('SOURCE_CODE_SERVICE_ERROR')) {
|
|
115
|
+
this.error(messages.getMessage('error.RepoValidationFailed', [repo]));
|
|
116
|
+
}
|
|
117
|
+
if (errMsg.includes('BITBUCKET_API_ERROR') && errMsg.includes('ProviderInfo is missing')) {
|
|
118
|
+
this.error(messages.getMessage('error.VcsCredentialsMissing', [repo]));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
printSuccessOutput(result, repoFlag, username) {
|
|
122
|
+
if (result.repository?.created) {
|
|
123
|
+
this.log(`Created repository: ${repoFlag} (${result.repository.repoType})`);
|
|
124
|
+
}
|
|
125
|
+
this.log(`Successfully created pipeline: ${result.name ?? ''}`);
|
|
126
|
+
this.log(` Pipeline ID: ${result.pipelineId ?? ''}`);
|
|
127
|
+
this.log(` Repository: ${result.repository?.repoUrl ?? ''} (${result.repository?.repoType ?? ''})`);
|
|
128
|
+
this.log(` Status: ${result.status ?? 'Inactive'}`);
|
|
129
|
+
this.log(' Next steps:');
|
|
130
|
+
const orgLabel = username ?? '<org>';
|
|
131
|
+
const pipelineIdLabel = result.pipelineId ?? '<ID>';
|
|
132
|
+
this.log(` Add pipeline stages: sf devops pipeline stage add --target-org ${orgLabel} --pipeline-id ${pipelineIdLabel}`);
|
|
133
|
+
this.log(` Attach a project: sf devops pipeline attach-project --target-org ${orgLabel} --pipeline-id ${pipelineIdLabel} --project-id <ID>`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/devops/pipeline/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAwB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAExG,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,wBAAwB,CAAC,CAAC;AACrG,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,SAA+B;IACxE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,aAAa,E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e,EAAE,CAClH,CAAC;QACF,IAAI,CAAC,GAAG,CACN,wEAAwE,QAAQ,kBAAkB,eAAe,oBAAoB,CACtI,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { AddPipelineStageResult } from '../../../../utils/addPipelineStage.js';
|
|
4
|
+
export default class DevopsPipelineStageAdd extends SfCommand<AddPipelineStageResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'next-stage-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<AddPipelineStageResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { addPipelineStage } from '../../../../utils/addPipelineStage.js';
|
|
19
|
+
import { fetchPipelineStages } from '../../../../utils/pipelineUtils.js';
|
|
20
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
21
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.pipeline.stage.add');
|
|
22
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
23
|
+
export default class DevopsPipelineStageAdd extends SfCommand {
|
|
24
|
+
static summary = messages.getMessage('summary');
|
|
25
|
+
static description = messages.getMessage('description');
|
|
26
|
+
static examples = messages.getMessages('examples');
|
|
27
|
+
static flags = {
|
|
28
|
+
'target-org': Flags.requiredOrg(),
|
|
29
|
+
'api-version': Flags.orgApiVersion(),
|
|
30
|
+
'pipeline-id': Flags.salesforceId({
|
|
31
|
+
summary: messages.getMessage('flags.pipeline-id.summary'),
|
|
32
|
+
required: true,
|
|
33
|
+
char: undefined,
|
|
34
|
+
}),
|
|
35
|
+
name: Flags.string({
|
|
36
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
37
|
+
char: 'n',
|
|
38
|
+
required: true,
|
|
39
|
+
}),
|
|
40
|
+
'next-stage-id': Flags.salesforceId({
|
|
41
|
+
summary: messages.getMessage('flags.next-stage-id.summary'),
|
|
42
|
+
required: true,
|
|
43
|
+
char: undefined,
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
46
|
+
async run() {
|
|
47
|
+
const { flags } = await this.parse(DevopsPipelineStageAdd);
|
|
48
|
+
const org = flags['target-org'];
|
|
49
|
+
const connection = org.getConnection(flags['api-version']);
|
|
50
|
+
const pipelineId = flags['pipeline-id'];
|
|
51
|
+
const nextStageId = flags['next-stage-id'];
|
|
52
|
+
let stages;
|
|
53
|
+
try {
|
|
54
|
+
stages = await fetchPipelineStages(connection, pipelineId);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
58
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
59
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
60
|
+
}
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
if (!stages.some((s) => s.Id === nextStageId)) {
|
|
64
|
+
this.error(messages.getMessage('error.StageNotFound', [nextStageId, pipelineId]));
|
|
65
|
+
}
|
|
66
|
+
let result;
|
|
67
|
+
try {
|
|
68
|
+
result = await addPipelineStage({
|
|
69
|
+
connection,
|
|
70
|
+
pipelineId,
|
|
71
|
+
name: flags['name'],
|
|
72
|
+
nextStageId,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
77
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
78
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
79
|
+
}
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
if (result.success) {
|
|
83
|
+
this.log(`Successfully added stage "${result.name ?? ''}" to the pipeline.`);
|
|
84
|
+
this.log(` Stage ID: ${result.stageId ?? ''}`);
|
|
85
|
+
this.log(` Position: before "${nextStageId}"`);
|
|
86
|
+
this.log(` Pipeline ID: ${pipelineId}`);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
this.error(`Failed to add stage: ${result.error ?? ''}`);
|
|
90
|
+
}
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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0 +1,15 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { CreateProjectResult } from '../../../utils/createProject.js';
|
|
4
|
+
export default class DevopsProjectCreate extends SfCommand<CreateProjectResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<CreateProjectResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { createProject } from '../../../utils/createProject.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-devops-center', 'devops.project.create');
|
|
21
|
+
const commonErrorMessages = Messages.loadMessages('@salesforce/plugin-devops-center', 'commonErrors');
|
|
22
|
+
export default class DevopsProjectCreate extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static flags = {
|
|
27
|
+
'target-org': Flags.requiredOrg(),
|
|
28
|
+
'api-version': Flags.orgApiVersion(),
|
|
29
|
+
name: Flags.string({
|
|
30
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
31
|
+
char: 'n',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
description: Flags.string({
|
|
35
|
+
summary: messages.getMessage('flags.description.summary'),
|
|
36
|
+
char: 'd',
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
async run() {
|
|
40
|
+
const { flags } = await this.parse(DevopsProjectCreate);
|
|
41
|
+
const org = flags['target-org'];
|
|
42
|
+
const connection = org.getConnection(flags['api-version']);
|
|
43
|
+
let result;
|
|
44
|
+
try {
|
|
45
|
+
result = await createProject({
|
|
46
|
+
connection,
|
|
47
|
+
name: flags['name'],
|
|
48
|
+
description: flags['description'] ?? '',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
53
|
+
if (errMsg.includes('sObject type') && errMsg.includes('is not supported')) {
|
|
54
|
+
this.error(commonErrorMessages.getMessage('error.DevopsCenterNotEnabled'));
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
if (result.success) {
|
|
59
|
+
this.log(`Successfully created project: ${result.name ?? ''}`);
|
|
60
|
+
this.log(` ID: ${result.projectId ?? ''}`);
|
|
61
|
+
this.log(` Name: ${result.name ?? ''}`);
|
|
62
|
+
if (result.description) {
|
|
63
|
+
this.log(` Description: ${result.description}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.error(`Failed to create project: ${result.error ?? ''}`);
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/devops/project/create.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAuB,MAAM,iCAAiC,CAAC;AAErF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,uBAAuB,CAAC,CAAC;AACpG,MAAM,mBAAmB,GAAG,QAAQ,CAAC,YAAY,CAAC,kCAAkC,EAAE,cAAc,CAAC,CAAC;AAEtG,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,SAA8B;IACtE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE;QACpC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YAC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,EAAE,CAAC,CAAC;YAC/D,IAAI,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC,CAAC;YACrD,IAAI,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;YAChD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBACvB,IAAI,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,6BAA6B,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Org } from '@salesforce/core';
|
|
2
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
export type DevopsProject = {
|
|
4
|
+
Id: string;
|
|
5
|
+
Name: string;
|
|
6
|
+
Description: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type DevopsProjectListResult = {
|
|
9
|
+
projects: DevopsProject[];
|
|
10
|
+
};
|
|
11
|
+
export default class DevopsProjectList extends SfCommand<DevopsProjectListResult> {
|
|
12
|
+
static readonly summary: string;
|
|
13
|
+
static readonly description: string;
|
|
14
|
+
static readonly examples: string[];
|
|
15
|
+
static readonly flags: {
|
|
16
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<DevopsProjectListResult>;
|
|
20
|
+
}
|