mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-13 21:12:57 +00:00
Fix usages of hist_lines_dir and manifests_dir
This commit is contained in:
@@ -72,17 +72,17 @@ def remove_old_manifests(wiki_dir: Path) -> None:
|
|||||||
LOGGER.info(f"Removed manifest: {file.relative_to(wiki_dir)}")
|
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")
|
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)
|
month = get_manifest_month(manifest_file)
|
||||||
copy_to = wiki_dir / "manifests" / month / manifest_file.name
|
copy_to = wiki_dir / "manifests" / month / manifest_file.name
|
||||||
copy_to.parent.mkdir(exist_ok=True)
|
copy_to.parent.mkdir(exist_ok=True)
|
||||||
shutil.copy(manifest_file, copy_to)
|
shutil.copy(manifest_file, copy_to)
|
||||||
LOGGER.info(f"Added manifest file: {copy_to.relative_to(wiki_dir)}")
|
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()
|
build_history_line = build_history_line_file.read_text()
|
||||||
assert build_history_line.startswith("| `")
|
assert build_history_line.startswith("| `")
|
||||||
month = build_history_line[3:10]
|
month = build_history_line[3:10]
|
||||||
@@ -116,4 +116,4 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
args = arg_parser.parse_args()
|
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)
|
||||||
|
@@ -25,7 +25,7 @@ def write_build_history_line(
|
|||||||
short_image_name: str,
|
short_image_name: str,
|
||||||
registry: str,
|
registry: str,
|
||||||
owner: str,
|
owner: str,
|
||||||
hist_line_dir: Path,
|
hist_lines_dir: Path,
|
||||||
filename: str,
|
filename: str,
|
||||||
all_tags: list[str],
|
all_tags: list[str],
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -44,15 +44,15 @@ def write_build_history_line(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
build_history_line = f"| {date_column} | {image_column} | {links_column} |"
|
build_history_line = f"| {date_column} | {image_column} | {links_column} |"
|
||||||
hist_line_dir.mkdir(parents=True, exist_ok=True)
|
hist_lines_dir.mkdir(parents=True, exist_ok=True)
|
||||||
(hist_line_dir / f"{filename}.txt").write_text(build_history_line)
|
(hist_lines_dir / f"{filename}.txt").write_text(build_history_line)
|
||||||
|
|
||||||
|
|
||||||
def write_manifest_file(
|
def write_manifest_file(
|
||||||
short_image_name: str,
|
short_image_name: str,
|
||||||
registry: str,
|
registry: str,
|
||||||
owner: str,
|
owner: str,
|
||||||
manifest_dir: Path,
|
manifests_dir: Path,
|
||||||
filename: str,
|
filename: str,
|
||||||
manifests: list[ManifestInterface],
|
manifests: list[ManifestInterface],
|
||||||
container: Container,
|
container: Container,
|
||||||
@@ -65,16 +65,16 @@ def write_manifest_file(
|
|||||||
] + [manifest.markdown_piece(container) for manifest in manifests]
|
] + [manifest.markdown_piece(container) for manifest in manifests]
|
||||||
markdown_content = "\n\n".join(markdown_pieces) + "\n"
|
markdown_content = "\n\n".join(markdown_pieces) + "\n"
|
||||||
|
|
||||||
manifest_dir.mkdir(parents=True, exist_ok=True)
|
manifests_dir.mkdir(parents=True, exist_ok=True)
|
||||||
(manifest_dir / f"{filename}.md").write_text(markdown_content)
|
(manifests_dir / f"{filename}.md").write_text(markdown_content)
|
||||||
|
|
||||||
|
|
||||||
def write_manifest(
|
def write_manifest(
|
||||||
short_image_name: str,
|
short_image_name: str,
|
||||||
registry: str,
|
registry: str,
|
||||||
owner: str,
|
owner: str,
|
||||||
hist_line_dir: Path,
|
hist_lines_dir: Path,
|
||||||
manifest_dir: Path,
|
manifests_dir: Path,
|
||||||
) -> None:
|
) -> None:
|
||||||
LOGGER.info(f"Creating manifests for image: {short_image_name}")
|
LOGGER.info(f"Creating manifests for image: {short_image_name}")
|
||||||
taggers, manifests = get_taggers_and_manifests(short_image_name)
|
taggers, manifests = get_taggers_and_manifests(short_image_name)
|
||||||
@@ -91,13 +91,13 @@ def write_manifest(
|
|||||||
tags_prefix + "-" + tagger.tag_value(container) for tagger in taggers
|
tags_prefix + "-" + tagger.tag_value(container) for tagger in taggers
|
||||||
]
|
]
|
||||||
write_build_history_line(
|
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(
|
write_manifest_file(
|
||||||
short_image_name,
|
short_image_name,
|
||||||
registry,
|
registry,
|
||||||
owner,
|
owner,
|
||||||
manifest_dir,
|
manifests_dir,
|
||||||
filename,
|
filename,
|
||||||
manifests,
|
manifests,
|
||||||
container,
|
container,
|
||||||
@@ -145,6 +145,6 @@ if __name__ == "__main__":
|
|||||||
args.short_image_name,
|
args.short_image_name,
|
||||||
args.registry,
|
args.registry,
|
||||||
args.owner,
|
args.owner,
|
||||||
args.hist_line_dir,
|
args.hist_lines_dir,
|
||||||
args.manifest_dir,
|
args.manifests_dir,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user