move simplify-ci main function to $CCI_SRC/sparrow/install-client script, make code more reusablely.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- setup/simplify-ci | 61 ++++------------------------------------------- 1 file changed, 5 insertions(+), 56 deletions(-)
diff --git a/setup/simplify-ci b/setup/simplify-ci index 5aede9cdb..107cef2e8 100755 --- a/setup/simplify-ci +++ b/setup/simplify-ci @@ -2,8 +2,7 @@ # SPDX-License-Identifier: MulanPSL-2.0+ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
-: ${SCHED_HOST:=172.17.0.1} -: ${SCHED_PORT:=3000} +export server_ip=$SCHED_HOST
git_ci() { @@ -17,61 +16,11 @@ git_ci() git clone https://gitee.com/wu_fengguang/compass-ci.git /c/compass-ci || return 1 }
-dev_env() +deploy() { - export sched_host=$SCHED_HOST - export sched_port=$SCHED_PORT - 3-code/dev-env + cd /c/compass-ci/sparrow && ./install-client }
-install_env() -{ - cd /c/compass-ci/sparrow || return - 0-package/install - 1-storage/tiny - 5-build/ipxe & - 1-storage/permission - 2-network/br0 - 2-network/iptables - 3-code/git - dev_env - . /etc/profile.d/compass.sh -} - -boot_ipxe() -{ - sed -i "s%172.17.0.1%$SCHED_HOST%g" /tftpboot/boot.ipxe - sed -i "s%3000%$SCHED_PORT%g" /tftpboot/boot.ipxe -} - -run_service() -{ - ( - cd $CCI_SRC/container/dnsmasq || return - ./build - ./start - boot_ipxe - )& - ( - cd $CCI_SRC/container/qemu-efi || return - ./build - ./install - )& - ( - cd $CCI_SRC/container/fluentd-base || return - ./build - cd $CCI_SRC/container/sub-fluentd || return - ./build - ./start - )& -} - -main() -{ - git_ci || return 1 - install_env - run_service -} +git_ci || return 1 +deploy
-main -wait
On Tue, Mar 02, 2021 at 08:36:29PM +0800, Liu Yinsi wrote:
move simplify-ci main function to $CCI_SRC/sparrow/install-client script, make code more reusablely.
Signed-off-by: Liu Yinsi liuyinsi@163.com
setup/simplify-ci | 61 ++++------------------------------------------- 1 file changed, 5 insertions(+), 56 deletions(-)
diff --git a/setup/simplify-ci b/setup/simplify-ci index 5aede9cdb..107cef2e8 100755 --- a/setup/simplify-ci +++ b/setup/simplify-ci @@ -2,8 +2,7 @@ # SPDX-License-Identifier: MulanPSL-2.0+ # Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
-: ${SCHED_HOST:=172.17.0.1} -: ${SCHED_PORT:=3000} +export server_ip=$SCHED_HOST
If there is $SCHED_HOST, why export server_ip, who will use it.
git_ci() { @@ -17,61 +16,11 @@ git_ci() git clone https://gitee.com/wu_fengguang/compass-ci.git /c/compass-ci || return 1 }
-dev_env() +deploy() {
- export sched_host=$SCHED_HOST
- export sched_port=$SCHED_PORT
- 3-code/dev-env
- cd /c/compass-ci/sparrow && ./install-client
Use CCI_SRC env to replace /c/compass-ci.
Thanks, Xueliang
}
-install_env() -{
- cd /c/compass-ci/sparrow || return
- 0-package/install
- 1-storage/tiny
- 5-build/ipxe &
- 1-storage/permission
- 2-network/br0
- 2-network/iptables
- 3-code/git
- dev_env
- . /etc/profile.d/compass.sh
-}
-boot_ipxe() -{
- sed -i "s%172.17.0.1%$SCHED_HOST%g" /tftpboot/boot.ipxe
- sed -i "s%3000%$SCHED_PORT%g" /tftpboot/boot.ipxe
-}
-run_service() -{
- (
cd $CCI_SRC/container/dnsmasq || return
./build
./start
boot_ipxe
- )&
- (
cd $CCI_SRC/container/qemu-efi || return
./build
./install
- )&
- (
cd $CCI_SRC/container/fluentd-base || return
./build
cd $CCI_SRC/container/sub-fluentd || return
./build
./start
- )&
-}
-main() -{
- git_ci || return 1
- install_env
- run_service
-} +git_ci || return 1 +deploy
-main
-wait
2.23.0
# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
-: ${SCHED_HOST:=172.17.0.1} -: ${SCHED_PORT:=3000} +export server_ip=$SCHED_HOST
If there is $SCHED_HOST, why export server_ip, who will use it.
refer: [PATCH compass-ci 1/4] sparrow/install-client: add deploy compass-ci client script
check_server_ip() { [ -z "$server_ip" ] && . 0-package/read-config [ -z "$server_ip" ] && { log_error "env $server_ip is not exists, please config $CCI_SRC/sparrow/setup.yaml" exit 1 }
Thanks, Yinsi
git_ci() { @@ -17,61 +16,11 @@ git_ci() git clone https://gitee.com/wu_fengguang/compass-ci.git /c/compass-ci || return 1 }
-dev_env() +deploy() {
- export sched_host=$SCHED_HOST
- export sched_port=$SCHED_PORT
- 3-code/dev-env
- cd /c/compass-ci/sparrow && ./install-client
Use CCI_SRC env to replace /c/compass-ci.
Thanks, Xueliang
}
-install_env() -{
- cd /c/compass-ci/sparrow || return
- 0-package/install
- 1-storage/tiny
- 5-build/ipxe &
- 1-storage/permission
- 2-network/br0
- 2-network/iptables
- 3-code/git
- dev_env
- . /etc/profile.d/compass.sh
-}
-boot_ipxe() -{
- sed -i "s%172.17.0.1%$SCHED_HOST%g" /tftpboot/boot.ipxe
- sed -i "s%3000%$SCHED_PORT%g" /tftpboot/boot.ipxe
-}
-run_service() -{
- (
cd $CCI_SRC/container/dnsmasq || return
./build
./start
boot_ipxe
- )&
- (
cd $CCI_SRC/container/qemu-efi || return
./build
./install
- )&
- (
cd $CCI_SRC/container/fluentd-base || return
./build
cd $CCI_SRC/container/sub-fluentd || return
./build
./start
- )&
-}
-main() -{
- git_ci || return 1
- install_env
- run_service
-} +git_ci || return 1 +deploy
-main
-wait
2.23.0