diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a590e18..143c6955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## lifebit-ai/cloudos-cli: changelog +## v2.81.2 (2026-03-04) + +### Patch + +- Adds `--image-version` option for `procurement set` subcommand + ## v2.81.1 (2026-02-24) ### Patch diff --git a/cloudos_cli/_version.py b/cloudos_cli/_version.py index 4111b533..004a37c7 100644 --- a/cloudos_cli/_version.py +++ b/cloudos_cli/_version.py @@ -1 +1 @@ -__version__ = '2.81.1' +__version__ = '2.81.2' diff --git a/cloudos_cli/procurement/cli.py b/cloudos_cli/procurement/cli.py index a563ce57..f6635632 100644 --- a/cloudos_cli/procurement/cli.py +++ b/cloudos_cli/procurement/cli.py @@ -95,6 +95,7 @@ def list_images(ctx, @click.option('--region', help='The cloud region. Only aws regions are supported.', required=True) @click.option('--image-id', help='The new image id value.', required=True) @click.option('--image-name', help='The new image name value.', required=False) +@click.option('--image-version', help='The new image version value.', required=True) @click.option('--disable-ssl-verification', help=('Disable SSL certificate verification. Please, remember that this option is ' + 'not generally recommended for security reasons.'), @@ -110,6 +111,7 @@ def set_organisation_image(ctx, procurement_id, organisation_id, image_type, + image_version, provider, region, image_id, @@ -117,7 +119,7 @@ def set_organisation_image(ctx, disable_ssl_verification, ssl_cert, profile): - """Set a new image id or name to image associated with an organisations of a given procurement.""" + """Set a new image id, name, or version to image associated with an organisations of a given procurement.""" verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert) procurement_images = Images( @@ -135,7 +137,8 @@ def set_organisation_image(ctx, provider, region, image_id, - image_name + image_name, + image_version ) console = Console() console.print(result) diff --git a/cloudos_cli/procurement/images.py b/cloudos_cli/procurement/images.py index fe4334d4..40dedc4b 100644 --- a/cloudos_cli/procurement/images.py +++ b/cloudos_cli/procurement/images.py @@ -74,7 +74,7 @@ def list_procurement_images(self): return response - def set_procurement_organisation_image(self, organisation_id, image_type, provider, region, image_id, image_name): + def set_procurement_organisation_image(self, organisation_id, image_type, provider, region, image_id, image_name, image_version): """ Sets the value for a procurement image of a given organisation. @@ -104,6 +104,8 @@ def set_procurement_organisation_image(self, organisation_id, image_type, provid The new value for image Id. Required. imageName The new value for image name. Optional. + imageVersion + The new value for image version. Required. """ headers = { @@ -116,7 +118,8 @@ def set_procurement_organisation_image(self, organisation_id, image_type, provid "imageName": image_name, "provider": provider, "region": region, - "imageId": image_id + "imageId": image_id, + "imageVersion": image_version } r = retry_requests_put("{}/api/v1/procurements/{}/images".format(self.cloudos_url, self.procurement_id), headers=headers, data=json.dumps(payload), verify=self.verify) diff --git a/tests/test_procurement/test_set_procurement_organisation_image.py b/tests/test_procurement/test_set_procurement_organisation_image.py index 7bd78002..4d3af092 100644 --- a/tests/test_procurement/test_set_procurement_organisation_image.py +++ b/tests/test_procurement/test_set_procurement_organisation_image.py @@ -28,7 +28,8 @@ def test_set_procurement_organisation_image(): "provider": "aws", "region": "eu-west-2", "imageId": "ami-0123456789abcdef0", - "imageName": "Custom-Job-Image" + "imageName": "Custom-Job-Image", + "imageVersion": "1.0.0" } # Mock endpoint @@ -54,7 +55,8 @@ def test_set_procurement_organisation_image(): provider="aws", region="eu-west-2", image_id="ami-0123456789abcdef0", - image_name="Custom-Job-Image" + image_name="Custom-Job-Image", + image_version="1.0.0" ) # Verify the image configuration details @@ -108,7 +110,8 @@ def test_set_procurement_organisation_image_different_types(): "provider": "aws", "region": "eu-west-2", "imageId": f"ami-{image_type.lower()[:8]}123", - "imageName": f"Custom-{image_type}-Image" + "imageName": f"Custom-{image_type}-Image", + "imageVersion": "1.0.0" } responses.add( @@ -135,7 +138,8 @@ def test_set_procurement_organisation_image_different_types(): provider="aws", region="eu-west-2", image_id=f"ami-{image_type.lower()[:8]}123", - image_name=f"Custom-{image_type}-Image" + image_name=f"Custom-{image_type}-Image", + image_version="1.0.0" ) assert result["imageType"] == image_type @@ -165,7 +169,8 @@ def test_set_procurement_organisation_image_without_image_name(): "provider": "aws", "region": "eu-west-2", "imageId": "ami-0123456789abcdef0", - "imageName": None + "imageName": None, + "imageVersion": "1.0.0" } responses.add( @@ -190,7 +195,8 @@ def test_set_procurement_organisation_image_without_image_name(): provider="aws", region="eu-west-2", image_id="ami-0123456789abcdef0", - image_name=None + image_name=None, + image_version="1.0.0" ) assert result["imageName"] is None