Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,19 @@ backward compatibility but is ignored.

{# Command to install TinyTeX using the Quarto CLI

`CI=true` is set inline so Quarto's `runningInCI()` check passes inside
container builds. When it passes, Quarto collapses its TinyTeX download
progress bar to a single line; otherwise it renders an animated progress bar
that, written to a non-TTY build log, emits tens of thousands of redundant
lines (one per download tick). The variable is scoped to this command only, so
it does not leak into the built image.

:param quarto_binary: The path to the Quarto binary.
:param update_path: Adds --update-path to the command to add TinyTeX binaries to the PATH. Defaults to False.
:param home_path: An optional path to set the HOME environment variable for the command, which controls where TinyTeX is installed. If not provided, TinyTeX will be installed to the default location under the current user's home directory.
#}
{% macro install_tinytex_command(quarto_binary, update_path = False, home_path = None) -%}
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" {% if home_path %}HOME="{{ home_path }}" {% endif %}{{ quarto_binary }} install tinytex --no-prompt{% if update_path %} --update-path{% endif %}
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" {% if home_path %}HOME="{{ home_path }}" {% endif %}CI=true {{ quarto_binary }} install tinytex --no-prompt{% if update_path %} --update-path{% endif %}
{%- endmacro %}

{# Command to install a specific version of Quarto from the Posit Open
Expand Down
26 changes: 13 additions & 13 deletions posit-bakery/test/config/templating/test_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -1940,25 +1940,25 @@ def test_github_token_secret_mount(self, environment_with_macros):
pytest.param(
True,
None,
'GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/1.8.24/bin/quarto install tinytex --no-prompt --update-path',
'GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/1.8.24/bin/quarto install tinytex --no-prompt --update-path',
id="with-update-path",
),
pytest.param(
False,
None,
'GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/1.8.24/bin/quarto install tinytex --no-prompt',
'GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/1.8.24/bin/quarto install tinytex --no-prompt',
id="without-update-path",
),
pytest.param(
False,
"/root",
'GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" /opt/quarto/1.8.24/bin/quarto install tinytex --no-prompt',
'GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" CI=true /opt/quarto/1.8.24/bin/quarto install tinytex --no-prompt',
id="with-home-path",
),
pytest.param(
True,
"/root",
'GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" /opt/quarto/1.8.24/bin/quarto install tinytex --no-prompt --update-path',
'GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" CI=true /opt/quarto/1.8.24/bin/quarto install tinytex --no-prompt --update-path',
id="with-home-path-and-update-path",
),
],
Expand Down Expand Up @@ -2018,7 +2018,7 @@ def test_install_tinytex_command(self, environment_with_macros, update_path, hom
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/bin/quarto install tinytex --no-prompt"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt"""
),
id="with-tinytex",
),
Expand All @@ -2035,7 +2035,7 @@ def test_install_tinytex_command(self, environment_with_macros, update_path, hom
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/bin/quarto install tinytex --no-prompt --update-path"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt --update-path"""
),
id="with-tinytex-update-path",
),
Expand All @@ -2052,7 +2052,7 @@ def test_install_tinytex_command(self, environment_with_macros, update_path, hom
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" /opt/quarto/bin/quarto install tinytex --no-prompt"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt"""
),
id="with-tinytex-home-path",
),
Expand All @@ -2069,7 +2069,7 @@ def test_install_tinytex_command(self, environment_with_macros, update_path, hom
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" /opt/quarto/bin/quarto install tinytex --no-prompt --update-path"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt --update-path"""
),
id="with-tinytex-home-path-update-path",
),
Expand Down Expand Up @@ -2122,7 +2122,7 @@ def test_install_rhel_with_tinytex(self, environment_with_macros):
xz && \\
dnf versionlock add quarto && \\
dnf clean all -yq && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/bin/quarto install tinytex --no-prompt"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt"""
)
rendered = environment_with_macros.from_string(template).render()
assert rendered == expected
Expand Down Expand Up @@ -2163,7 +2163,7 @@ def test_install_rejects_invalid_os_family(self, environment_with_macros):
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/bin/quarto install tinytex --no-prompt"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt"""
),
id="single-version-with-tinytex",
),
Expand All @@ -2178,7 +2178,7 @@ def test_install_rejects_invalid_os_family(self, environment_with_macros):
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/bin/quarto install tinytex --no-prompt --update-path"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt --update-path"""
),
id="single-version-with-tinytex-update-path",
),
Expand All @@ -2193,7 +2193,7 @@ def test_install_rejects_invalid_os_family(self, environment_with_macros):
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" /opt/quarto/bin/quarto install tinytex --no-prompt"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt"""
),
id="single-version-with-tinytex-home-path",
),
Expand All @@ -2208,7 +2208,7 @@ def test_install_rejects_invalid_os_family(self, environment_with_macros):
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" /opt/quarto/bin/quarto install tinytex --no-prompt --update-path"""
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" HOME="/root" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt --update-path"""
),
id="single-version-with-tinytex-home-path-update-path",
),
Expand Down
2 changes: 1 addition & 1 deletion posit-bakery/test/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ def test_patch_version_with_dependencies_macros(self, get_tmpcontext):
apt-mark hold quarto && \\
apt-get clean -yqq && \\
rm -rf /var/lib/apt/lists/* && \\
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/bin/quarto install tinytex --no-prompt
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt
""")
assert (
expected_std_containerfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ RUN --mount=type=secret,id=github_token,required=false bash -c "$(curl -1fsSL 'h
apt-mark hold quarto && \
apt-get clean -yqq && \
rm -rf /var/lib/apt/lists/* && \
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/bin/quarto install tinytex --no-prompt
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ RUN --mount=type=secret,id=github_token,required=false bash -c "$(curl -1fsSL 'h
apt-mark hold quarto && \
apt-get clean -yqq && \
rm -rf /var/lib/apt/lists/* && \
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" /opt/quarto/bin/quarto install tinytex --no-prompt
GH_TOKEN="$([ -s /run/secrets/github_token ] && cat /run/secrets/github_token)" CI=true /opt/quarto/bin/quarto install tinytex --no-prompt
Loading