Skip to content

Commit a9bd61e

Browse files
authored
Merge pull request #508 from salesforcecli/ashreya/commands-2
@W-22926100 - Project and create PR commands
2 parents 8bd75f3 + 5964639 commit a9bd61e

26 files changed

Lines changed: 2752 additions & 2122 deletions

command-snapshot.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
[
2+
{
3+
"alias": [],
4+
"command": "devops:pipeline:attach-project",
5+
"flagAliases": [],
6+
"flagChars": ["o"],
7+
"flags": ["api-version", "flags-dir", "json", "pipeline-id", "project-id", "target-org"],
8+
"plugin": "@salesforce/plugin-devops-center"
9+
},
10+
{
11+
"alias": [],
12+
"command": "devops:project:create",
13+
"flagAliases": [],
14+
"flagChars": ["d", "n", "o"],
15+
"flags": ["api-version", "description", "flags-dir", "json", "name", "target-org"],
16+
"plugin": "@salesforce/plugin-devops-center"
17+
},
218
{
319
"alias": [],
420
"command": "devops:project:list",
@@ -7,6 +23,14 @@
723
"flags": ["api-version", "flags-dir", "json", "target-org"],
824
"plugin": "@salesforce/plugin-devops-center"
925
},
26+
{
27+
"alias": [],
28+
"command": "devops:pull-request:create",
29+
"flagAliases": [],
30+
"flagChars": ["n", "o", "w"],
31+
"flags": ["api-version", "body", "flags-dir", "json", "target-org", "title", "work-item-id", "work-item-name"],
32+
"plugin": "@salesforce/plugin-devops-center"
33+
},
1034
{
1135
"alias": [],
1236
"command": "devops:work-item:create",
@@ -23,6 +47,14 @@
2347
"flags": ["api-version", "flags-dir", "json", "project-id", "target-org"],
2448
"plugin": "@salesforce/plugin-devops-center"
2549
},
50+
{
51+
"alias": [],
52+
"command": "devops:work-item:status:update",
53+
"flagAliases": [],
54+
"flagChars": ["n", "o", "w"],
55+
"flags": ["api-version", "flags-dir", "json", "status", "target-org", "work-item-id", "work-item-name"],
56+
"plugin": "@salesforce/plugin-devops-center"
57+
},
2658
{
2759
"alias": [],
2860
"command": "project:deploy:pipeline:quick",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# summary
2+
3+
Attach a DevOps Center project to a pipeline.
4+
5+
# description
6+
7+
You can attach a project to only one pipeline.
8+
9+
# flags.target-org.summary
10+
11+
Username or alias of the DevOps Center org.
12+
13+
# flags.pipeline-id.summary
14+
15+
ID of the pipeline.
16+
17+
# flags.project-id.summary
18+
19+
ID of the DevOps Center project.
20+
21+
# examples
22+
23+
- Attach a project to a pipeline using the project ID and pipeline ID.
24+
25+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --pipeline-id 0XB000000000001 --project-id 0Hn000000000001
26+
27+
# error.AlreadyAttached
28+
29+
Project %s is already attached to pipeline %s. Remove the project, and then try again.

messages/devops.project.create.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# summary
2+
3+
Create a DevOps Center project in a DevOps Center org.
4+
5+
# description
6+
7+
Creates a new DevOps Center project with the specified name and optional description.
8+
9+
# flags.target-org.summary
10+
11+
Username or alias of the DevOps Center org.
12+
13+
# flags.name.summary
14+
15+
Name of the new DevOps Center project.
16+
17+
# flags.description.summary
18+
19+
Description of the new project; if not specified, the description is blank.
20+
21+
# examples
22+
23+
- Create a new DevOps Center project in the specified org.
24+
25+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --name "MyApp Release"
26+
27+
- Create a project with a name and description.
28+
29+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --name "Platform Update" --description "Platform services update"
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# summary
2+
3+
Create a pull request for a work item branch.
4+
5+
# description
6+
7+
The pull request title defaults to the work item subject. The work item must have an associated branch and repository. Requires VCS authentication: set GITHUB_TOKEN (or use `gh auth login`) for GitHub, or set BITBUCKET_TOKEN for Bitbucket.
8+
9+
# flags.work-item-name.summary
10+
11+
Name of the work item, such as WI-000001.
12+
13+
# flags.work-item-id.summary
14+
15+
ID of the work item.
16+
17+
# flags.title.summary
18+
19+
Title of the pull request.
20+
21+
# flags.body.summary
22+
23+
Description of the pull request.
24+
25+
# examples
26+
27+
- Create a pull request for a work item using the default title.
28+
29+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --work-item-name WI-000001
30+
31+
- Create a pull request with a custom title and description.
32+
33+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --work-item-id 0Wx000000000001 --title "Fix: Login timeout" --body "Resolves the 30s timeout on the login page"
34+
35+
# error.NoBranch
36+
37+
Work item %s doesn't have an associated branch. Mark the work item as In Progress to create a branch, then try again.
38+
39+
# error.NoRepo
40+
41+
Work item %s doesn't have an associated repository. Verify the project is connected to a source control repository and try again.
42+
43+
# error.NoTargetBranch
44+
45+
Unable to determine the target branch for work item %s. Verify the pipeline stages are configured correctly.
46+
47+
# error.NoProvider
48+
49+
Unable to determine the VCS provider for work item %s. Verify the project is connected to a supported source control provider (GitHub or Bitbucket).
50+
51+
# flags.target-org.summary
52+
53+
Username or alias of the DevOps Center org.
54+
55+
# error.NoToken
56+
57+
No authentication token found for %s. For GitHub, set the GITHUB_TOKEN environment variable or run "gh auth login". For Bitbucket, set the BITBUCKET_TOKEN environment variable.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# summary
2+
3+
Update the status of a work item in DevOps Center.
4+
5+
# description
6+
7+
Allowed statuses are "In Progress" and "Ready to Promote".
8+
9+
# flags.work-item-name.summary
10+
11+
Name of the work item, such as WI-000001.
12+
13+
# flags.work-item-id.summary
14+
15+
ID of the work item.
16+
17+
# flags.status.summary
18+
19+
Status to set for the work item. Allowed values: "In Progress", "Ready to Promote".
20+
21+
# examples
22+
23+
- Update a work item status by its name to indicate the work is underway:
24+
25+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --work-item-name WI-000001 --status "In Progress"
26+
27+
- Update a work item status by its ID to indicate the changes are ready for promotion:
28+
29+
<%= config.bin %> <%= command.id %> --target-org my-devops-org --work-item-id 0Wx000000000001 --status "Ready to Promote"

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
"@salesforce/dev-scripts": "^11",
2222
"@salesforce/plugin-command-reference": "^3.1.38",
2323
"@salesforce/ts-sinon": "^1.4.30",
24-
"@types/chai": "^5.2.3",
25-
"chai": "^6.2.2",
2624
"eslint-plugin-sf-plugin": "^1.20.13",
2725
"esmock": "^2.7.6",
2826
"oclif": "^4",
@@ -85,7 +83,18 @@
8583
"description": "Commands for managing DevOps Center projects."
8684
},
8785
"work-item": {
88-
"description": "Commands for managing DevOps Center work items."
86+
"description": "Commands for managing DevOps Center work items.",
87+
"subtopics": {
88+
"status": {
89+
"description": "Commands for managing DevOps Center work item statuses."
90+
}
91+
}
92+
},
93+
"pull-request": {
94+
"description": "Commands for managing DevOps Center pull requests."
95+
},
96+
"pipeline": {
97+
"description": "Commands for managing DevOps Center pipelines."
8998
}
9099
}
91100
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/AttachProjectResult",
4+
"definitions": {
5+
"AttachProjectResult": {
6+
"type": "object",
7+
"properties": {
8+
"success": {
9+
"type": "boolean"
10+
},
11+
"projectId": {
12+
"type": "string"
13+
},
14+
"pipelineId": {
15+
"type": "string"
16+
},
17+
"error": {
18+
"type": "string"
19+
}
20+
},
21+
"required": ["success", "projectId", "pipelineId"],
22+
"additionalProperties": false
23+
}
24+
}
25+
}

schemas/devops-project-create.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/CreateProjectResult",
4+
"definitions": {
5+
"CreateProjectResult": {
6+
"type": "object",
7+
"properties": {
8+
"success": {
9+
"type": "boolean"
10+
},
11+
"projectId": {
12+
"type": "string"
13+
},
14+
"name": {
15+
"type": "string"
16+
},
17+
"description": {
18+
"type": "string"
19+
},
20+
"error": {
21+
"type": "string"
22+
}
23+
},
24+
"required": ["success"],
25+
"additionalProperties": false
26+
}
27+
}
28+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/CreatePullRequestResult",
4+
"definitions": {
5+
"CreatePullRequestResult": {
6+
"type": "object",
7+
"properties": {
8+
"success": {
9+
"type": "boolean"
10+
},
11+
"workItemName": {
12+
"type": "string"
13+
},
14+
"title": {
15+
"type": "string"
16+
},
17+
"url": {
18+
"type": "string"
19+
},
20+
"sourceBranch": {
21+
"type": "string"
22+
},
23+
"targetBranch": {
24+
"type": "string"
25+
},
26+
"error": {
27+
"type": "string"
28+
}
29+
},
30+
"required": ["success"],
31+
"additionalProperties": false
32+
}
33+
}
34+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/UpdateWorkItemStatusResult",
4+
"definitions": {
5+
"UpdateWorkItemStatusResult": {
6+
"type": "object",
7+
"properties": {
8+
"success": {
9+
"type": "boolean"
10+
},
11+
"workItemId": {
12+
"type": "string"
13+
},
14+
"workItemName": {
15+
"type": "string"
16+
},
17+
"status": {
18+
"type": "string"
19+
},
20+
"error": {
21+
"type": "string"
22+
}
23+
},
24+
"required": ["success", "workItemId"],
25+
"additionalProperties": false
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)