Skip to content
Merged
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 src/azure-cli/azure/cli/command_modules/resource/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3775,6 +3775,8 @@ def format_bicep_file(cmd, file, stdout=None, outdir=None, outfile=None, newline


def publish_bicep_file(cmd, file, target, documentationUri=None):
ensure_bicep_installation(cmd.cli_ctx)

minimum_supported_version = "0.4.1008"
if bicep_version_greater_than_or_equal_to(minimum_supported_version):
args = ["publish", file, "--target", target]
Expand All @@ -3790,6 +3792,8 @@ def publish_bicep_file(cmd, file, target, documentationUri=None):


def restore_bicep_file(cmd, file, force=None):
ensure_bicep_installation(cmd.cli_ctx)

minimum_supported_version = "0.4.1008"
if bicep_version_greater_than_or_equal_to(minimum_supported_version):
args = ["restore", file]
Expand All @@ -3816,6 +3820,8 @@ def list_bicep_cli_versions(cmd):


def generate_params_file(cmd, file, no_restore=None, outdir=None, outfile=None, stdout=None):
ensure_bicep_installation(cmd.cli_ctx)

minimum_supported_version = "0.7.4"
if bicep_version_greater_than_or_equal_to(minimum_supported_version):
args = ["generate-params", file]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4016,7 +4016,15 @@ def test_bicep_list_versions(self):

# Because don't want to record bicep cli binary
class BicepBuildTest(LiveScenarioTest):


def setup(self):
super().setup()
self.cmd('az bicep uninstall')

def tearDown(self):
super().tearDown()
self.cmd('az bicep uninstall')

def test_bicep_build_decompile(self):
curr_dir = os.path.dirname(os.path.realpath(__file__))
tf = os.path.join(curr_dir, 'storage_account_deploy.bicep').replace('\\', '\\\\')
Expand All @@ -4039,6 +4047,14 @@ def test_bicep_build_decompile(self):

class BicepGenerateParamsTest(LiveScenarioTest):

def setup(self):
super().setup()
self.cmd('az bicep uninstall')

def tearDown(self):
super().tearDown()
self.cmd('az bicep uninstall')

def test_bicep_generate_params(self):
curr_dir = os.path.dirname(os.path.realpath(__file__))
tf = os.path.join(curr_dir, 'sample_params.bicep').replace('\\', '\\\\')
Expand Down Expand Up @@ -4085,6 +4101,15 @@ def test_install_and_upgrade(self):


class BicepRestoreTest(LiveScenarioTest):

def setup(self):
super().setup()
self.cmd('az bicep uninstall')

def tearDown(self):
super().tearDown()
self.cmd('az bicep uninstall')

def test_restore(self):
curr_dir = os.path.dirname(os.path.realpath(__file__))
bf = os.path.join(curr_dir, 'data', 'external_modules.bicep').replace('\\', '\\\\')
Expand All @@ -4103,6 +4128,15 @@ def test_restore(self):


class BicepFormatTest(LiveScenarioTest):

def setup(self):
super().setup()
self.cmd('az bicep uninstall')

def tearDown(self):
super().tearDown()
self.cmd('az bicep uninstall')

def test_format(self):
curr_dir = os.path.dirname(os.path.realpath(__file__))
bf = os.path.join(curr_dir, 'storage_account_deploy.bicep').replace('\\', '\\\\')
Expand All @@ -4119,6 +4153,7 @@ def test_format(self):


class DeploymentWithBicepScenarioTest(LiveScenarioTest):

def setup(self):
super.setup()
self.cmd('az bicep uninstall')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,3 @@ def test_validate_target_scope_success_if_target_scope_matches_deployment_scope(
def _remove_bicep_version_check_file(self):
with contextlib.suppress(FileNotFoundError):
os.remove(_bicep_version_check_file_path)