Skip to content

Commit 49cdb42

Browse files
fix cli upload pipeline version (#7722)
1 parent 2570922 commit 49cdb42

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

sdk/python/kfp/cli/pipeline.py

+20-10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import json
16+
from optparse import Option
1617
from typing import Any, Dict, List, Optional, Union
1718

1819
import click
@@ -65,6 +66,14 @@ def create(ctx: click.Context,
6566

6667

6768
@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+
)
6877
@click.option(
6978
'-p',
7079
'--pipeline-id',
@@ -79,19 +88,17 @@ def create(ctx: click.Context,
7988
'pipeline_name') + ' ' + either_option_required
8089
)
8190
@click.option(
82-
'-v',
83-
'--pipeline-version',
91+
'-d',
92+
'--description',
8493
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'))
8995
@click.pass_context
9096
def create_version(ctx: click.Context,
9197
package_file: str,
9298
pipeline_version: str,
9399
pipeline_id: Optional[str] = None,
94-
pipeline_name: Optional[str] = None):
100+
pipeline_name: Optional[str] = None,
101+
description: Optional[str] = None):
95102
"""Upload a version of a pipeline."""
96103
client = ctx.obj['client']
97104
output_format = ctx.obj['output']
@@ -102,9 +109,12 @@ def create_version(ctx: click.Context,
102109
if pipeline_id is None:
103110
raise ValueError(
104111
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)
108118
_display_pipeline_version(version, output_format)
109119
click.echo(f'Created pipeline version {version.id}.')
110120

0 commit comments

Comments
 (0)