diff --git a/bkflow/apigw/serializers/task.py b/bkflow/apigw/serializers/task.py index 6201330..fd88c3d 100644 --- a/bkflow/apigw/serializers/task.py +++ b/bkflow/apigw/serializers/task.py @@ -85,6 +85,7 @@ class CreateTaskWithoutTemplateSerializer(serializers.Serializer): description = serializers.CharField(help_text=_("任务描述"), required=False) constants = serializers.JSONField(help_text=_("任务启动参数"), required=False, default={}) pipeline_tree = serializers.JSONField(help_text=_("任务树"), required=True) + notify_config = serializers.JSONField(help_text=_("通知配置"), required=False, default={}) class PipelineTreeSerializer(serializers.Serializer): diff --git a/bkflow/apigw/views/create_task_without_template.py b/bkflow/apigw/views/create_task_without_template.py index bc70792..bff72fe 100644 --- a/bkflow/apigw/views/create_task_without_template.py +++ b/bkflow/apigw/views/create_task_without_template.py @@ -46,7 +46,8 @@ def create_task_without_template(request, space_id): "notify_type": {"fail": [], "success": []}, "notify_receivers": {"more_receiver": "", "receiver_group": []}, } - create_task_data.setdefault("extra_info", {}).update({"notify_config": DEFAULT_NOTIFY_CONFIG}) + notify_config = create_task_data.pop("notify_config", {}) or DEFAULT_NOTIFY_CONFIG + create_task_data.setdefault("extra_info", {}).update({"notify_config": notify_config}) client = TaskComponentClient(space_id=space_id) result = client.create_task(create_task_data)