Skip to content

Commit 8fb6512

Browse files
committed
fix: only auto-obtain PURLs for SDP products
1 parent d8e6d88 commit 8fb6512

File tree

1 file changed

+11
-10
lines changed
  • backend/application/import_observations/api

1 file changed

+11
-10
lines changed

backend/application/import_observations/api/views.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,16 +280,17 @@ def _get_product_branch_by_name(request_serializer: Serializer) -> tuple[Product
280280
branch = Branch.objects.create(
281281
product=product, name=branch_name, is_default_branch=branch_name.endswith("0.0.0-dev-amd64")
282282
)
283-
digest = subprocess.check_output(
284-
"crane digest oci.stackable.tech/sdp/" + branch.product.name + ":" + branch.name,
285-
shell=True,
286-
).rstrip()
287-
arch = branch.name.split("-")[-1]
288-
branch.purl = (
289-
f"pkg:oci/{branch.product.name}@{urllib.parse.quote_plus(digest)}"
290-
f"?arch={arch}&repository_url=oci.stackable.tech%2Fsdp%2F{branch.product.name}"
291-
)
292-
branch.save()
283+
if product.product_group.name in ["SDP Operators", "SDP Products"]:
284+
digest = subprocess.check_output(
285+
"crane digest oci.stackable.tech/sdp/" + branch.product.name + ":" + branch.name,
286+
shell=True,
287+
).rstrip()
288+
arch = branch.name.split("-")[-1]
289+
branch.purl = (
290+
f"pkg:oci/{branch.product.name}@{urllib.parse.quote_plus(digest)}"
291+
f"?arch={arch}&repository_url=oci.stackable.tech%2Fsdp%2F{branch.product.name}"
292+
)
293+
branch.save()
293294

294295
return product, branch
295296

0 commit comments

Comments
 (0)