export my_email, my_name, server_ip to deploy compass-ci.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- sparrow/0-package/read-config | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 sparrow/0-package/read-config
diff --git a/sparrow/0-package/read-config b/sparrow/0-package/read-config new file mode 100755 index 0000000..9da6ffc --- /dev/null +++ b/sparrow/0-package/read-config @@ -0,0 +1,14 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# export config info setup.yaml server_ip, my_email, my_name. + +mkdir -p /etc/compass-ci/ +cp -a $CCI_SRC/sparrow/setup.yaml /etc/compass-ci/setup.yaml + +options=( server_ip my_name my_email ) + +for option in ${options[@]} +do + export $option=$(grep "^$option:" /etc/compass-ci/setup.yaml |awk -F ": " '{print $2}') +done
+# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# export config info setup.yaml server_ip, my_email, my_name.
+mkdir -p /etc/compass-ci/ +cp -a $CCI_SRC/sparrow/setup.yaml /etc/compass-ci/setup.yaml
+options=( server_ip my_name my_email )
+for option in ${options[@]} +do
- export $option=$(grep "^$option:" /etc/compass-ci/setup.yaml |awk -F ": " '{print $2}')
export is a disposable config for variable, it take effect just for the login this time. for the next login, it will in failure. if you want to use it all the time, add 'export my_email|my_name|server_ip' to user's default profile. and source it for current login.
for the line above, use awk if enough, no need 'grep--awk', like: export $option=$(awk -F ": " '/^'$option'/ {print $2}' /etc/compass-ci/setup.yaml)
Thanks, Luan Shengde
+done
2.23.0
+options=( server_ip my_name my_email )
+for option in ${options[@]} +do
- export $option=$(grep "^$option:" /etc/compass-ci/setup.yaml |awk -F ": " '{print $2}')
export is a disposable config for variable, it take effect just for the login this time. for the next login, it will in failure. if you want to use it all the time, add 'export my_email|my_name|server_ip' to user's default profile. and source it for current login.
just need it take effect for the login this time.
for the line above, use awk if enough, no need 'grep--awk', like: export $option=$(awk -F ": " '/^'$option'/ {print $2}' /etc/compass-ci/setup.yaml)
good
Thanks, Yinsi
Thanks, Luan Shengde
+done
2.23.0