Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Add subcommand for canceling export jobs #557

Merged
merged 3 commits into from
Nov 1, 2022
Merged

Add subcommand for canceling export jobs #557

merged 3 commits into from
Nov 1, 2022

Conversation

gabor-boros
Copy link
Contributor

@gabor-boros gabor-boros commented Sep 19, 2022

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.

@mattermod
Copy link
Contributor

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.

Copy link

@keithgg keithgg left a comment

Choose a reason for hiding this comment

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

👍 LGTM @gabor-boros

  • I read through the code

docs/mmctl_export_job_cancel.rst Outdated Show resolved Hide resolved
@mattermod
Copy link
Contributor

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!

@gabor-boros
Copy link
Contributor Author

/update-branch

Copy link
Member

@isacikgoz isacikgoz left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @gabor-boros 🎉 Just a small change request, otherwise looks good.

commands/export_e2e_test.go Outdated Show resolved Hide resolved
@gabor-boros
Copy link
Contributor Author

@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 mattermost/mattermost#21049 to get it merged? 😇

@isacikgoz isacikgoz self-requested a review October 11, 2022 16:55
@gabor-boros
Copy link
Contributor Author

/update-branch

@isacikgoz
Copy link
Member

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

@isacikgoz isacikgoz added 2: Dev Review Requires review by a core committer and removed Lifecycle/1:stale labels Oct 19, 2022
@gabor-boros
Copy link
Contributor Author

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

Signed-off-by: Gabor Boros <gabor.brs@gmail.com>
Signed-off-by: Gabor Boros <gabor.brs@gmail.com>
Signed-off-by: Gabor Boros <gabor.brs@gmail.com>
@gabor-boros
Copy link
Contributor Author

FYI: @isacikgoz updated

Copy link
Member

@isacikgoz isacikgoz left a comment

Choose a reason for hiding this comment

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

Perfect, thanks for all the effort @gabor-boros 🚀

@isacikgoz isacikgoz merged commit 9187eae into mattermost:master Nov 1, 2022
@isacikgoz isacikgoz added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Nov 1, 2022
@gabor-boros gabor-boros deleted the gabor/add-export-job-cancel branch November 1, 2022 09:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants