Implement an option to choose a job type on relaunch (issue #14177) (#15249)

Allows changing the job type (run, check) when relaunching
a job by adding a "job_type" to the relaunch POST payload
This commit is contained in:
Sasa Jovicic
2025-03-12 18:27:05 +01:00
committed by GitHub
parent 0f0f5aa289
commit 6f7d5ca8a3
3 changed files with 43 additions and 1 deletions

View File

@@ -3435,6 +3435,7 @@ class JobRelaunch(RetrieveAPIView):
copy_kwargs = {}
retry_hosts = serializer.validated_data.get('hosts', None)
job_type = serializer.validated_data.get('job_type', None)
if retry_hosts and retry_hosts != 'all':
if obj.status in ACTIVE_STATES:
return Response(
@@ -3455,6 +3456,8 @@ class JobRelaunch(RetrieveAPIView):
)
copy_kwargs['limit'] = ','.join(retry_host_list)
if job_type:
copy_kwargs['job_type'] = job_type
new_job = obj.copy_unified_job(**copy_kwargs)
result = new_job.signal_start(**serializer.validated_data['credential_passwords'])
if not result: