Commit 0eac5ffc authored by Emeric Verschuur's avatar Emeric Verschuur

Update docker-login option

parent 1ffd9c8e
# CI toolbox for Gitlab properties
# CI toolbox for Gitlab - properties
#
# Default CI registry
#DEFAULT_CI_REGISTRY="registry.gitlab.example.com:5005"
DEFAULT_CI_REGISTRY="registry.gitlab.com"
#
# Default docker-login mode (enabled, disabled or auto)
#CITBX_DEFAULT_DOCKER_LOGIN_MODE=auto
#
# Settings file path
#CITBX_RC_PATH="$HOME/.config/myciprojectrc"
......@@ -13,7 +16,7 @@
CITBX_DEFAULT_JOB_SHELL="/bin/bash"
#
# Set service dockers in privileged mode as default
#CITBX_DEFAULT_SERVICE_DOCKER_PRIVILEGED="true"
CITBX_DEFAULT_SERVICE_DOCKER_PRIVILEGED="true"
#
# Enable support of git lfs
#CITBX_GIT_LFS_SUPPORT_ENABLED="true"
......
......@@ -569,7 +569,8 @@ $(for j in "${CITBX_JOB_LIST[@]}"; do echo " $j"; done | sort -u)"
fi
bashopts_declare -n CI_REGISTRY -l docker-registry -d "Docker registry" -t string -s "${declare_opts[@]}"
unset declare_opts
bashopts_declare -n CITBX_DOCKER_LOGIN -l docker-login -o l -d "Execute docker login" -t boolean
bashopts_declare -n CITBX_DOCKER_LOGIN_MODE -l docker-login -d "Execute docker login" -t enum \
-e "enabled" -e "disabled" -e "auto" -v "${CITBX_DEFAULT_DOCKER_LOGIN_MODE:-auto}"
bashopts_declare -n CITBX_JOB_EXECUTOR -l job-executor -o e \
-d "Job executor type (only docker or shell is sypported yet)" -t enum \
-v "$(test -n "$CITBX_DEFAULT_DOCKER_IMAGE" && echo "docker" || echo "shell" )" \
......@@ -671,8 +672,9 @@ fi
# Login to the registry if needed
if [ -n "$CI_REGISTRY" ] \
&& ( [ -z "$(jq -r '."auths"."'$CI_REGISTRY'"."auth"' $HOME/.docker/config.json 2> /dev/null)" ] \
|| [ "$CITBX_DOCKER_LOGIN" == "true" ] ); then
&& ( ( [ -z "$(jq -r '."auths"."'$CI_REGISTRY'" | select(.auth != null)' $HOME/.docker/config.json 2> /dev/null)" ] \
&& [ "$CITBX_DOCKER_LOGIN_MODE" == "auto" ] ) \
|| [ "$CITBX_DOCKER_LOGIN_MODE" == "true" ] ); then
print_info "You are not authenticated against the gitlab docker registry" \
"> Please enter your gitlab user id and password:"
docker login $CI_REGISTRY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment