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

[MM-56074] mmctl job commands #26855

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

[MM-56074] mmctl job commands #26855

wants to merge 18 commits into from

Conversation

BenCookie95
Copy link
Contributor

Summary

Added 2 new commands to mmctl:

  • mmctl job list
  • mmctl job update [job] [status]

Added 2 new query parameters to GET /api/v4/jobs, job_type and status.

Added a new endpoint PATCH /api/v4/jobs/{job_id}/status which can be used to update the status of a job. The body takes 2 fields, status and force. Status is the new status you want to set and force is whether you want to bypass the status restriction that are in place. We added the force field so that admins can make an informed decision before updating a status. The status rules we have in place are:

  • JobStatusInProgress -> JobStatusPending
  • JobStatusInProgress | JobStatusPending -> JobStatusCancelRequested
  • JobStatusCancelRequested -> JobStatusCanceled

We felt that the existing permissions in place for some of the jobs weren't explicit enough so we added the following new permissions to manage the status of a job:

  • PermissionManagePostBleveIndexesJob
  • PermissionManageDataRetentionJob
  • PermissionManageComplianceExportJob
  • PermissionManageElasticsearchPostIndexingJob
  • PermissionManageElasticsearchPostAggregationJob
  • PermissionManageLdapSyncJob

Ticket Link

https://mattermost.atlassian.net/browse/MM-56074

Screenshots

Release Note

Added 2 new commands to mmctl, mmctl job list and mmctl job update. 
Added 2 new query parameters to GET /api/v4/jobs, job_type and status.
Added a new endpoint PATCH /api/v4/jobs/{job_id}/status.
Added 6 new permissions to manage the status of particular jobs:
- PermissionManagePostBleveIndexesJob
- PermissionManageDataRetentionJob
- PermissionManageComplianceExportJob
- PermissionManageElasticsearchPostIndexingJob
- PermissionManageElasticsearchPostAggregationJob
- PermissionManageLdapSyncJob

@mm-cloud-bot mm-cloud-bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Apr 23, 2024
@BenCookie95 BenCookie95 added the 2: Dev Review Requires review by a developer label Apr 24, 2024
@BenCookie95 BenCookie95 changed the title WIP: [MM-56074] mmctl job commands [MM-56074] mmctl job commands Apr 25, 2024
Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

Awesome, loving the flexibility we are giving customers with these changes!

server/channels/api4/job.go Outdated Show resolved Hide resolved
server/channels/api4/job.go Show resolved Hide resolved
server/channels/api4/job.go Outdated Show resolved Hide resolved
server/channels/api4/job.go Outdated Show resolved Hide resolved
server/channels/api4/job.go Show resolved Hide resolved
server/cmd/mmctl/commands/job.go Show resolved Hide resolved
server/cmd/mmctl/commands/job.go Outdated Show resolved Hide resolved
server/cmd/mmctl/commands/job.go Outdated Show resolved Hide resolved
server/public/model/client4.go Outdated Show resolved Hide resolved
server/channels/app/permissions_migrations.go Outdated Show resolved Hide resolved
@BenCookie95 BenCookie95 requested a review from hanzei May 1, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a developer release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants