Open elibogomolnyi opened 1 year ago
currently the UI adds this payload to the system job launch endpoint
{"extra_vars":{"days":30}}
so we'd need to change the api to accept a new param like "resources"
{"extra_vars":{"days": 30, "resources":["notifications", "jobs"]}}
something like that. Then we would change this line to only pass those resources
https://github.com/fosterseth/awx/blob/bb1c155bc91505f89d7074820424eac7d7072c4d/awx/main/tasks/jobs.py#L1880
currently the UI adds this payload to the system job launch endpoint
{"extra_vars":{"days":30}}
so we'd need to change the api to accept a new param like "resources"{"extra_vars":{"days": 30, "resources":["notifications", "jobs"]}}
something like that. Then we would change this line to only pass those resources https://github.com/fosterseth/awx/blob/bb1c155bc91505f89d7074820424eac7d7072c4d/awx/main/tasks/jobs.py#L1880
@fosterseth what about that function? https://github.com/ansible/awx/blob/1bb4240a6ba9b92043cb410585a95f3bf20d89bf/awx/main/management/commands/cleanup_jobs.py#L379
The awx-manage command already has the capabilities to delete specific resources, so we probably don't need changes in that file. The change needed here it so be able to specify these extra parameters in the API
Please confirm the following
Feature type
Enhancement to Existing Feature
Feature Summary
For now, in the management job Cleanup Job Schedule, we can only define the number of days for all job-related entities, including ad-hoc commands, project-updates, inventory-updates, management-jobs, notifications, and workflow jobs.
It would be very useful to make it configurable to define a different number of days for different entities.
For example, we need the job history for 90 days. Still, we don't need the notification history since we use notifications only for sending our logs to DataDog and don't use them anymore.
It can be done by using the awx-manage cli by command:
awx-manage cleanup_jobs --notifications --days 0
But we didn't find a way to do it from AWX UI by configuring the Management jobs, so we won't need to create an additional cronjob in K8s that will do it.
Select the relevant components
Steps to reproduce
Run cleanup for jobs that are older than 90 days.
Current results
All job-related entities were deleted.
Sugested feature result
Only particular job-related entities are deleted; the number of days is configurable for each type of job.
Additional information
No response