mmctl icon indicating copy to clipboard operation
mmctl copied to clipboard

Add subcommand for canceling export jobs

Open gabor-boros opened this issue 1 year ago • 1 comments

Summary

At the moment, the mattermost client already knows how to cancel a job, but mmctl has no subcommands to expose this functionality and cancel an export job.

This PR adds a new subcommand mmctl export job cancel [export job id] to cancel an export job.

Ticket Link

This PR is not resolving any open issues in Jira or GitHub. If necessary, I can create a GitHub issue to be able to link the PR to that.

Testing instructions

  1. Create a new export job
  2. Get the export job's ID
  3. Execute mmctl export job cancel <ID>

First, the export job's state should be cancel_requested, then it should switch to canceled after some time.

Example

# Create and cancel the job
$ ./mmctl export create --attachments \
      | awk -F": " '{print $2}' \
      | xargs -n1 -I{} ./mmctl export job cancel "{}"

# Get job list again
$ ./mmctl export job list
  ID: 59uow53d53f6byk5a4hbwg6y4c
  Status: canceled
  Created: 2022-09-20 08:21:55 +0200 CEST

  ID: kw1kppccy7b7dnoqzdayh9q4jw
  Status: success
  Created: 2022-09-20 08:21:39 +0200 CEST
  Started: 2022-09-20 08:21:40 +0200 CEST
  Data: map[include_attachments:true]

Documentation

Although it was not completely necessary to update the mmctl export job show subcommand's example usage, I did it to have a more consistent documentation.

gabor-boros avatar Sep 19 '22 08:09 gabor-boros

Hello @gabor-boros,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

mattermod avatar Sep 19 '22 08:09 mattermod

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

mattermod avatar Oct 01 '22 01:10 mattermod

/update-branch

gabor-boros avatar Oct 01 '22 17:10 gabor-boros

@isacikgoz Thank you for your review! Your observations are addressed as part of 65daf40. Could you please do another round of review?

Also, could you please guide me on how I could help out at https://github.com/mattermost/mattermost-server/pull/21049 to get it merged? 😇

gabor-boros avatar Oct 11 '22 16:10 gabor-boros

/update-branch

gabor-boros avatar Oct 14 '22 20:10 gabor-boros

@gabor-boros can you update the docs with make docs command? The CI is failing due to that error.

isacikgoz avatar Oct 19 '22 09:10 isacikgoz

Ah, sure @isacikgoz. Give me a day or two. 😌

gabor-boros avatar Oct 19 '22 10:10 gabor-boros

FYI: @isacikgoz updated

gabor-boros avatar Oct 23 '22 15:10 gabor-boros