Skip to content

Commit

Permalink
Fix usages of hist_lines_dir and manifests_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mathbunnyru committed Nov 19, 2023
1 parent 69e5b1d commit 8096727
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions tagging/update_wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ def remove_old_manifests(wiki_dir: Path) -> None:
LOGGER.info(f"Removed manifest: {file.relative_to(wiki_dir)}")


def update_wiki(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> None:
def update_wiki(wiki_dir: Path, hist_lines_dir: Path, manifests_dir: Path) -> None:
LOGGER.info("Updating wiki")

for manifest_file in manifest_dir.glob("*.md"):
for manifest_file in manifests_dir.glob("*.md"):
month = get_manifest_month(manifest_file)
copy_to = wiki_dir / "manifests" / month / manifest_file.name
copy_to.parent.mkdir(exist_ok=True)
shutil.copy(manifest_file, copy_to)
LOGGER.info(f"Added manifest file: {copy_to.relative_to(wiki_dir)}")

for build_history_line_file in sorted(hist_line_dir.glob("*.txt")):
for build_history_line_file in sorted(hist_lines_dir.glob("*.txt")):
build_history_line = build_history_line_file.read_text()
assert build_history_line.startswith("| `")
month = build_history_line[3:10]
Expand Down Expand Up @@ -116,4 +116,4 @@ def update_wiki(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> None
)
args = arg_parser.parse_args()

update_wiki(args.wiki_dir, args.hist_line_dir, args.manifest_dir)
update_wiki(args.wiki_dir, args.hist_lines_dir, args.manifests_dir)
24 changes: 12 additions & 12 deletions tagging/write_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def write_build_history_line(
short_image_name: str,
registry: str,
owner: str,
hist_line_dir: Path,
hist_lines_dir: Path,
filename: str,
all_tags: list[str],
) -> None:
Expand All @@ -44,15 +44,15 @@ def write_build_history_line(
]
)
build_history_line = f"| {date_column} | {image_column} | {links_column} |"
hist_line_dir.mkdir(parents=True, exist_ok=True)
(hist_line_dir / f"{filename}.txt").write_text(build_history_line)
hist_lines_dir.mkdir(parents=True, exist_ok=True)
(hist_lines_dir / f"{filename}.txt").write_text(build_history_line)


def write_manifest_file(
short_image_name: str,
registry: str,
owner: str,
manifest_dir: Path,
manifests_dir: Path,
filename: str,
manifests: list[ManifestInterface],
container: Container,
Expand All @@ -65,16 +65,16 @@ def write_manifest_file(
] + [manifest.markdown_piece(container) for manifest in manifests]
markdown_content = "\n\n".join(markdown_pieces) + "\n"

manifest_dir.mkdir(parents=True, exist_ok=True)
(manifest_dir / f"{filename}.md").write_text(markdown_content)
manifests_dir.mkdir(parents=True, exist_ok=True)
(manifests_dir / f"{filename}.md").write_text(markdown_content)


def write_manifest(
short_image_name: str,
registry: str,
owner: str,
hist_line_dir: Path,
manifest_dir: Path,
hist_lines_dir: Path,
manifests_dir: Path,
) -> None:
LOGGER.info(f"Creating manifests for image: {short_image_name}")
taggers, manifests = get_taggers_and_manifests(short_image_name)
Expand All @@ -91,13 +91,13 @@ def write_manifest(
tags_prefix + "-" + tagger.tag_value(container) for tagger in taggers
]
write_build_history_line(
short_image_name, registry, owner, hist_line_dir, filename, all_tags
short_image_name, registry, owner, hist_lines_dir, filename, all_tags
)
write_manifest_file(
short_image_name,
registry,
owner,
manifest_dir,
manifests_dir,
filename,
manifests,
container,
Expand Down Expand Up @@ -145,6 +145,6 @@ def write_manifest(
args.short_image_name,
args.registry,
args.owner,
args.hist_line_dir,
args.manifest_dir,
args.hist_lines_dir,
args.manifests_dir,
)

0 comments on commit 8096727

Please sign in to comment.