Skip to content

Commit e45c0b3

Browse files
chore: release 09 05 2023 (#237)
* Fix for quick deployment (#232) * fix: add filter to query to fetch only Deployment Results with CBIs associated * fix: don't print operation status when the message is undefined * chore(release): 1.1.2-beta.0 * chore(release): 1.1.2-beta.1 --------- Co-authored-by: svc-cli-bot <svc_cli_bot@salesforce.com>
1 parent 1928760 commit e45c0b3

File tree

6 files changed

+39
-8
lines changed

6 files changed

+39
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/plugin-devops-center",
33
"description": "The DevOps Center CLI plugin provides a command-line alternative to performing equivalent actions in the DevOps Center graphical UI",
4-
"version": "1.1.2",
4+
"version": "1.1.2-beta.1",
55
"author": "Salesforce",
66
"bugs": "https://github.com/forcedotcom/cli/issues",
77
"dependencies": {

src/common/outputService/aorOutputService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ export abstract class AbstractAorOutputService<T extends AorOutputFlags>
7676
} else {
7777
console.log(red(aor.sf_devops__Message__c));
7878
}
79-
} else {
80-
// aor.sf_devops__Status__c == undefined || AsyncOperationStatus.InProgress
79+
} else if (aor.sf_devops__Message__c) {
8180
console.log(aor.sf_devops__Message__c);
8281
}
8382

src/common/selectors/deploymentResultsSelector.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ export async function selectOneDeploymentResultWithChangeBundleInstallsByAsyncJo
6262
asyncJobId: string
6363
): Promise<CheckDeploymentResultWithChangeBundleInstalls | null> {
6464
const queryStr = `SELECT sf_devops__Check_Deploy__c, sf_devops__Deployment_Id__c, sf_devops__Check_Deploy_Status__r.sf_devops__Status__c,
65-
(SELECT sf_devops__Environment__c FROM sf_devops__Change_Bundle_Installs__r)
65+
(SELECT sf_devops__Environment__c FROM sf_devops__Change_Bundle_Installs__r)
6666
FROM sf_devops__Deployment_Result__c
67-
WHERE sf_devops__Check_Deploy_Status__c = '${asyncJobId}' AND sf_devops__Check_Deploy__c = TRUE`;
67+
WHERE sf_devops__Check_Deploy_Status__c = '${asyncJobId}'
68+
AND sf_devops__Check_Deploy__c = TRUE
69+
AND Id IN (SELECT sf_devops__Deployment_Result__c FROM sf_devops__Change_Bundle_Install__c)`;
6870

6971
const resp: QueryResult<CheckDeploymentResultWithChangeBundleInstalls> = await runSafeQuery(con, queryStr, true);
7072
return resp.totalSize > 0 ? resp.records[0] : null;

test/commands/project/deploy/pipeline/quick.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,22 @@ describe('project deploy pipeline quick', () => {
368368
"We can't perform the quick deployment for the specified job ID because the validate-only deployment failed or is still running. If the validate-only deployment failed, fix the issue and re-run it. If the validate-only deployment was successful, try this command again later."
369369
);
370370
});
371+
372+
test
373+
.stdout()
374+
.stderr()
375+
.do(() => {
376+
queryStub = sinon.stub().returns(getQueryResultMock([]));
377+
requestMock = sinon.stub().resolves({ jobId: mockReturnedAorId });
378+
stubStreamer();
379+
})
380+
.command(['project deploy pipeline quick', `-i=${mockValidatedAorId}`])
381+
.catch(() => {})
382+
.it('display an error message when the deployment result does not have CBIs', (ctx) => {
383+
expect(ctx.stderr).to.contain(
384+
" The job ID is invalid for the quick deployment. Verify that a deployment validation was run or hasn't expired, and that you specified the correct job ID. Then try again."
385+
);
386+
});
371387
});
372388

373389
describe('stream aor status', () => {

test/common/outputService/aorOutputService.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describe('aorOutputService', () => {
4343
expect(ctx.stdout).to.contain(message);
4444
});
4545

46-
test.stdout().it('handles the print of an In Progress aor status', (ctx) => {
46+
test.stdout().it('handles the print of an In Progress aor status when the message is valid', (ctx) => {
4747
const status = AsyncOperationStatus.InProgress;
4848
const message = 'This should be printed';
4949
const aor: AsyncOperationResult = {
@@ -56,6 +56,18 @@ describe('aorOutputService', () => {
5656
expect(ctx.stdout).to.contain(message);
5757
});
5858

59+
test.stdout().it('handles the print of an In Progress aor status when the message is undefined', (ctx) => {
60+
const status = AsyncOperationStatus.InProgress;
61+
const aor: AsyncOperationResult = {
62+
Id: 'Id',
63+
sf_devops__Error_Details__c: undefined,
64+
sf_devops__Status__c: status,
65+
sf_devops__Message__c: undefined,
66+
};
67+
outputService.printAorStatus(aor);
68+
expect(ctx.stdout).to.not.contain(undefined);
69+
});
70+
5971
test.stdout().it('handles the print of a Completed aor status', (ctx) => {
6072
const message = 'Deploy complete.';
6173
const aor: AsyncOperationResult = {

test/common/selectors/deploymentResultsSelector.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ describe('DeploymentResult selector', () => {
158158
'SELECT sf_devops__Check_Deploy__c, sf_devops__Deployment_Id__c, sf_devops__Check_Deploy_Status__r.sf_devops__Status__c'
159159
);
160160
expect(builderArgs[0]).to.contain('(SELECT sf_devops__Environment__c FROM sf_devops__Change_Bundle_Installs__r)');
161-
// verify we used the correct filter
161+
// verify we used the correct filters
162+
expect(builderArgs[0]).to.contain(`WHERE sf_devops__Check_Deploy_Status__c = '${mockAorId}'`);
163+
expect(builderArgs[0]).to.contain('AND sf_devops__Check_Deploy__c = TRUE');
162164
expect(builderArgs[0]).to.contain(
163-
`WHERE sf_devops__Check_Deploy_Status__c = '${mockAorId}' AND sf_devops__Check_Deploy__c = TRUE`
165+
'AND Id IN (SELECT sf_devops__Deployment_Result__c FROM sf_devops__Change_Bundle_Install__c)'
164166
);
165167
});
166168

0 commit comments

Comments
 (0)