Skip to content

Commit

Permalink
improvement(sct.py): add support to list azure images
Browse files Browse the repository at this point in the history
we now sync Azure images to multiple regions,
so now we added support to running Azure tests in multiple
regions.
  • Loading branch information
Fabio Gelcer authored and soyacz committed Mar 13, 2023
1 parent 1b7bae5 commit aee12e8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
29 changes: 27 additions & 2 deletions sct.py
Expand Up @@ -100,6 +100,7 @@
from sdcm.utils.context_managers import environment
from sdcm.cluster_k8s import mini_k8s
from sdcm.utils.es_index import create_index, get_mapping
import sdcm.provision.azure.utils as azure_utils
from utils.build_system.create_test_release_jobs import JenkinsPipelines # pylint: disable=no-name-in-module,import-error
from utils.get_supported_scylla_base_versions import UpgradeBaseVersion # pylint: disable=no-name-in-module,import-error
from utils.mocks.aws_mock import AwsMock # pylint: disable=no-name-in-module,import-error
Expand Down Expand Up @@ -604,7 +605,19 @@ def list_images(cloud_provider: str, branch: str, version: str, region: str, arc
title="GCE Machine Images by version")
)
case "azure":
click.echo("Azure image listing not implemented yet.")
if arch:
click.echo("WARNING:--arch option not implemented currently for Azure machine images.")
azure_images = azure_utils.get_scylla_images(scylla_version=version, region_name=region)
rows = []
for image in azure_images:
rows.append(['Azure', image.name, image.id, 'N/A'])
click.echo(
create_pretty_table(rows=rows, field_names=version_fields).get_string(
title="Azure Machine Images by version")
)

case _:
click.echo(f"Cloud provider {cloud_provider} is not supported")

elif branch:
if ":" not in branch:
Expand All @@ -627,7 +640,19 @@ def list_images(cloud_provider: str, branch: str, version: str, region: str, arc
)
)
case "azure":
click.echo("Azure image listing not implemented yet.")
if arch:
click.echo("WARNING:--arch option not implemented currently for Azure machine images.")
azure_images = azure_utils.get_scylla_images(scylla_version=branch, region_name=region)
rows = []
for image in azure_images:
rows.append(['Azure', image.name, image.id, 'N/A'])
click.echo(
create_pretty_table(rows=rows, field_names=version_fields).get_string(
title="Azure Machine Images by version")
)

case _:
click.echo(f"Cloud provider {cloud_provider} is not supported")


@cli.command('list-repos', help='List repos url of Scylla formal versions')
Expand Down
2 changes: 1 addition & 1 deletion sdcm/provision/azure/utils.py
Expand Up @@ -70,7 +70,7 @@ def get_scylla_images( # pylint: disable=too-many-branches,too-many-locals
image.tags["scylla_version"] = image.tags.get('scylla_version', image.tags.get('ScyllaVersion'))
# Filter by tags
for tag_name, expected_value in tags_to_search.items():
actual_value = image.tags.get(tag_name)
actual_value = image.tags.get(tag_name).replace('~', '-')
if callable(expected_value):
if not expected_value(actual_value):
break
Expand Down
2 changes: 1 addition & 1 deletion sdcm/utils/version_utils.py
Expand Up @@ -69,7 +69,7 @@
)

SCYLLA_VERSION_RE = re.compile(r"\d+(\.\d+)?\.[\d\w]+([.~][\d\w]+)?")
SCYLLA_VERSION_GROUPED_RE = re.compile(r'(?P<version>[\w.~]+)-0?\.?(?P<date>[\d]+)\.(?P<commit_id>\w+)')
SCYLLA_VERSION_GROUPED_RE = re.compile(r'(?P<version>[\w.~]+)-(?P<build>0|rc\d)?\.?(?P<date>[\d]+)\.(?P<commit_id>\w+)')
SSTABLE_FORMAT_VERSION_REGEX = re.compile(r'Feature (.*)_SSTABLE_FORMAT is enabled')
PRIMARY_XML_GZ_REGEX = re.compile(r'="(.*?primary.xml.gz)"')

Expand Down

0 comments on commit aee12e8

Please sign in to comment.