From 8f61dcfeb6d3044601078b4bd2b698745209a955 Mon Sep 17 00:00:00 2001 From: "Freundl, Christoph' via kas-devel" Date: Thu, 2 Mar 2023 08:25:51 +0100 Subject: [PATCH] kas: add GIT_CREDENTIAL_USEHTTPPATH environment variable This allows the configuration of the git option 'credential.usehttppath' if the used credential helper requires this. Signed-off-by: Christoph Freundl Signed-off-by: Jan Kiszka --- docs/command-line.rst | 6 +++--- kas-container | 3 ++- kas/libcmds.py | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/command-line.rst b/docs/command-line.rst index c0f1b8e..39ee2ff 100644 --- a/docs/command-line.rst +++ b/docs/command-line.rst @@ -85,8 +85,8 @@ Environment variables | ``AWS_CONFIG_FILE`` | Path to the awscli configuration and credentials | | |aws_cred| | file that are copied to the kas home dir. | +--------------------------+--------------------------------------------------+ -| |git_cred| | Allows to set the git credential helper in the | -| | `.gitconfig` of the kas user. | +| |git_cred| | Allows to set and configure the git credential | +| | helper in the `.gitconfig` of the kas user. | +--------------------------+--------------------------------------------------+ | ``NETRC_FILE`` | Path to a .netrc file which will be copied to | | | the kas home dir as .netrc. | @@ -104,4 +104,4 @@ Environment variables +--------------------------+--------------------------------------------------+ .. |aws_cred| replace:: ``AWS_SHARED_CREDENTIALS_FILE`` -.. |git_cred| replace:: ``GIT_CREDENTIAL_HELPER`` +.. |git_cred| replace:: ``GIT_CREDENTIAL_HELPER`` ``GIT_CREDENTIAL_USEHTTPPATH`` diff --git a/kas-container b/kas-container index 31dbadc..c74caf7 100755 --- a/kas-container +++ b/kas-container @@ -484,7 +484,8 @@ if [ -n "${KAS_REPO_REF_DIR}" ]; then fi for var in TERM KAS_DISTRO KAS_MACHINE KAS_TARGET KAS_TASK \ - KAS_PREMIRRORS DISTRO_APT_PREMIRRORS BB_NUMBER_THREADS PARALLEL_MAKE; do + KAS_PREMIRRORS DISTRO_APT_PREMIRRORS BB_NUMBER_THREADS PARALLEL_MAKE \ + GIT_CREDENTIAL_USEHTTPPATH; do if [ -n "$(eval echo \$${var})" ]; then set -- "$@" -e "${var}=$(eval echo \"\$${var}\")" fi diff --git a/kas/libcmds.py b/kas/libcmds.py index 8104aa9..e02de44 100644 --- a/kas/libcmds.py +++ b/kas/libcmds.py @@ -152,6 +152,7 @@ class SetupHome(Command): # This should be kept up to date with any code in execute() ENV_VARS = [ 'GIT_CREDENTIAL_HELPER', + 'GIT_CREDENTIAL_USEHTTPPATH', 'AWS_CONFIG_FILE', 'AWS_SHARED_CREDENTIALS_FILE', 'NETRC_FILE', @@ -187,6 +188,10 @@ class SetupHome(Command): '\thelper = ' + os.environ.get('GIT_CREDENTIAL_HELPER') + '\n') + if os.environ.get('GIT_CREDENTIAL_USEHTTPPATH', False): + fds.write('\tuseHttpPath = ' + + os.environ.get('GIT_CREDENTIAL_USEHTTPPATH') + + '\n') if os.environ.get('AWS_CONFIG_FILE', False) \ and os.environ.get('AWS_SHARED_CREDENTIALS_FILE', False):