Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/added-20260219-122814.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: added
body: ' Introduces a deploy command skeleton, allowing users to deploy items to a Fabric workspace using Fabric CI/CD lib'
time: 2026-02-19T12:28:14.367269851Z
custom:
Author: aviatco
AuthorLink: https://github.com/aviatco
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from argparse import Namespace

from fabric_cli.utils import fab_ui

def deploy_with_config_file(args: Namespace) -> None:
"""Deploy using config file and environment parameters - delegates to CICD library."""
# WILL BE REMOVED - SHOULD CALL DEPLOY_WITH_CONFIG
fab_ui.print_info(
"Deploying using config file and environment parameters..." + str(args))
9 changes: 9 additions & 0 deletions src/fabric_cli/commands/fs/fab_fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from fabric_cli.commands.fs import fab_fs_export as fs_export
from fabric_cli.commands.fs import fab_fs_get as fs_get
from fabric_cli.commands.fs import fab_fs_import as fs_import
from fabric_cli.commands.fs import fab_fs_deploy as fs_deploy
from fabric_cli.commands.fs import fab_fs_ln as fs_ln
from fabric_cli.commands.fs import fab_fs_ls as fs_ls
from fabric_cli.commands.fs import fab_fs_mkdir as fs_mkdir
Expand Down Expand Up @@ -144,6 +145,14 @@ def import_command(args: Namespace) -> None:
fs_import.exec_command(args, context)


@handle_exceptions()
@set_command_context()
def deploy_command(args: Namespace) -> None:
context = handle_context.get_command_context(args.path if hasattr(
args, 'path') and args.path else [], raise_error=False)
fs_deploy.exec_command(args, context)


@handle_exceptions()
@set_command_context()
def set_command(args: Namespace) -> None:
Expand Down
14 changes: 14 additions & 0 deletions src/fabric_cli/commands/fs/fab_fs_deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

from argparse import Namespace

from fabric_cli.commands.fs.deploy.fab_fs_deploy_config_file import deploy_with_config_file
from fabric_cli.core.hiearchy.fab_element import FabricElement
from fabric_cli.utils import fab_ui


def exec_command(args: Namespace, context: FabricElement) -> None:
"""Deploy using config file and environment parameters - CICD flow."""
if args.force or fab_ui.prompt_confirm():
deploy_with_config_file(args)
1 change: 1 addition & 0 deletions src/fabric_cli/core/fab_constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
COMMAND_FS_EXPORT_DESCRIPTION = "Export an item."
COMMAND_FS_GET_DESCRIPTION = "Get workspace or item properties."
COMMAND_FS_IMPORT_DESCRIPTION = "Import an item to create or update it."
COMMAND_FS_DEPLOY_DESCRIPTION = "Deploy items using configuration file and environment parameters."
COMMAND_FS_SET_DESCRIPTION = "Set workspace or item properties."
COMMAND_FS_CLEAR_DESCRIPTION = "Clear the terminal screen."
COMMAND_FS_LN_DESCRIPTION = "Create a shortcut."
Expand Down
1 change: 1 addition & 0 deletions src/fabric_cli/core/fab_parser_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def create_parser_and_subparsers():
fs_parser.register_open_parser(subparsers) # open
fs_parser.register_export_parser(subparsers) # export
fs_parser.register_import_parser(subparsers) # import
fs_parser.register_deploy_parser(subparsers) # deploy
fs_parser.register_set_parser(subparsers) # set
fs_parser.register_get_parser(subparsers) # get
fs_parser.register_clear_parser(subparsers) # clear
Expand Down
50 changes: 50 additions & 0 deletions src/fabric_cli/parsers/fab_fs_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,56 @@ def register_import_parser(subparsers: _SubParsersAction) -> None:
import_parser.usage = f"{utils_error_parser.get_usage_prog(import_parser)}"
import_parser.set_defaults(func=fs.import_command)

# Command for 'deploy'


def register_deploy_parser(subparsers: _SubParsersAction) -> None:
deploy_examples = [
"# deploy using config file and environment",
"$ deploy --config-file config.yml --env dev\n",
"# deploy with config file, environment, and optional parameters",
"$ deploy --config-file config.yml --env prod -P '[{\"param1\":\"value1\"}]' -f",
]

deploy_parser = subparsers.add_parser(
"deploy",
help=fab_constant.COMMAND_FS_DEPLOY_DESCRIPTION,
fab_examples=deploy_examples,
fab_learnmore=["_"],
)

deploy_parser.add_argument(
"-dcf",
"--deploy_config_file",
metavar="PATH",
type=str,
required=True,
help="Path to local deployment config file.",
)

deploy_parser.add_argument(
"-tenv",
"--target_env",
metavar="ENV_NAME",
type=str,
required=True,
help="Environment name as defined in deployment config file.",
)

deploy_parser.add_argument(
"-P",
"--params",
metavar="JSON",
type=str,
help="parameters for deployment in JSON format (e.g., '[{\"p1\":\"v1\",\"p2\":\"v2\"}]'). Optional",
)

deploy_parser.add_argument(
"-f", "--force", required=False, action="store_true", help="Force. Optional"
)

deploy_parser.set_defaults(func=fs.deploy_command)
deploy_parser.usage = f"{utils_error_parser.get_usage_prog(deploy_parser)}"

# Command for 'set'
def register_set_parser(subparsers: _SubParsersAction) -> None:
Expand Down
Loading