Skip to content

Commit 2d2cc16

Browse files
committed
add-bundle-to-fbc: Create template dir if not exist
In case of first release of the operator the directory for template might be missing. This commit creates the directory if missing. JIRA: ISV-5740 Signed-off-by: Ales Raszka <[email protected]>
1 parent bd28278 commit 2d2cc16

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

ansible/roles/operator-pipeline/templates/openshift/tasks/add-bundle-to-fbc.yml

-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ spec:
7979
--operator-name "$(params.operator_name)" \
8080
--operator-version "$(params.operator_version)"
8181
82-
cat operators/$(params.operator_name)/catalog-templates/basic.yaml
83-
cat operators/$(params.operator_name)/catalog-templates/semver.yaml
84-
8582
# Loop over all catalogs in /catalogs and run opm validate to ensure the catalogs are valid
8683
for catalog in ./catalogs/*; do
8784
opm validate $catalog

operator-pipeline-images/operatorcert/entrypoints/add_bundle_to_fbc.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os
88
from abc import ABC, abstractmethod
99
from typing import Any
10+
from pathlib import Path
1011

1112
from operatorcert import utils
1213
from operatorcert.logger import setup_logger
@@ -68,9 +69,22 @@ def __init__(
6869
self.catalog_names = catalog_names
6970

7071
self._template: dict[str, Any] = {}
71-
self.template_path = (
72-
self.operator.root / "catalog-templates" / self.template_name
73-
)
72+
self.template_path = self.template_dir / self.template_name
73+
74+
@property
75+
def template_dir(self) -> Path:
76+
"""
77+
Get a directory of the template and create it if it doesn't exist.
78+
79+
Returns:
80+
Path: A path to the directory of the template.
81+
"""
82+
path = self.operator.root / "catalog-templates"
83+
84+
# Create the directory if it doesn't exist
85+
os.makedirs(path, exist_ok=True)
86+
87+
return path
7488

7589
def exists(self) -> bool:
7690
"""

0 commit comments

Comments
 (0)