Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add mdapi:deploy:cancel command, refactor base classes to support MDAPI and SOURCE stash keys #301

Merged
merged 3 commits into from
Nov 16, 2021

Conversation

WillieRuemmele
Copy link
Contributor

@WillieRuemmele WillieRuemmele commented Nov 15, 2021

What does this PR do?

moves mdapi:deploy:cancel command and messages
extends plugin-source base classes correctly
updates base classes to support MDAPI_DEPLOY stash key
adds UTs
adds NUTs

source:deploy:cancel,source:deploy:report, mdapi:deploy:cancel all validate the passed in deploy ID parameter
fixes issue when stash is missing a requested key/value

What issues does this PR fix or reference?

@W-9603715@

@WillieRuemmele WillieRuemmele requested review from shetzel, mshanemc and a team November 15, 2021 22:32
Copy link
Contributor

@mshanemc mshanemc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved with non-blocking suggestions/questions

src/commands/force/mdapi/deploy/cancel.ts Outdated Show resolved Hide resolved
protected deployResult: DeployResult;
/**
* Request a report of an in-progess or completed deployment.
* Request a report of an in-progress or completed deployment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

src/deployCommand.ts Outdated Show resolved Hide resolved
@@ -20,7 +20,7 @@ export type ProgressBar = {
};

export abstract class SourceCommand extends SfdxCommand {
public static readonly DEFAULT_SRC_WAIT_MINUTES = 33;
public static readonly DEFAULT_WAIT_MINUTES = 33;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the idea that the mdapi:deploy command will just have it's own flag that's set to zero (that is, just not using the default)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm good point. for mdapi:deploy:cancel in toolbelt it was using the source:deploy default, it seemed weird to have this variable mention SRC when it's now used in both source and mdapi

very open to reverting this back

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good since 33 seems to be most everywhere. Just making sure we weren't gonna come back and put a DEFAULT_MDAPI_WAIT_MINUTES or whatever.

describe('mdapi:deploy:cancel', () => {
it('will cancel an mdapi deploy via the stash.json', () => {
execCmd('force:source:convert --outputdir mdapi');
// TODO: once mdapi:deploy is migrated switch to execCmd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for the TODO

test/nuts/mdapi.nut.ts Outdated Show resolved Hide resolved
src/commands/force/mdapi/deploy/cancel.ts Show resolved Hide resolved
test/nuts/mdapi.nut.ts Outdated Show resolved Hide resolved
@mshanemc
Copy link
Contributor

QA notes:

👎🏻 run --help
There's some odd indentation stuff happening. Compare ./bin/run force:mdapi:deploy:cancel --help to ./bin/run force:source:deploy:cancel --help to see the difference

✅ run without a username (good error)
❌ run without a jobid on an org with no stash yields

ERROR running force:mdapi:deploy:cancel:  Cannot read property 'jobid' of undefined

vs toolbelt

ERROR running force:mdapi:deploy:cancel:  A required parameter [jobid] is missing.

👎🏻 ask to cancel a jobId that doesn't exist. Toolbelt is similarly bad.

ERROR running force:mdapi:deploy:cancel:  INVALID_CROSS_REFERENCE_KEY: invalid cross reference id

✅ cancel a job that already succeeded fails with ERROR running force:mdapi:deploy:cancel: The cancel command failed due to: INVALID_ID_FIELD: Deployment already completed

👎🏻 cancel a jobid that is a CustomObject's id fails with ERROR running force:mdapi:deploy:cancel: The cancel command failed due to: UNKNOWN_EXCEPTION: unexpected metadata [yet we know what the prefix has to be 0Af and could validate the ID is of the correct type before even making an API call)

👎🏻 cancel a job, then cancel it again fails with ERROR running force:mdapi:deploy:cancel: INVALID_ID_FIELD: Deployment already completed (kinda true, I guess?)

  • 👎🏻 json output of toolbelt had a nicer named error
     "name": "CancelFailed",
     "message": "The cancel command failed due to: INVALID_ID_FIELD: Deployment already completed",

that's changed to

      "name": "sf:INVALID_ID_FIELD",
      "message": "INVALID_ID_FIELD: Deployment already completed",     

✅ delete stash.json and then run without an id fails with ERROR running force:mdapi:deploy:cancel: No deploy ID was provided or found in deploy history
✅ json output of successful cancel matches between toolbelt and plugin

@mshanemc mshanemc merged commit 9dcc3e7 into main Nov 16, 2021
@mshanemc mshanemc deleted the wr/mdapiDeployCancel branch November 16, 2021 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants