Skip to content

Commit

Permalink
CommunityWorkflow: Add billing type as custom tags
Browse files Browse the repository at this point in the history
This commit changes the community workflow to add the tag `billing_type`
into the AMI being uploaded in order to prevent `cloudimg` to seek for
the image type `access` and get a resulting `hourly` or vice-versa.

Refers to SPSTRAT-451
  • Loading branch information
JAVGan committed Nov 6, 2024
1 parent 68fc64a commit ad25c51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/pubtools/_marketplacesvm/tasks/community_push/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,10 @@ def _data_to_upload(
if content:
additional_args[arg] = content

# Add the billing type on tags if it's set
if pi.type:
additional_args["custom_tags"] = {"billing_type": pi.type}

# Generate the push items to upload
params = {
"marketplace": storage_account,
Expand Down
4 changes: 2 additions & 2 deletions tests/community_push/test_community_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,15 +871,15 @@ def test_do_community_push_different_sharing_accounts(
[
mock.call(
mock.ANY,
custom_tags=None,
custom_tags={'billing_type': 'access'},
container='redhat-cloudimg-fake-destination',
accounts=['first_account', 'second_account'],
snapshot_accounts=None,
ami_version_template='{major}.{minor}.0',
),
mock.call(
mock.ANY,
custom_tags=None,
custom_tags={'billing_type': 'access'},
container='redhat-cloudimg-fake-destination2',
accounts=['third_account', 'fourth_account'],
snapshot_accounts=None,
Expand Down

0 comments on commit ad25c51

Please sign in to comment.