From 238072a0cdf90ef37040216ff3d548105294537d Mon Sep 17 00:00:00 2001 From: Fridolin Pokorny Date: Thu, 3 Jun 2021 22:59:00 +0200 Subject: [PATCH] Allow users to generate thoth configuration during the build process --- README.rst | 1 + assemble | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/README.rst b/README.rst index 6f801ee..c629c5e 100644 --- a/README.rst +++ b/README.rst @@ -47,6 +47,7 @@ Configuration options for Thoth's s2i image: * ``THOTH_ADVISE`` - always use the recommended stack by Thoth (even if the lock file is present in the repo) * ``THOTH_CONFIG_CHECK`` - verify values stated in the configuration file match the build environment +* ``THOTH_FORCE_GENERATE_CONFIG`` - generate configuration file during the build process, overwrites already existing configuration file if present * ``THOTH_PROVENANCE_CHECK`` - verify stack provenance - the provenance check is triggered only if the lock file is not comming from Thoth's recommendation engine (otherwise the stack has already verified provenance) * ``THOTH_ASSEMBLE_DEBUG`` - run s2i's assemble script in verbose mode * ``THOTH_DRY_RUN`` - submit stack to Thoth's recommendation engine but do **NOT** use the recommended lock file, use the lock file present in the repo instead diff --git a/assemble b/assemble index c5465dc..bd075e1 100644 --- a/assemble +++ b/assemble @@ -15,6 +15,8 @@ THOTH_CONFIG_CHECK=${THOTH_CONFIG_CHECK:-1} THOTH_PROVENANCE_CHECK=${THOTH_PROVENANCE_CHECK:-1} # Use Thamos from git instead of a PyPI release: THOTH_FROM_MASTER=${THOTH_FROM_MASTER:-0} +# Generate .thoth.yaml file during the build process. +THOTH_FORCE_GENERATE_CONFIG=${THOTH_FORCE_GENERATE_CONFIG:-0} # Thoth host to submit recommendations to: export THOTH_HOST=${THOTH_HOST:-khemenu.thoth-station.ninja} # Disable progressbar for thamos: @@ -37,6 +39,11 @@ function restore_lock() { [[ -f ../requirements.txt ]] && cp ../requirements.txt . } +[[ ${THOTH_FORCE_GENERATE_CONFIG} -ne 0 ]] && { + rm -f .thoth.yaml + thamos config --no-interactive +} + [[ ${THOTH_CONFIG_CHECK} -ne 0 ]] && { thamos check || { if [[ ${THOTH_ERROR_FALLBACK} -ne 0 ]]; then