Skip to content

Commit af92ce5

Browse files
added permission
1 parent b1f7476 commit af92ce5

File tree

3 files changed

+22
-28
lines changed

3 files changed

+22
-28
lines changed

.github/workflows/update_operator_images.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Phase 3 - Update Operator with SHA256 Digests
22

3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
37
on:
48
workflow_dispatch:
59
inputs:
@@ -245,4 +249,4 @@ jobs:
245249
if [ -f watches_new.yaml ]; then
246250
echo "" >> $GITHUB_STEP_SUMMARY
247251
echo "⚠️ **Action Required:** Review \`watches_new.yaml\`" >> $GITHUB_STEP_SUMMARY
248-
fi
252+
fi

scripts/convert_certified_images.py

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@
1717
import sys
1818

1919

20-
def convert_certified_images_to_text(json_file: str, output_file: str):
20+
def convert_certified_images_to_text(json_file: str, output_file: str):
2121
"""
2222
Convert certified_images.json to text format expected by update_images.py
2323
2424
Args:
2525
json_file: Path to certified_images.json from Phase 2
2626
output_file: Path to output text file
2727
"""
28-
with open(json_file, 'r', encoding='utf-8') as f:
28+
with open(json_file, "r", encoding="utf-8") as f:
2929
data = json.load(f)
3030

3131
lines = []
3232
skipped = []
3333

34-
for img in data['certified_images']:
34+
for img in data["certified_images"]:
3535
# Skip failed or pending certifications
36-
if img['certification_status'] != 'success':
36+
if img["certification_status"] != "success":
3737
skipped.append(f"{img['name']} - Status: {img['certification_status']}")
3838
continue
3939

4040
# Extract components
41-
name = img['name']
42-
version = img['version']
43-
sha256 = img['sha256']
41+
name = img["name"]
42+
version = img["version"]
43+
sha256 = img["sha256"]
4444

4545
# Validate required fields
4646
if not name or not version or not sha256:
@@ -53,7 +53,7 @@ def convert_certified_images_to_text(json_file: str, output_file: str):
5353

5454
# Line 2: registry.connect.redhat.com/sumologic/{name}:@{sha256}
5555
# Remove 'sha256:' prefix if present
56-
sha256_clean = sha256.replace('sha256:', '')
56+
sha256_clean = sha256.replace("sha256:", "")
5757
image_with_sha = f"registry.connect.redhat.com/sumologic/{name}:@sha256:{sha256_clean}"
5858

5959
lines.append(image_with_tag)
@@ -63,13 +63,13 @@ def convert_certified_images_to_text(json_file: str, output_file: str):
6363
if skipped:
6464
print("⚠️ Skipped images:", file=sys.stderr)
6565
for skip in skipped:
66-
print(f" - {skip}", file=sys. stderr)
66+
print(f" - {skip}", file=sys.stderr)
6767

6868
# Write to output file
69-
with open(output_file, 'w', encoding='utf-8') as f:
70-
f.write('\n'. join(lines))
69+
with open(output_file, "w", encoding="utf-8") as f:
70+
f.write("\n".join(lines))
7171
if lines: # Add final newline only if there's content
72-
f.write('\n')
72+
f.write("\n")
7373

7474
print(f"✅ Converted {len(lines)//2} images to {output_file}")
7575

@@ -79,23 +79,13 @@ def convert_certified_images_to_text(json_file: str, output_file: str):
7979

8080
def parse_args():
8181
"""Parse command line arguments"""
82-
parser = argparse.ArgumentParser(
83-
description='Convert certified_images.json to update_images.py format'
84-
)
85-
parser.add_argument(
86-
'--input',
87-
required=True,
88-
help='Path to certified_images.json'
89-
)
90-
parser.add_argument(
91-
'--output',
92-
default='images.txt',
93-
help='Path to output file (default: images.txt)'
94-
)
82+
parser = argparse.ArgumentParser(description="Convert certified_images.json to update_images.py format")
83+
parser.add_argument("--input", required=True, help="Path to certified_images.json")
84+
parser.add_argument("--output", default="images.txt", help="Path to output file (default: images.txt)")
9585
return parser.parse_args()
9686

9787

98-
if __name__ == '__main__':
88+
if __name__ == "__main__":
9989
args = parse_args()
10090
count = convert_certified_images_to_text(args.input, args.output)
10191

scripts/update_images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def update_replace_components_images(image_file_path: str, create_new_file: bool
276276
line = line.strip()
277277
if line.startswith("sed -i.bak"):
278278
# Extract component name from Red Hat registry URL (handles both :tag and @sha256 formats)
279-
match = re.search(r'registry\.connect\.redhat\.com/sumologic/([^:@]+)', line)
279+
match = re.search(r"registry\.connect\.redhat\.com/sumologic/([^:@]+)", line)
280280
if match:
281281
component = match.group(1)
282282
existing_commands[component] = line

0 commit comments

Comments
 (0)