diff --git a/ci/slave-scripts/centos.sh b/ci/slave-scripts/centos.sh index 912d2d34de2f8431819204d7a1c32058ddf0aff9..1ff8f502de01bda6c87a5ff987fb5510dc0b8576 100644 --- a/ci/slave-scripts/centos.sh +++ b/ci/slave-scripts/centos.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash disk_name=$1 +frontend_host=$2 +backend_host=$3 if [[ ! -e ${disk_name} ]]; then echo "disk ${disk_name} not existed" @@ -12,13 +14,48 @@ if [[ ! -e ~/.ssh/authorized_keys ]]; then exit 1 fi +if [[ ! -e /etc/yum.repos.d/OSC.repo ]]; then + curl -o /etc/yum.repos.d/OSC.repo http://download.opensuse.org/repositories/openSUSE:/Tools/CentOS_7/openSUSE:Tools.repo +fi # install required tools sudo yum install -y java-1.8.0-openjdk sudo yum install -y git +sudo yum install -y expect +sudo yum install -y osc + +#update osc config file +if [[ ! -d /root/.config/osc ]];then + mkdir -p /root/.config/osc +fi + +if [[ -e /root/.config/osc/oscrc ]];then + rm /root/.config/osc/oscrc +fi +cd /root/.config/osc +curl -o oscrc https://openeuler.obs.cn-south-1.myhuaweicloud.com:443/infrastructure/oscrc + +sed -i "s/#no_verify = 1/no_verify = 1/g" /root/.config/osc/oscrc + +# update /etc/hosts +echo "Updating the cluster hosts info" +# update hosts info: +# 1. build.openeuler.org +if ! grep -q "build.openeuler.org" /etc/hosts; then + echo "${frontend_host} build.openeuler.org" >> /etc/hosts +else + sed -i -e "s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} build.openeuler.org/${frontend_host} build.openeuler.org/g" /etc/hosts +fi +if ! grep -q "backend.openeuler.org" /etc/hosts; then + echo "${backend_host} backend.openeuler.org" >> /etc/hosts +else + sed -i -e "s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} backend.openeuler.org/${backend_host} backend.openeuler.org/g" /etc/hosts +fi # prepare disk -mkfs.ext4 ${disk_name} -mkdir /jenkins_home -mount ${disk_name} /jenkins_home +if [[ ! -d /jenkins_home ]]; then + mkfs.ext4 ${disk_name} + mkdir /jenkins_home + mount ${disk_name} /jenkins_home +fi chmod 600 ~/.ssh/authorized_keys diff --git a/ci/slave-scripts/opensuse.sh b/ci/slave-scripts/opensuse.sh index b50ddb0c80a3507b1743e47084294687f38a42dd..efb1733e71b2b53ec0afbb3181f9e6437e568ca7 100644 --- a/ci/slave-scripts/opensuse.sh +++ b/ci/slave-scripts/opensuse.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash disk_name=$1 +frontend_host=$2 +backend_host=$3 if [[ ! -e ${disk_name} ]]; then echo "disk ${disk_name} not existed" @@ -15,10 +17,42 @@ fi # install required tools zypper install -y java-1_8_0-openjdk zypper install -y git +zypper install -y osc +zypper install -y expect + +#update osc config file +if [[ ! -d /root/.config/osc ]];then + mkdir -p /root/.config/osc +fi + +if [[ -e /root/.config/osc/oscrc ]];then + rm /root/.config/osc/oscrc +fi +cd /root/.config/osc +curl -o oscrc https://openeuler.obs.cn-south-1.myhuaweicloud.com:443/infrastructure/oscrc +sed -i "s/#no_verify = 1/no_verify = 1/g" /root/.config/osc/oscrc + +# update /etc/hosts +echo "Updating the cluster hosts info" +# update hosts info: +# 1. build.openeuler.org +if ! grep -q "build.openeuler.org" /etc/hosts; then + echo "${frontend_host} build.openeuler.org" >> /etc/hosts +else + sed -i -e "s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} build.openeuler.org/${frontend_host} build.openeuler.org/g" /etc/hosts +fi +if ! grep -q "backend.openeuler.org" /etc/hosts; then + echo "${backend_host} backend.openeuler.org" >> /etc/hosts +else + sed -i -e "s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} backend.openeuler.org/${backend_host} backend.openeuler.org/g" /etc/hosts +fi + # prepare disk -mkfs.ext4 ${disk_name} -mkdir /jenkins_home -mount ${disk_name} /jenkins_home +if [[ ! -d /jenkins_home ]]; then + mkfs.ext4 ${disk_name} + mkdir /jenkins_home + mount ${disk_name} /jenkins_home +fi chmod 600 ~/.ssh/authorized_keys diff --git a/ci/slave-scripts/setup.sh b/ci/slave-scripts/setup.sh index b4a1a0c7bcd328f1faa24b609174fc2026ea8506..8344f46897dcfc888ed2b54c7301924063e7e3a9 100755 --- a/ci/slave-scripts/setup.sh +++ b/ci/slave-scripts/setup.sh @@ -4,6 +4,8 @@ script_name=$1 ip_address=$2 disk_name=$3 +frontend_name=$4 +backend_name=$5 scp ./authorized_keys root@${ip_address}:~/.ssh/ scp ./${script_name} root@${ip_address}:~/ -ssh root@${ip_address} "chmod +x ~/${script_name} && ~/${script_name} ${disk_name}" \ No newline at end of file +ssh root@${ip_address} "chmod +x ~/${script_name} && ~/${script_name} ${disk_name} ${frontend_name} ${backend_name}" diff --git a/obs/tf/startup/README.md b/obs/tf/startup/README.md index 97cf4177bd8be0bc242bce8001f7774775260789..50e394ed581bf6991a984f71a3b01bb1fee68253 100644 --- a/obs/tf/startup/README.md +++ b/obs/tf/startup/README.md @@ -123,7 +123,7 @@ Worker6: 172.16.1.195 Worker7: 172.16.1.127 Worker8: 172.16.1.12 Worker9: 172.16.1.14 -Worker10: 172.16.1.157 +Worker10: 172.16.1.57 ``` ## download full fedora packages diff --git a/obs/tf/startup/download_package_codes/projects_raw.xml b/obs/tf/startup/download_package_codes/projects_raw.xml index 1d1b6587c60919ab1079638d51c651f5fa71cb7b..701b7628238808d53d7d91bc13b2313d34afdc31 100644 --- a/obs/tf/startup/download_package_codes/projects_raw.xml +++ b/obs/tf/startup/download_package_codes/projects_raw.xml @@ -657,7 +657,7 @@ - +