Skip to content

Commit

Permalink
Merge pull request #1183 from vfreex/konflux-ignore-conflict-error
Browse files Browse the repository at this point in the history
Konflux: Ignore ConflictError when creating a resource
  • Loading branch information
openshift-merge-bot[bot] authored Dec 5, 2024
2 parents eb0cb9a + 6835d20 commit ac2b12a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion doozer/doozerlib/backend/konflux_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,14 @@ async def _create_or_patch(self, manifest: dict):
api_version, kind, name, namespace = self._extract_manifest_metadata(manifest)
resource = await self._get(api_version, kind, name, namespace, strict=False)
if not resource:
return await self._create(manifest)
try:
return await self._create(manifest)
except exceptions.ConflictError as e:
if "already exists" in e.summary():
# This indicates this resource has been created by another process; ignore the error
LOGGER.debug("Error creating %s/%s %s/%s because it already exists; ignoring", api_version, kind, namespace, name)
return await self._get(api_version, kind, name, namespace, strict=True)
raise
return await self._patch(manifest)

async def _create_or_replace(self, manifest: dict):
Expand Down

0 comments on commit ac2b12a

Please sign in to comment.