Skip to content

Commit 585b405

Browse files
authored
patch: add option --image-version for procurement set (#296)
* patch: add option --image-version * docs: update readme
1 parent f814480 commit 585b405

6 files changed

Lines changed: 32 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## lifebit-ai/cloudos-cli: changelog
22

3+
## v2.81.2 (2026-03-04)
4+
5+
### Patch
6+
7+
- Adds `--image-version` option for `procurement set` subcommand
8+
39
## v2.81.1 (2026-02-24)
410

511
### Patch

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,7 +2214,7 @@ You can set a custom image ID or name for an organization within a procurement u
22142214
To set a custom image for an organization, use the following command:
22152215

22162216
```bash
2217-
cloudos procurement images set --profile procurement_profile --image-type "JobDefault" --provider "aws" --region "us-east-1" --image-id "ami-0123456789abcdef0" --image-name "custom-image-name" --procurement-id "your_procurement_id_here" --organisation-id "your_organization_id"
2217+
cloudos procurement images set --profile procurement_profile --image-type "JobDefault" --provider "aws" --region "us-east-1" --image-id "ami-0123456789abcdef0" --image-name "custom-image-name" --image-version "1.0.0" --procurement-id "your_procurement_id_here" --organisation-id "your_organization_id"
22182218
```
22192219

22202220
**Set command options:**
@@ -2234,6 +2234,7 @@ cloudos procurement images set --profile procurement_profile --image-type "JobDe
22342234
- `--region`: The cloud region (required). Currently only AWS regions are supported
22352235
- `--image-id`: The new image ID value (required)
22362236
- `--image-name`: The new image name value (optional)
2237+
- `--image-version`: The new image version (required)
22372238
- `--disable-ssl-verification`: Disable SSL certificate verification
22382239
- `--ssl-cert`: Path to your SSL certificate file
22392240
- `--profile`: Profile to use from the config file
@@ -2242,7 +2243,7 @@ cloudos procurement images set --profile procurement_profile --image-type "JobDe
22422243

22432244
```bash
22442245
# Set custom image for job execution
2245-
cloudos procurement images set --profile procurement_profile --image-type "JobDefault" --provider "aws" --region "us-east-1" --image-id "ami-0123456789abcdef0" --image-name "my-custom-job-image" --procurement-id "your_procurement_id_here" --organisation-id "your_organization_id"
2246+
cloudos procurement images set --profile procurement_profile --image-type "JobDefault" --provider "aws" --region "us-east-1" --image-id "ami-0123456789abcdef0" --image-name "my-custom-job-image" --image-version "1.2.3" --procurement-id "your_procurement_id_here" --organisation-id "your_organization_id"
22462247
```
22472248

22482249
#### Reset Procurement Organization Image

cloudos_cli/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.81.1'
1+
__version__ = '2.81.2'

cloudos_cli/procurement/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def list_images(ctx,
9595
@click.option('--region', help='The cloud region. Only aws regions are supported.', required=True)
9696
@click.option('--image-id', help='The new image id value.', required=True)
9797
@click.option('--image-name', help='The new image name value.', required=False)
98+
@click.option('--image-version', help='The new image version value.', required=True)
9899
@click.option('--disable-ssl-verification',
99100
help=('Disable SSL certificate verification. Please, remember that this option is ' +
100101
'not generally recommended for security reasons.'),
@@ -110,14 +111,15 @@ def set_organisation_image(ctx,
110111
procurement_id,
111112
organisation_id,
112113
image_type,
114+
image_version,
113115
provider,
114116
region,
115117
image_id,
116118
image_name,
117119
disable_ssl_verification,
118120
ssl_cert,
119121
profile):
120-
"""Set a new image id or name to image associated with an organisations of a given procurement."""
122+
"""Set a new image id, name, or version to image associated with an organisations of a given procurement."""
121123
verify_ssl = ssl_selector(disable_ssl_verification, ssl_cert)
122124

123125
procurement_images = Images(
@@ -135,7 +137,8 @@ def set_organisation_image(ctx,
135137
provider,
136138
region,
137139
image_id,
138-
image_name
140+
image_name,
141+
image_version
139142
)
140143
console = Console()
141144
console.print(result)

cloudos_cli/procurement/images.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def list_procurement_images(self):
7474

7575
return response
7676

77-
def set_procurement_organisation_image(self, organisation_id, image_type, provider, region, image_id, image_name):
77+
def set_procurement_organisation_image(self, organisation_id, image_type, provider, region, image_id, image_name, image_version):
7878
"""
7979
Sets the value for a procurement image of a given organisation.
8080
@@ -104,6 +104,8 @@ def set_procurement_organisation_image(self, organisation_id, image_type, provid
104104
The new value for image Id. Required.
105105
imageName
106106
The new value for image name. Optional.
107+
imageVersion
108+
The new value for image version. Required.
107109
"""
108110

109111
headers = {
@@ -116,7 +118,8 @@ def set_procurement_organisation_image(self, organisation_id, image_type, provid
116118
"imageName": image_name,
117119
"provider": provider,
118120
"region": region,
119-
"imageId": image_id
121+
"imageId": image_id,
122+
"imageVersion": image_version
120123
}
121124
r = retry_requests_put("{}/api/v1/procurements/{}/images".format(self.cloudos_url, self.procurement_id),
122125
headers=headers, data=json.dumps(payload), verify=self.verify)

tests/test_procurement/test_set_procurement_organisation_image.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def test_set_procurement_organisation_image():
2828
"provider": "aws",
2929
"region": "eu-west-2",
3030
"imageId": "ami-0123456789abcdef0",
31-
"imageName": "Custom-Job-Image"
31+
"imageName": "Custom-Job-Image",
32+
"imageVersion": "1.0.0"
3233
}
3334

3435
# Mock endpoint
@@ -54,7 +55,8 @@ def test_set_procurement_organisation_image():
5455
provider="aws",
5556
region="eu-west-2",
5657
image_id="ami-0123456789abcdef0",
57-
image_name="Custom-Job-Image"
58+
image_name="Custom-Job-Image",
59+
image_version="1.0.0"
5860
)
5961

6062
# Verify the image configuration details
@@ -108,7 +110,8 @@ def test_set_procurement_organisation_image_different_types():
108110
"provider": "aws",
109111
"region": "eu-west-2",
110112
"imageId": f"ami-{image_type.lower()[:8]}123",
111-
"imageName": f"Custom-{image_type}-Image"
113+
"imageName": f"Custom-{image_type}-Image",
114+
"imageVersion": "1.0.0"
112115
}
113116

114117
responses.add(
@@ -135,7 +138,8 @@ def test_set_procurement_organisation_image_different_types():
135138
provider="aws",
136139
region="eu-west-2",
137140
image_id=f"ami-{image_type.lower()[:8]}123",
138-
image_name=f"Custom-{image_type}-Image"
141+
image_name=f"Custom-{image_type}-Image",
142+
image_version="1.0.0"
139143
)
140144

141145
assert result["imageType"] == image_type
@@ -165,7 +169,8 @@ def test_set_procurement_organisation_image_without_image_name():
165169
"provider": "aws",
166170
"region": "eu-west-2",
167171
"imageId": "ami-0123456789abcdef0",
168-
"imageName": None
172+
"imageName": None,
173+
"imageVersion": "1.0.0"
169174
}
170175

171176
responses.add(
@@ -190,7 +195,8 @@ def test_set_procurement_organisation_image_without_image_name():
190195
provider="aws",
191196
region="eu-west-2",
192197
image_id="ami-0123456789abcdef0",
193-
image_name=None
198+
image_name=None,
199+
image_version="1.0.0"
194200
)
195201

196202
assert result["imageName"] is None

0 commit comments

Comments
 (0)