diff --git a/tagging/README.md b/tagging/README.md index 11c2e758..5d62917a 100644 --- a/tagging/README.md +++ b/tagging/README.md @@ -108,12 +108,14 @@ from tagging.manifests import ManifestInterface, quoted_output class AptPackagesManifest(ManifestInterface): @staticmethod def markdown_piece(container) -> str: - return "\n".join( - ["## Apt Packages", "", quoted_output(container, "apt list --installed")] - ) + return f"""\ +## Apt Packages + +{quoted_output(container, "apt list --installed")}""" ``` - `quoted_output` simply runs the command inside a container using `DockerRunner.run_simple_command` and wraps it to triple quotes to create a valid markdown piece. + It also adds the command which was run to the markdown piece. - `manifests.py` contains all the manifests. - `write_manifest.py` is a python executable which is used to create the build manifest and history line for an image. diff --git a/tagging/manifests.py b/tagging/manifests.py index 200cab22..8ed6bc19 100644 --- a/tagging/manifests.py +++ b/tagging/manifests.py @@ -16,6 +16,8 @@ def quoted_output(container: Container, cmd: str) -> str: # For example, R packages list contains trailing backspaces cmd_output = "\n".join(line.rstrip() for line in cmd_output.split("\n")) return f"""\ +`{cmd}`: + ```text {cmd_output} ```""" @@ -74,12 +76,8 @@ class CondaEnvironmentManifest(ManifestInterface): {DockerRunner.run_simple_command(container, "python --version")} -`mamba info --quiet`: - {quoted_output(container, "mamba info --quiet")} -`mamba list`: - {quoted_output(container, "mamba list")}""" @@ -89,8 +87,6 @@ class AptPackagesManifest(ManifestInterface): return f"""\ ## Apt Packages -`apt list --installed`: - {quoted_output(container, "apt list --installed")}"""