13
13
# limitations under the License.
14
14
15
15
import json
16
+ from optparse import Option
16
17
from typing import Any , Dict , List , Optional , Union
17
18
18
19
import click
@@ -65,6 +66,14 @@ def create(ctx: click.Context,
65
66
66
67
67
68
@pipeline .command ()
69
+ @click .argument ('package-file' , type = click .Path (exists = True , dir_okay = False ))
70
+ @click .option (
71
+ '-v' ,
72
+ '--pipeline-version' ,
73
+ help = parsing .get_param_descr (client .Client .upload_pipeline_version ,
74
+ 'pipeline_version_name' ),
75
+ required = True ,
76
+ )
68
77
@click .option (
69
78
'-p' ,
70
79
'--pipeline-id' ,
@@ -79,19 +88,17 @@ def create(ctx: click.Context,
79
88
'pipeline_name' ) + ' ' + either_option_required
80
89
)
81
90
@click .option (
82
- '-v ' ,
83
- '--pipeline-version ' ,
91
+ '-d ' ,
92
+ '--description ' ,
84
93
help = parsing .get_param_descr (client .Client .upload_pipeline_version ,
85
- 'pipeline_version_name' ),
86
- required = True ,
87
- )
88
- @click .argument ('package-file' , type = click .Path (exists = True , dir_okay = False ))
94
+ 'description' ))
89
95
@click .pass_context
90
96
def create_version (ctx : click .Context ,
91
97
package_file : str ,
92
98
pipeline_version : str ,
93
99
pipeline_id : Optional [str ] = None ,
94
- pipeline_name : Optional [str ] = None ):
100
+ pipeline_name : Optional [str ] = None ,
101
+ description : Optional [str ] = None ):
95
102
"""Upload a version of a pipeline."""
96
103
client = ctx .obj ['client' ]
97
104
output_format = ctx .obj ['output' ]
@@ -102,9 +109,12 @@ def create_version(ctx: click.Context,
102
109
if pipeline_id is None :
103
110
raise ValueError (
104
111
f"Can't find a pipeline with name: { pipeline_name } " )
105
- # TODO: this is broken
106
- version = client .pipeline_uploads .upload_pipeline_version (
107
- package_file , name = pipeline_version , pipelineid = pipeline_id )
112
+ version = client .upload_pipeline_version (
113
+ pipeline_package_path = package_file ,
114
+ pipeline_version_name = pipeline_version ,
115
+ pipeline_id = pipeline_id ,
116
+ pipeline_name = pipeline_name ,
117
+ description = description )
108
118
_display_pipeline_version (version , output_format )
109
119
click .echo (f'Created pipeline version { version .id } .' )
110
120
0 commit comments