Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ node_modules
# os specific files
.DS_Store
.idea

test.sh
12 changes: 11 additions & 1 deletion command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@
"command": "create",
"flagAliases": ["configurationitem", "dryrun", "targetusername", "templateid", "u"],
"flagChars": ["c", "i", "l", "o", "r"],
"flags": ["configuration-item", "dry-run", "flags-dir", "json", "location", "release", "target-org", "template-id"],
"flags": [
"configuration-item",
"dry-run",
"flags-dir",
"json",
"location",
"release",
"target-org",
"template-id",
"test-environment"
],
"plugin": "@salesforce/change-case-management"
}
]
4 changes: 4 additions & 0 deletions messages/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ change case template id
# flags.configuration-item.summary

Full path from the configuration item, ex: Salesforce.SF_Off_Core.DeveloperTools.NPM

# flags.test-environment.summary

Url to the test results for this change case. Will be added to the Change Case under "Automated Test Environment" (Test_Environment__c)
5 changes: 5 additions & 0 deletions src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ export default class Create extends SfCommand<CreateResponse> {
}),
release: releaseFlag,
location: locationFlag,
'test-environment': Flags.string({
summary: messages.getMessage('flags.test-environment.summary'),
required: false,
}),
'configuration-item': Flags.string({
summary: messages.getMessage('flags.configuration-item.summary'),
required: true,
Expand Down Expand Up @@ -185,6 +189,7 @@ export default class Create extends SfCommand<CreateResponse> {
record.RecordTypeId = CHANGE_RECORD_TYPE_ID;
record.SM_Source_Control_Location__c =
this.flags.location?.toString() ?? (template.SM_Source_Control_Location__c as string);
record.Test_Environment__c = this.flags['test-environment'] ?? (template.Test_Environment__c as string);
record.SM_Release__c = await retrieveOrCreateReleaseId(
conn,
new Ux({ jsonEnabled: this.jsonEnabled() }),
Expand Down
3 changes: 2 additions & 1 deletion test/ctc.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('e2e', () => {
let createResult: CreateResponse;
it('create', () => {
const result = execCmd<CreateResponse>(
`create --target-org ${session.hubOrg.username} --location ${repoUrl} --release ctc-nut --json`,
`create --target-org ${session.hubOrg.username} --location ${repoUrl} --test-environment ${repoUrl}/releases/tag/1.2.3 --release ctc-nut --json`,
{ ensureExitCode: 0 }
).jsonOutput?.result;
assert(result);
Expand All @@ -106,6 +106,7 @@ describe('e2e', () => {
createResult = result!;
expect(result?.id !== 'NOT PRESENT BECAUSE DRY RUN');
expect(result?.record.change.SM_Source_Control_Location__c).to.equal(repoUrl);
expect(result?.record.change.Test_Environment__c).to.equal(`${repoUrl}/releases/tag/1.2.3`);
});
describe('close', () => {
it('dryrun close by location/release (verifies works with only env)', () => {
Expand Down