Skip to content

Commit 86ca133

Browse files
committed
fixes based on testing
Signed-off-by: Kashish Mittal <kmittal@redhat.com>
1 parent 2217a6a commit 86ca133

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

skills/rhdh-templates/scripts/dry_run.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,20 @@ def main() -> int:
110110
raise ValueError("--secrets file must contain a JSON object")
111111
secrets = {str(k): str(v) for k, v in raw.items()}
112112

113-
skeleton_dir = args.skeleton_dir or (template_dir / "skeleton")
114113
directory_contents: list[dict[str, str]] = []
115-
if skeleton_dir.is_dir():
116-
directory_contents = load_directory_contents(skeleton_dir)
114+
content_root = args.skeleton_dir or template_dir
115+
if content_root.is_dir():
116+
if args.skeleton_dir:
117+
prefix = content_root.relative_to(template_dir).as_posix()
118+
for item in load_directory_contents(content_root):
119+
directory_contents.append(
120+
{
121+
"path": f"{prefix}/{item['path']}",
122+
"base64Content": item["base64Content"],
123+
}
124+
)
125+
else:
126+
directory_contents = load_directory_contents(content_root)
117127

118128
response = dry_run(
119129
args.rhdh_url,

tests/integration/test_rhdh_templates_live.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,14 @@ def _rhdh_url() -> str | None:
2929

3030

3131
def _rhdh_reachable(url: str) -> bool:
32+
headers = {"Accept": "application/json"}
33+
token = os.environ.get("RHDH_TOKEN") or os.environ.get("BACKSTAGE_TOKEN")
34+
if token:
35+
headers["Authorization"] = f"Bearer {token}"
3236
try:
3337
req = urllib.request.Request(
3438
f"{url.rstrip('/')}/api/scaffolder/v2/actions",
35-
headers={"Accept": "application/json"},
39+
headers=headers,
3640
method="GET",
3741
)
3842
with urllib.request.urlopen(req, timeout=5) as resp:

0 commit comments

Comments
 (0)