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 <Christoph.Freundl@ifm.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Freundl, Christoph' via kas-devel 2023-03-02 08:25:51 +01:00 committed by Jan Kiszka
parent 10e6df438f
commit 8f61dcfeb6
3 changed files with 10 additions and 4 deletions

View File

@ -85,8 +85,8 @@ Environment variables
| ``AWS_CONFIG_FILE`` | Path to the awscli configuration and credentials | | ``AWS_CONFIG_FILE`` | Path to the awscli configuration and credentials |
| |aws_cred| | file that are copied to the kas home dir. | | |aws_cred| | file that are copied to the kas home dir. |
+--------------------------+--------------------------------------------------+ +--------------------------+--------------------------------------------------+
| |git_cred| | Allows to set the git credential helper in the | | |git_cred| | Allows to set and configure the git credential |
| | `.gitconfig` of the kas user. | | | helper in the `.gitconfig` of the kas user. |
+--------------------------+--------------------------------------------------+ +--------------------------+--------------------------------------------------+
| ``NETRC_FILE`` | Path to a .netrc file which will be copied to | | ``NETRC_FILE`` | Path to a .netrc file which will be copied to |
| | the kas home dir as .netrc. | | | the kas home dir as .netrc. |
@ -104,4 +104,4 @@ Environment variables
+--------------------------+--------------------------------------------------+ +--------------------------+--------------------------------------------------+
.. |aws_cred| replace:: ``AWS_SHARED_CREDENTIALS_FILE`` .. |aws_cred| replace:: ``AWS_SHARED_CREDENTIALS_FILE``
.. |git_cred| replace:: ``GIT_CREDENTIAL_HELPER`` .. |git_cred| replace:: ``GIT_CREDENTIAL_HELPER`` ``GIT_CREDENTIAL_USEHTTPPATH``

View File

@ -484,7 +484,8 @@ if [ -n "${KAS_REPO_REF_DIR}" ]; then
fi fi
for var in TERM KAS_DISTRO KAS_MACHINE KAS_TARGET KAS_TASK \ 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 if [ -n "$(eval echo \$${var})" ]; then
set -- "$@" -e "${var}=$(eval echo \"\$${var}\")" set -- "$@" -e "${var}=$(eval echo \"\$${var}\")"
fi fi

View File

@ -152,6 +152,7 @@ class SetupHome(Command):
# This should be kept up to date with any code in execute() # This should be kept up to date with any code in execute()
ENV_VARS = [ ENV_VARS = [
'GIT_CREDENTIAL_HELPER', 'GIT_CREDENTIAL_HELPER',
'GIT_CREDENTIAL_USEHTTPPATH',
'AWS_CONFIG_FILE', 'AWS_CONFIG_FILE',
'AWS_SHARED_CREDENTIALS_FILE', 'AWS_SHARED_CREDENTIALS_FILE',
'NETRC_FILE', 'NETRC_FILE',
@ -187,6 +188,10 @@ class SetupHome(Command):
'\thelper = ' '\thelper = '
+ os.environ.get('GIT_CREDENTIAL_HELPER') + os.environ.get('GIT_CREDENTIAL_HELPER')
+ '\n') + '\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) \ if os.environ.get('AWS_CONFIG_FILE', False) \
and os.environ.get('AWS_SHARED_CREDENTIALS_FILE', False): and os.environ.get('AWS_SHARED_CREDENTIALS_FILE', False):