Add command which was run to the markdown piece

This commit is contained in:
Ayaz Salikhov
2023-11-05 20:40:04 +01:00
parent 2401290ab3
commit 641e13e933
2 changed files with 7 additions and 9 deletions

View File

@@ -108,12 +108,14 @@ from tagging.manifests import ManifestInterface, quoted_output
class AptPackagesManifest(ManifestInterface): class AptPackagesManifest(ManifestInterface):
@staticmethod @staticmethod
def markdown_piece(container) -> str: def markdown_piece(container) -> str:
return "\n".join( return f"""\
["## Apt Packages", "", quoted_output(container, "apt list --installed")] ## 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. - `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. - `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. - `write_manifest.py` is a python executable which is used to create the build manifest and history line for an image.

View File

@@ -16,6 +16,8 @@ def quoted_output(container: Container, cmd: str) -> str:
# For example, R packages list contains trailing backspaces # For example, R packages list contains trailing backspaces
cmd_output = "\n".join(line.rstrip() for line in cmd_output.split("\n")) cmd_output = "\n".join(line.rstrip() for line in cmd_output.split("\n"))
return f"""\ return f"""\
`{cmd}`:
```text ```text
{cmd_output} {cmd_output}
```""" ```"""
@@ -74,12 +76,8 @@ class CondaEnvironmentManifest(ManifestInterface):
{DockerRunner.run_simple_command(container, "python --version")} {DockerRunner.run_simple_command(container, "python --version")}
`mamba info --quiet`:
{quoted_output(container, "mamba info --quiet")} {quoted_output(container, "mamba info --quiet")}
`mamba list`:
{quoted_output(container, "mamba list")}""" {quoted_output(container, "mamba list")}"""
@@ -89,8 +87,6 @@ class AptPackagesManifest(ManifestInterface):
return f"""\ return f"""\
## Apt Packages ## Apt Packages
`apt list --installed`:
{quoted_output(container, "apt list --installed")}""" {quoted_output(container, "apt list --installed")}"""