From 679aaea1bbbfdeac40b3160c4fcdcb592b93f256 Mon Sep 17 00:00:00 2001 From: fighterliu Date: Wed, 1 Jun 2022 17:08:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9F=9F=E5=90=8D=E7=9A=84=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=94=AF=E6=8C=81=E5=8F=8AidProvider?= =?UTF-8?q?=E4=B8=BAbk=5Flogin=5Fv3=20#6889?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/bkce-set-env03.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/bkce-set-env03.sh b/scripts/bkce-set-env03.sh index f66b1f008da..49b500e7d59 100755 --- a/scripts/bkce-set-env03.sh +++ b/scripts/bkce-set-env03.sh @@ -29,6 +29,18 @@ set_env03 (){ fi done } + +set_env03_en (){ + for kv in "$@"; do + echo "SET_ENV03_EN: $ci_env_03 中已赋值,重新覆盖生效 $kv" + [[ "$kv" =~ ^[A-Z0-9_]+=$ ]] && echo -e "\033[31;1m注意:\033[m$kv 赋值为空,请检查蓝鲸是否安装正确 +,或人工修改env文件后重试。" + # 如果已经有相同的行,则也不覆盖,防止赋值为空时不断追加。 + grep -qxF "$kv" "$ci_env_03" 2>/dev/null || echo "$kv" >> "$ci_env_03" + eval "$kv" # 立即生效 + done +} + random_pass (){ base64 /dev/urandom | head -c ${1:-16} } @@ -55,7 +67,7 @@ set_env03 BK_HTTP_SCHEMA=http \ BK_DOMAIN=$BK_DOMAIN \ BK_PAAS_PUBLIC_URL=$BK_PAAS_PUBLIC_URL \ BK_CI_AUTH_PROVIDER=bk_login_v3 \ - BK_CI_FQDN=devops.\$BK_DOMAIN \ + BK_CI_FQDN=$(echo ${BK_PAAS_PUBLIC_ADDR}|sed "s#paas#devops#g;s#:80##g") \ BK_HOME=$BK_HOME \ BK_CI_PUBLIC_URL=http://\$BK_CI_FQDN \ BK_SSM_HOST=bkssm.service.consul \ @@ -85,9 +97,12 @@ set_env03 BK_CI_MYSQL_ADDR=${BK_MYSQL_IP}:3306 BK_CI_MYSQL_USER=bk_ci BK_CI_MYSQ # 复用redis, 读取密码, 刷新03env. set_env03 BK_CI_REDIS_HOST=$BK_REDIS_IP BK_CI_REDIS_PASSWORD=$BK_PAAS_REDIS_PASSWORD +set_env03_en BK_CI_AUTH_PROVIDER=bk_login_v3 \ + BK_CI_FQDN=$(echo ${BK_PAAS_PUBLIC_ADDR}|sed "s#paas#devops#g;s#:80##g") + if grep -w repo $CTRL_DIR/install.config|grep -v ^\# ; then - set_env03 BK_REPO_GATEWAY_IP=$BK_REPO_GATEWAY_IP \ - BK_REPO_HOST=$BK_REPO_HOST + set_env03_en BK_REPO_GATEWAY_IP=$BK_REPO_GATEWAY_IP \ + BK_REPO_HOST=$(echo ${BK_PAAS_PUBLIC_ADDR}|sed "s#paas#repo#g;s#:80##g") fi echo "合并env."