@@ -290,10 +290,22 @@ def get_pipeline_from_code(pipeline_code: str) -> dict[str, typing.Any]:
290290 return data ["pipelineByCode" ]
291291
292292
293- def create_pipeline (pipeline_name : str , functional_type : str = None ):
293+ def create_pipeline (pipeline_name : str , functional_type : str = None , tags : list [ str ] = None ):
294294 """Create a pipeline using the API."""
295295 if settings .current_workspace is None :
296296 raise NoActiveWorkspaceError
297+
298+ input_data = {
299+ "workspaceSlug" : settings .current_workspace ,
300+ "name" : pipeline_name ,
301+ }
302+
303+ if functional_type is not None :
304+ input_data ["functionalType" ] = functional_type
305+
306+ if tags :
307+ input_data ["tags" ] = tags
308+
297309 data = graphql (
298310 """
299311 mutation createPipeline($input: CreatePipelineInput!) {
@@ -308,13 +320,7 @@ def create_pipeline(pipeline_name: str, functional_type: str = None):
308320 }
309321 }
310322 """ ,
311- {
312- "input" : {
313- "workspaceSlug" : settings .current_workspace ,
314- "name" : pipeline_name ,
315- "functionalType" : functional_type ,
316- }
317- },
323+ {"input" : input_data },
318324 )
319325
320326 if not data ["createPipeline" ]["success" ]:
@@ -625,6 +631,24 @@ def upload_pipeline(
625631 zip_file .seek (0 )
626632
627633 base64_content = base64 .b64encode (zip_file .read ()).decode ("ascii" )
634+
635+ input_data = {
636+ "workspaceSlug" : settings .current_workspace ,
637+ "code" : target_pipeline_code ,
638+ "name" : name ,
639+ "description" : description ,
640+ "externalLink" : link ,
641+ "zipfile" : base64_content ,
642+ "parameters" : [p .to_dict () for p in pipeline .parameters ],
643+ "timeout" : pipeline .timeout ,
644+ }
645+
646+ if functional_type or pipeline .functional_type :
647+ input_data ["functionalType" ] = functional_type or pipeline .functional_type
648+
649+ if tags :
650+ input_data ["tags" ] = tags
651+
628652 data = graphql (
629653 """
630654 mutation uploadPipeline($input: UploadPipelineInput!) {
@@ -651,20 +675,7 @@ def upload_pipeline(
651675 }
652676 }
653677 """ ,
654- {
655- "input" : {
656- "workspaceSlug" : settings .current_workspace ,
657- "code" : target_pipeline_code ,
658- "name" : name ,
659- "description" : description ,
660- "externalLink" : link ,
661- "zipfile" : base64_content ,
662- "parameters" : [p .to_dict () for p in pipeline .parameters ],
663- "timeout" : pipeline .timeout ,
664- "functionalType" : functional_type or pipeline .functional_type ,
665- "tags" : tags ,
666- }
667- },
678+ {"input" : input_data },
668679 )
669680
670681 if not data ["uploadPipeline" ]["success" ]:
0 commit comments