From a5f6487b77b5bed06c9a805b547e5fd68cd18bca Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Tue, 8 Apr 2025 15:47:48 +0800 Subject: [PATCH 01/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0BoostKit-AccLib?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 本次提交包含以下主要变更: 1. 新增BoostKit加速库插件配置 - 添加config.yaml配置文件,定义主机信息和安装参数 - 添加main.yaml定义插件名称和操作描述 2. 实现AccLib加速库安装功能 - 添加install.py安装脚本,支持多种加速组件安装 - 包含KSL、Hyperscan、KAE、QAT等组件的安装逻辑 - 提供版本检查和依赖管理功能 3. 添加Ansible playbook和roles - 实现show/install/prepare等操作流程 - 包含文件传输、环境检查等任务 - 支持组件列表展示和批量安装 4. 提供完整的安装资源 - 包含version.xml定义各组件版本信息 - 添加requirements.txt定义Python依赖 该插件支持在鲲鹏平台上部署多种加速库,提升系统性能。 --- plugins/boostkit/config.yaml | 16 + plugins/boostkit/main.yaml | 15 + plugins/boostkit/workspace/AccLib-install.yml | 5 + plugins/boostkit/workspace/AccLib-show.yml | 5 + .../roles/AccLib/install/tasks/main.yml | 7 + .../prepare/files/BoostKit-AccLib/install.py | 511 ++++++++++++++++++ .../files/BoostKit-AccLib/requirements.txt | 1 + .../prepare/files/BoostKit-AccLib/version.xml | 39 ++ .../roles/AccLib/prepare/tasks/main.yml | 5 + .../roles/AccLib/show/tasks/main.yml | 11 + .../workspace/roles/check/tasks/main.yml | 69 +++ 11 files changed, 684 insertions(+) create mode 100644 plugins/boostkit/config.yaml create mode 100644 plugins/boostkit/main.yaml create mode 100644 plugins/boostkit/workspace/AccLib-install.yml create mode 100644 plugins/boostkit/workspace/AccLib-show.yml create mode 100644 plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml create mode 100644 plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py create mode 100644 plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/requirements.txt create mode 100644 plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/version.xml create mode 100644 plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml create mode 100644 plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml create mode 100644 plugins/boostkit/workspace/roles/check/tasks/main.yml diff --git a/plugins/boostkit/config.yaml b/plugins/boostkit/config.yaml new file mode 100644 index 0000000..86f1700 --- /dev/null +++ b/plugins/boostkit/config.yaml @@ -0,0 +1,16 @@ +all: + hosts: + host1: + ansible_host: HOST_IP # e.g. 192.168.1.101 + ansible_port: 22 + ansible_user: root + ansible_password: "" + children: + AccLib: + hosts: + host1: + vars: + install_list: [] + vars: + pip_index_url: "https://mirrors.huaweicloud.com/repository/pypi/simple" + temp_path: /tmp diff --git a/plugins/boostkit/main.yaml b/plugins/boostkit/main.yaml new file mode 100644 index 0000000..5c77268 --- /dev/null +++ b/plugins/boostkit/main.yaml @@ -0,0 +1,15 @@ +name: boostkit +description: BoostKit +action: + AccLib-show: + description: show available components in AccLib + tasks: + - name: show available components in AccLib + playbook: AccLib-show.yml + scope: AccLib + AccLib-install: + description: install components in AccLib + tasks: + - name: install components in AccLib + playbook: AccLib-install.yml + scope: AccLib diff --git a/plugins/boostkit/workspace/AccLib-install.yml b/plugins/boostkit/workspace/AccLib-install.yml new file mode 100644 index 0000000..f7a11c8 --- /dev/null +++ b/plugins/boostkit/workspace/AccLib-install.yml @@ -0,0 +1,5 @@ +- hosts: all +- roles: + - check + - AccLib/prepare + - AccLib/install diff --git a/plugins/boostkit/workspace/AccLib-show.yml b/plugins/boostkit/workspace/AccLib-show.yml new file mode 100644 index 0000000..dd4e301 --- /dev/null +++ b/plugins/boostkit/workspace/AccLib-show.yml @@ -0,0 +1,5 @@ +- hosts: all +- roles: + - check + - AccLib/prepare + - AccLib/show diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml new file mode 100644 index 0000000..b8b267c --- /dev/null +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -0,0 +1,7 @@ +- name: "[Script] Execute install script" + shell: | + python3 {{ temp_dir }}/install.py --component {{ item }} + changed_when: false + tags: install + loop: "{{ install_list | default([]) | list }}" + when: install_list is defined and install_list | length > 0 diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py new file mode 100644 index 0000000..dae80b1 --- /dev/null +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py @@ -0,0 +1,511 @@ +import argparse +import os.path +import re +import xml.etree.ElementTree as ET +import subprocess +from contextlib import contextmanager + +quiet = True + + +def check_version(src, tar, op=">="): + src_list = src.split('.') + tar_list = tar.split('.') + + for index, str in enumerate(tar_list): + if '*' in str or index >= len(src_list): + break + + if op == ">=": + if int(src_list[index]) > int(str): + return True + elif int(src_list[index]) == int(str): + continue + else: + return False + elif op == "<": + if int(src_list[index]) < int(str): + return True + elif int(src_list[index]) == int(str): + continue + else: + return False + elif op == "=": + if int(src_list[index]) != int(str): + return False + else: + return False + return True + + +class Runcmd(object): + @staticmethod + def sendcmd(cmd, workspace=None, check=True, extra_env: dict = None): + env = os.environ.copy() + if extra_env: + for key in extra_env: + env[key] = extra_env.get(key) + + if not quiet: + print(f"cmd: {cmd}") + result = subprocess.run(cmd, cwd=workspace, shell=True, check=check, capture_output=True, encoding='utf-8', + env=env) + if not quiet: + print(f"done\nstdout:\n{result.stdout}\nstderr:\n{result.stderr}\nreturn code: {result.returncode}") + return '\n'.join(result.stdout.split('\n')).strip("\n") + + +class Installer(object): + __root = None + __function_dict = dict() + + def __init__(self, xml_path): + self.__root = ET.parse(xml_path).getroot() + self.__ROOT_PATH = os.path.abspath(os.path.dirname(os.getcwd())) + self.__SOURCE_PATH = os.path.join(self.__ROOT_PATH, "source/") + self.__init_func_dict() + self.__platform = self.__check_platform() + + def __check_platform(self): + kunpeng_platform = {"0xd01": "Kunpeng 920", "0xd02": "Kunpeng 920 V200"} + implementer = Runcmd.sendcmd("cat /proc/cpuinfo | grep 'CPU implementer' | head -n 1 | awk '{print $NF}'") + part = Runcmd.sendcmd("cat /proc/cpuinfo | grep 'CPU part' | head -n 1 | awk '{print $NF}'") + + if implementer == "0x48": + return kunpeng_platform.get(part) + else: + return Runcmd.sendcmd("lscpu | grep 'BIOS Model name:' | awk '{print $NF}'") + + def __check_env(self): + with self.__process("检查代理"): + Runcmd.sendcmd("curl www.baidu.com") + + with self.__process("检查yum源, 并安装必要工具"): + Runcmd.sendcmd("yum makecache") + Runcmd.sendcmd("yum install -y git tar gcc gcc-c++ patch") + Runcmd.sendcmd("git config --global https.sslverify false") + Runcmd.sendcmd("git config --global http.sslverify false") + + def __chech_env_in_profile(self, key, value): + libpath = os.getenv(key) + if libpath and value in libpath: + return True + + env_list = Runcmd.sendcmd(f"cat /etc/profile | grep {key}").split("\n") + for env in env_list: + if value in env and not re.search("#.+export", env): + return True + + return False + + def __get_element_text(self, tag: str): + tags = [child.tag for child in self.__root.find(tag)] + texts = [child.text for child in self.__root.find(tag)] + info = dict() + + for index, tag in enumerate(tags): + info[tag] = texts[index] + + return info + + @contextmanager + def __process(self, topic): + try: + print(topic) + yield + print(f"{topic}成功") + except subprocess.CalledProcessError as e: + print(f"{topic}存在执行命令失败, 报错信息如下:\n{e.stderr}") + raise e + except Exception as e: + print(f"{topic}失败") + raise e + + def __install_ksl(self): + Runcmd.sendcmd("rm -rf ./KSL", workspace=f"{self.__ROOT_PATH}") + Runcmd.sendcmd(f"mkdir -p KSL/rpm", workspace=f"{self.__ROOT_PATH}") + + ksl_info = self.__get_element_text("KSL") + with self.__process("安装KSL"): + res = Runcmd.sendcmd("cat /etc/os-release") + name = re.search("NAME=\"(.+)\"", res).group(1) + assert name == "openEuler", "仅支持在openEuler上安装" + os_version = re.search("VERSION=\"(.+)\"", res).group(1).replace(' ', '').replace(')', '').replace('(', '-') + pkg_version = ksl_info.get("version") + url = ksl_info.get('url').format(f"{name}-{os_version}", pkg_version) + + Runcmd.sendcmd(f"wget {url} --no-check-certificate", workspace=f"{self.__ROOT_PATH}/KSL/rpm") + Runcmd.sendcmd("rpm -e boostkit-ksl", check=False) + Runcmd.sendcmd("rpm -ivh rpm/*.rpm", workspace=f"{self.__ROOT_PATH}/KSL") + + def __install_hyperscan_dep(self): + self.__install_ksl() + + Runcmd.sendcmd("rm -rf ./Hyperscan", workspace=f"{self.__ROOT_PATH}") + Runcmd.sendcmd(f"mkdir -p Hyperscan/resource", workspace=f"{self.__ROOT_PATH}") + + info = self.__get_element_text("Hyperscan") + + with self.__process("安装ragel"): + download = info.get("ragel") + bag = info.get("ragel").split('/')[-1] + + Runcmd.sendcmd(f"wget {download} --no-check-certificate", workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd(f"tar -zxf {bag}", workspace=f"{self.__ROOT_PATH}/Hyperscan") + + dir = Runcmd.sendcmd(f"ls | grep ragel | grep -v tar", workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd(f"./configure", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") + Runcmd.sendcmd(f"make -j && make install", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") + Runcmd.sendcmd(f"ragel -v") + + with self.__process("安装boost"): + download = info.get("boost") + bag = info.get("boost").split('/')[-1] + + Runcmd.sendcmd(f"wget {download} --no-check-certificate", workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd(f"tar -zxf {bag}", workspace=f"{self.__ROOT_PATH}/Hyperscan") + + with self.__process("安装pcre"): + download = info.get("pcre") + bag = info.get("pcre").split('/')[-1] + + Runcmd.sendcmd(f"wget {download} --no-check-certificate", workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd(f"tar -zxf {bag}", workspace=f"{self.__ROOT_PATH}/Hyperscan") + + with self.__process("安装yum依赖包"): + Runcmd.sendcmd("yum install -y sqlite sqlite-devel") + stdout = Runcmd.sendcmd("pkg-config --libs sqlite3") + assert "-lsqlite3" in stdout, "安装sqlite失败" + Runcmd.sendcmd("yum install -y cmake make gcc gcc-c++") + + with self.__process("下载测试集"): + Runcmd.sendcmd("wget https://cdrdv2.intel.com/v1/dl/getContent/739375 --no-check-certificate", + workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd("unzip 739375 && mv '[Hyperscan] hsbench-samples' hsbench-samples", + workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd(f"cp ./2_suricata_rule_hs_9.txt {self.__ROOT_PATH}/Hyperscan/hsbench-samples/pcres", + workspace=f"{self.__ROOT_PATH}/resources/hsbench-samples") + + def __install_hyperscan(self): + self.__install_hyperscan_dep() + + info = self.__get_element_text("Hyperscan") + + with self.__process("安装Hyperscan"): + stdout = Runcmd.sendcmd("lscpu | grep Architecture") + platform = "x86" if "x86" in stdout else "arm" + download = info.get(f"code_{platform}") + branch = info.get(f"branch_{platform}") + dir = download.split('/')[-1].split('.')[0] + + res = Runcmd.sendcmd("rpm -qa | grep boostkit-ksl") + ksl_version = re.search("boostkit-ksl-(\d+.\d+.\d+)", res).group(1) + if platform == "arm" and check_version(ksl_version, "2.4.0"): + Runcmd.sendcmd(f"git clone {download} -b khsel", workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd("cp hyperscan/khsel.patch ./", workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd(f"git checkout {branch}", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") + Runcmd.sendcmd(f"mv ../khsel.patch ./", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") + Runcmd.sendcmd(f"git apply khsel.patch", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") + else: + Runcmd.sendcmd(f"git clone {download} -b {branch}", workspace=f"{self.__ROOT_PATH}/Hyperscan") + + boost_path = Runcmd.sendcmd("ls | grep boost | grep -v tar", workspace=f"{self.__ROOT_PATH}/Hyperscan") + boost_path = f"{self.__ROOT_PATH}/Hyperscan/{boost_path}" + Runcmd.sendcmd(f"ln -s {boost_path}/boost include/boost", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") + + pcre_path = Runcmd.sendcmd("ls | grep pcre | grep -v tar", workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd(f"cp -rf ../{pcre_path} ./pcre", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") + + stdout = Runcmd.sendcmd("cmake --version | grep version", workspace=f"{self.__ROOT_PATH}/Hyperscan") + version = stdout.split()[-1] + if check_version(version, "2.8.0", op='<'): + Runcmd.sendcmd( + "sed -i 's/CMAKE_POLICY(SET CMP0026 OLD)/#CMAKE_POLICY(SET CMP0026 OLD)/g' CMakeLists.txt", + workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}/pcre") + + Runcmd.sendcmd("mkdir -p build", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") + Runcmd.sendcmd("cmake .. && make -j", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}/build") + + def __install_compress_decompress_tools(self): + Runcmd.sendcmd("rm -rf ZIP", workspace=f"{self.__ROOT_PATH}") + Runcmd.sendcmd("mkdir ZIP", workspace=f"{self.__ROOT_PATH}") + + with self.__process("安装软算测试工具lzbench"): + Runcmd.sendcmd("git clone https://gitee.com/kunpeng_compute/lzbench.git --depth=1", + workspace=f"{self.__ROOT_PATH}/ZIP") + Runcmd.sendcmd("make -j", workspace=f"{self.__ROOT_PATH}/ZIP/lzbench") + + if "KAE" in str(self.__function_dict.keys()) or "QAT" in str(self.__function_dict.keys()): + with self.__process("安装带宽测试工具"): + Runcmd.sendcmd(f"make platform='{self.__platform}'", + workspace=f"{self.__ROOT_PATH}/resources/bandwidth") + Runcmd.sendcmd(f"cp ./bin/bandwidth {self.__ROOT_PATH}/ZIP", + workspace=f"{self.__ROOT_PATH}/resources/bandwidth") + Runcmd.sendcmd("make clean", workspace=f"{self.__ROOT_PATH}/resources/bandwidth") + + def __install_kae_dep(self): + with self.__process("安装KAE相关依赖"): + Runcmd.sendcmd( + "yum install -y make kernel-devel libtool numactl-devel openssl-devel chrpath lz4-devel zstd-devel zlib-devel") + + def __install_kae(self): + version = Runcmd.sendcmd("openssl version | awk '{print $2}'") + if check_version(version, "1.*", "="): + engine_path = "/usr/local/lib/engines-1.1/" + component = "engine" + elif check_version(version, "3.*", "="): + engine_path = "/usr/local/lib/engines-3.0/" + component = "engine3" + else: + assert False, f"unsupport openssl version: {version}" + + self.__install_kae_dep() + + info = self.__get_element_text("KAE") + Runcmd.sendcmd("rm -rf ./KAE", workspace=f"{self.__ROOT_PATH}") + Runcmd.sendcmd("mkdir KAE", workspace=f"{self.__ROOT_PATH}") + + with self.__process("下载编译KAE源码"): + download = info.get("kae_code") + branch = info.get("kae_code_tag") + dir = download.split('/')[-1].split('.')[0] + + Runcmd.sendcmd(f"git clone {download} -b {branch} --depth=1", workspace=f"{self.__ROOT_PATH}/KAE") + Runcmd.sendcmd("bash build.sh cleanup", workspace=f"{self.__ROOT_PATH}/KAE/{dir}") + Runcmd.sendcmd("bash build.sh driver", workspace=f"{self.__ROOT_PATH}/KAE/{dir}") + Runcmd.sendcmd("bash build.sh uadk", workspace=f"{self.__ROOT_PATH}/KAE/{dir}") + Runcmd.sendcmd(f"bash build.sh {component}", workspace=f"{self.__ROOT_PATH}/KAE/{dir}") + Runcmd.sendcmd("bash build.sh zlib", workspace=f"{self.__ROOT_PATH}/KAE/{dir}") + + if "Kunpeng 920 V200" == self.__platform: + Runcmd.sendcmd("bash build.sh lz4", workspace=f"{self.__ROOT_PATH}/KAE/{dir}") + Runcmd.sendcmd("bash build.sh zstd", workspace=f"{self.__ROOT_PATH}/KAE/{dir}") + + with self.__process("确认KAE模块使能"): + res = Runcmd.sendcmd("ls /sys/class/uacce", check=False) + if not res: + Runcmd.sendcmd("rmmod hisi_zip && rmmod hisi_sec2 && rmmod hisi_hpre") + Runcmd.sendcmd("inmod hisi_hpre && inmod hisi_sec2 && inmod hisi_zip") + Runcmd.sendcmd("ls /sys/class/uacce") + Runcmd.sendcmd("ls /usr/local/lib/libwd*") + + res = Runcmd.sendcmd("ls /usr/local/kaezip/lib", check=False) + assert "kaezip" in res, "没有找到kaezip相关动态库" + if "Kunpeng 920 V200" == self.__platform: + res = Runcmd.sendcmd("ls /usr/local/kaelz4/lib", check=False) + assert "kaelz4" in res, "没有找到kaelz4相关动态库" + res = Runcmd.sendcmd("ls /usr/local/kaezstd/lib", check=False) + assert "kaezstd" in res, "没有找到kaezstd相关动态库" + + res = Runcmd.sendcmd(f"ls {engine_path}", check=False) + assert "kae.so" in res, "没有找到engine相关动态库" + + if not self.__chech_env_in_profile("OPENSSL_ENGINES", engine_path): + Runcmd.sendcmd(f"echo 'export OPENSSL_ENGINES={engine_path}:$OPENSSL_ENGINES' >> /etc/profile") + + print("成功安装KAE, 已经添加必要环境变量, 执行source /etc/profile使能") + + self.__install_compress_decompress_tools() + + def __install_libgcrypt_dep(self): + with self.__process("安装libgcrypt相关依赖"): + Runcmd.sendcmd("yum install -y texinfo transfig hwloc hwloc-devel autoconf automake") + + def __install_libgcrypt(self): + self.__install_libgcrypt_dep() + + gpg_info = Runcmd.sendcmd("find /usr/local/lib -name '*libgpg-error.so*'") + if "libgpg-error.so" in gpg_info: + print("已经安装了libgpg-error,不用再安装了") + return + + Runcmd.sendcmd("rm -rf libgpg", workspace=f"{self.__ROOT_PATH}") + with self.__process("安装libgcrypt"): + Runcmd.sendcmd(f"unzip libgpg-error-1.51.zip -d {self.__ROOT_PATH}/libgpg", + workspace=f"{self.__ROOT_PATH}/resources/libgcrypt") + Runcmd.sendcmd("chmod 777 autogen.sh; ./autogen.sh", + workspace=f"{self.__ROOT_PATH}/libgpg/libgpg-error-1.51") + Runcmd.sendcmd("chmod 777 configure; ./configure --enable-maintainer-mode", + workspace=f"{self.__ROOT_PATH}/libgpg/libgpg-error-1.51") + Runcmd.sendcmd("make -j; make install", workspace=f"{self.__ROOT_PATH}/libgpg/libgpg-error-1.51") + + if not self.__chech_env_in_profile("LD_LIBRARY_PATH", "/usr/local/lib"): + Runcmd.sendcmd("echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> /etc/profile") + + def __install_qat_dep(self): + with self.__process("安装QAT依赖包"): + Runcmd.sendcmd("yum install -y systemd-devel pciutils libudev-devel readline-devel libxml2-devel " + "boost-devel elfutils-libelf-devel python3 libnl3-devel kernel-devel-$(uname -r) " + "gcc gcc-c++ yasm nasm zlib openssl-devel zlib-devel make") + + def __install_qat(self): + self.__install_qat_dep() + + Runcmd.sendcmd(f"rm -rf ./QAT", workspace=f"{self.__ROOT_PATH}") + Runcmd.sendcmd("mkdir -p QAT/qat_driver", workspace=f"{self.__ROOT_PATH}") + + info = self.__get_element_text("QAT") + + with self.__process("安装部署QAT驱动"): + download = info.get("driver") + bag = download.split('/')[-1] + decompresser = "unzip" if "zip" in bag else "tar -xf" + qat_hw_root = f"{self.__ROOT_PATH}/QAT/qat_driver" + + os.putenv("ICP_ROOT", qat_hw_root) + Runcmd.sendcmd(f"wget {download} --no-check-certificate", workspace=f"{self.__ROOT_PATH}/QAT/qat_driver") + Runcmd.sendcmd(f"{decompresser} {bag}", workspace=f"{self.__ROOT_PATH}/QAT/qat_driver") + Runcmd.sendcmd("./configure", workspace=f"{self.__ROOT_PATH}/QAT/qat_driver") + Runcmd.sendcmd("make && make install", workspace=f"{self.__ROOT_PATH}/QAT/qat_driver") + + Runcmd.sendcmd("service qat_service status && service qat_service restart") + + with self.__process("安装部署QAT引擎"): + download = info.get("code_engine") + branch = info.get("branch_engine") + dir = download.split('/')[-1].split('.')[0] + + Runcmd.sendcmd(f"git clone {download} -b {branch} --depth=1", workspace=f"{self.__ROOT_PATH}/QAT") + Runcmd.sendcmd(f"./autogen.sh && ./configure --with-qat_hw-dir={qat_hw_root}", + workspace=f"{self.__ROOT_PATH}/QAT/{dir}") + Runcmd.sendcmd(f"make && make install", workspace=f"{self.__ROOT_PATH}/QAT/{dir}") + + with self.__process("安装部署QATzip"): + download = info.get("code_zip") + branch = info.get("branch_zip") + dir = download.split('/')[-1].split('.')[0] + + Runcmd.sendcmd(f"git clone {download} -b {branch} --depth=1", workspace=f"{self.__ROOT_PATH}/QAT") + Runcmd.sendcmd(f"./autogen.sh && ./configure --with-ICP_ROOT={qat_hw_root}", + workspace=f"{self.__ROOT_PATH}/QAT/{dir}") + Runcmd.sendcmd("make clean && make all install", workspace=f"{self.__ROOT_PATH}/QAT/{dir}") + + res = Runcmd.sendcmd("ls /usr/local/lib") + assert "qatzip.so" in res, "没有找到qatzip动态库" + + self.__install_compress_decompress_tools() + + def __install_hct_dep(self): + with self.__process("安装HCT依赖"): + Runcmd.sendcmd( + "yum install -y numactl libuuid-devel kernel-`uname -r` kernel-devel-`uname -r` python3-unversioned-command") + + def __install_hct(self): + self.__install_hct_dep() + + info = self.__get_element_text("HCT") + Runcmd.sendcmd("rm -rf HCT", workspace=f"{self.__ROOT_PATH}") + Runcmd.sendcmd("mkdir -p HCT/build", workspace=f"{self.__ROOT_PATH}") + + with self.__process("安装HCT"): + download = info.get("devkit") + version = info.get("version") + dir = download.split('/')[-1].split('.')[0] + + Runcmd.sendcmd(f"git clone {download} -n --filter=blob:none", workspace=f"{self.__ROOT_PATH}/HCT") + Runcmd.sendcmd(f"git restore --staged hct/pkg/{version} && git restore hct/pkg/{version}", + workspace=f"{self.__ROOT_PATH}/HCT/{dir}") + Runcmd.sendcmd(f"rpm -ivh --nodeps hct-*.rpm", workspace=f"{self.__ROOT_PATH}/HCT/{dir}/hct/pkg/{version}", + check=False) + Runcmd.sendcmd(f"cp ./Makefile {self.__ROOT_PATH}/HCT/build", + workspace=f"{self.__ROOT_PATH}/HCT/{dir}/hct/pkg/{version}") + Runcmd.sendcmd("make && make install", workspace=f"{self.__ROOT_PATH}/HCT/build") + Runcmd.sendcmd("modprobe hct && /opt/hygon/hct/hct/script/hctconfig start") + + def __install_kqmalloc_dep(self): + with self.__process("安装kqmalloc编译依赖"): + Runcmd.sendcmd("yum install -y autoconf gcc gcc-c++") + + def __install_kqmalloc(self): + self.__install_kqmalloc_dep() + + Runcmd.sendcmd(f"rm -rf ./KQMalloc", workspace=f"{self.__ROOT_PATH}") + Runcmd.sendcmd(f"mkdir -p KQMalloc/resource", workspace=f"{self.__ROOT_PATH}") + + with self.__process("安装kqmalloc"): + self.__install_ksl() + res = Runcmd.sendcmd("rpm -qa | grep boostkit-ksl") + ksl_version = re.search("boostkit-ksl-(\d+.\d+.\d+)", res).group(1) + assert check_version(ksl_version, "2.4.0"), "ksl版本过低,请指定2.4.0以上版本" + + with self.__process("安装tcmalloc"): + Runcmd.sendcmd("yum install -y jemalloc-devel jemalloc") + + with self.__process("编译安装tcmalloc"): + tcmalloc_info = self.__get_element_text("Tcmalloc") + download = tcmalloc_info.get("code") + branch = tcmalloc_info.get("branch") + dir = download.split('/')[-1].split('.')[0] + + Runcmd.sendcmd("rm -rf /opt/tcmalloc") + Runcmd.sendcmd(f"git clone {download} -b {branch} --depth=1", + workspace=f"{self.__ROOT_PATH}/KQMalloc/resource") + Runcmd.sendcmd( + './autogen.sh && ./configure --prefix=/opt/tcmalloc CFLAGS=" -O3 -march=armv8.2-a " CXXFLAGS=" -O3 -march=armv8.2-a "', + workspace=f"{self.__ROOT_PATH}/KQMalloc/resource/{dir}") + Runcmd.sendcmd("make -j && make install", workspace=f"{self.__ROOT_PATH}/KQMalloc/resource/{dir}") + + with self.__process("安装KQMalloc benchmark"): + Runcmd.sendcmd(f"cp -r ./* {self.__ROOT_PATH}/KQMalloc/resource", + workspace=f"{self.__ROOT_PATH}/resources/benchmark") + if check_version(ksl_version, "2.5.0", "<"): + Runcmd.sendcmd("sed -i 's/-lkqmalloc/-lkqmallocmt/g' Makefile", + workspace=f"{self.__ROOT_PATH}/KQMalloc/resource") + + Runcmd.sendcmd("make", workspace=f"{self.__ROOT_PATH}/KQMalloc/resource") + Runcmd.sendcmd(f"mv ./bin_* {self.__ROOT_PATH}/KQMalloc", workspace=f"{self.__ROOT_PATH}/KQMalloc/resource") + + def __init_func_dict(self): + self.__function_dict["Hyperscan"] = self.__install_hyperscan + self.__function_dict["Libgcrypt"] = self.__install_libgcrypt + res = Runcmd.sendcmd("lscpu | grep 'BIOS Model name:'") + if "Kunpeng" in res: + self.__function_dict["KAE"] = self.__install_kae + self.__function_dict["KQMalloc"] = self.__install_kqmalloc + elif "INTEL" in res: + self.__function_dict["QAT"] = self.__install_qat + elif "Hygon" in res: + self.__function_dict["HCT"] = self.__install_hct + else: + self.__function_dict["SOFT_COMPRESS"] = self.__install_compress_decompress_tools + + def get_support(self): + return ' '.join(self.__function_dict.keys()) + + def install(self, component): + self.__check_env() + + if "ALL" == component: + for func in self.__function_dict.values(): + try: + func() + except Exception as e: + print(e) + if not args.ignore: + raise e + else: + func = self.__function_dict.get(component) + if func: + func() + else: + raise "没有找到安装方法" + + +if __name__ == '__main__': + installer = Installer('version.xml') + supports = installer.get_support() + + parser = argparse.ArgumentParser() + parser.add_argument("--component", type=str, help=f"support component eg. [{supports}], default ALL", default='ALL') + parser.add_argument("-q", '--quiet', action='store_true', help="print quiet") + parser.add_argument('--ignore', action='store_true', + help="ignore error for each installing component while component is ALL") + parser.add_argument("-i", '--info', action='store_true') + args = parser.parse_args() + quiet = args.quiet + info_t = args.info + if info_t: + print(supports) + exit(0) + + installer.install(args.component) diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/requirements.txt b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/requirements.txt new file mode 100644 index 0000000..9a2a89e --- /dev/null +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/requirements.txt @@ -0,0 +1 @@ +argparse>=1.4.0 diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/version.xml b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/version.xml new file mode 100644 index 0000000..4e3436c --- /dev/null +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/version.xml @@ -0,0 +1,39 @@ + + + + 2.4.0 + https://repo.oepkgs.net/openEuler/rpm/{}/extras/aarch64/Packages/b/boostkit-ksl-{}-1.aarch64.rpm + + + 2.5.0 + https://repo.oepkgs.net/openEuler/rpm/{}/extras/aarch64/Packages/b/boostkit-hmpp-{}-1.aarch64.rpm + + + https://github.com/gperftools/gperftools.git + gperftools-2.16.90 + + + http://www.colm.net/files/ragel/ragel-6.10.tar.gz + https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz + https://sourceforge.net/projects/pcre/files/pcre/8.43/pcre-8.43.tar.gz + https://gitee.com/kunpengcompute/hyperscan.git + v5.4.2.aarch64 + https://github.com/intel/hyperscan.git + v5.4.2 + + + https://gitee.com/kunpengcompute/KAE.git + kae2 + + + https://downloadmirror.intel.com/843052/QAT20.L.1.2.30-00078.tar.gz + https://github.com/intel/QAT_Engine.git + v1.8.1 + https://github.com/intel/QATzip.git + v1.3.0 + + + https://gitee.com/anolis/hygon-devkit.git + hct_2.1.0.20241030_release + + diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml new file mode 100644 index 0000000..616e34e --- /dev/null +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml @@ -0,0 +1,5 @@ +- name: "[File] Transfer local file to remote host" + copy: + src: "BoostKit-AccLib" + dest: "{{ temp_dir }}" + tags: file_transfer diff --git a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml new file mode 100644 index 0000000..8c021c3 --- /dev/null +++ b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml @@ -0,0 +1,11 @@ +- name: "[Script] Get info and display" + shell: | + python3 {{ temp_dir }}/install.py -i + register: info_output + changed_when: false + tags: get_info + +- name: "[Script] Display execution output" + debug: + msg: "{{ info_output.stdout_lines }}" + tags: get_info diff --git a/plugins/boostkit/workspace/roles/check/tasks/main.yml b/plugins/boostkit/workspace/roles/check/tasks/main.yml new file mode 100644 index 0000000..af5d542 --- /dev/null +++ b/plugins/boostkit/workspace/roles/check/tasks/main.yml @@ -0,0 +1,69 @@ +- name: "[Check] Initialize check results" + set_fact: + check_results: [] + check_failed: "false" + +- name: "[CPU] Verify Kunpeng-920 processor" + shell: | + grep -m1 "CPU implementer" /proc/cpuinfo | awk '{print $4}' + register: cpu_implementer + changed_when: false + tags: hardware_check + +- name: "[CPU] Record CPU check result" + set_fact: + check_results: "{{ check_results + ['CPU implementer: ' + cpu_implementer.stdout] }}" + check_failed: "{{ check_failed or (cpu_implementer.stdout != '0x48') }}" + tags: hardware_check + +- name: "[Network] Test connectivity to Baidu" + ping: + host: www.baidu.com + timeout: 5 + register: network_test + ignore_errors: yes + changed_when: false + tags: network_check + +- name: "[Network] Record network check result" + set_fact: + check_results: "{{ check_results + ['Network test: ' + (network_test is failed | ternary('Failed', 'Success'))] }}" + check_failed: "{{ check_failed or (network_test is failed) }}" + tags: network_check + +- name: "[Python] Validate pip repository accessibility" + pip: + name: pip + index_url: "{{ pip_index_url | default('https://pypi.org/simple', true) }}" + extra_args: >- + --disable-pip-version-check + --timeout 30 + --retries 2 + state: present + when: pip_index_url is defined + register: pip_validation + ignore_errors: yes + changed_when: false + tags: python_check + +- name: "[Python] Record pip check result" + set_fact: + check_results: "{{ check_results + ['Pip repository: ' + (pip_validation is failed | ternary('Unavailable', 'Available'))] }}" + check_failed: "{{ check_failed or (pip_validation is failed) }}" + tags: python_check + +- name: "[Check] Display all check results" + debug: + msg: "{{ item }}" + loop: "{{ check_results }}" + when: check_failed + +- name: "[Check] Abort if any check failed" + fail: + msg: >- + Pre-deployment checks failed: + {% for result in check_results %} + - {{ result }} + {% endfor %} + Please fix the issues and try again. + when: check_failed -- Gitee From af470f6cd6c9138272cef9941c8ab80de3e92f88 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Tue, 8 Apr 2025 16:38:35 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8DYAML=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E9=94=99=E8=AF=AF=E5=B9=B6=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E8=BF=9E=E9=80=9A=E6=80=A7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正AccLib-show.yml和AccLib-install.yml中的roles缩进错误 - 将网络检查任务从ping模块改为uri模块,通过GET请求测试百度连通性 --- plugins/boostkit/workspace/AccLib-install.yml | 2 +- plugins/boostkit/workspace/AccLib-show.yml | 2 +- plugins/boostkit/workspace/roles/check/tasks/main.yml | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/boostkit/workspace/AccLib-install.yml b/plugins/boostkit/workspace/AccLib-install.yml index f7a11c8..c17d919 100644 --- a/plugins/boostkit/workspace/AccLib-install.yml +++ b/plugins/boostkit/workspace/AccLib-install.yml @@ -1,5 +1,5 @@ - hosts: all -- roles: + roles: - check - AccLib/prepare - AccLib/install diff --git a/plugins/boostkit/workspace/AccLib-show.yml b/plugins/boostkit/workspace/AccLib-show.yml index dd4e301..8c9ed12 100644 --- a/plugins/boostkit/workspace/AccLib-show.yml +++ b/plugins/boostkit/workspace/AccLib-show.yml @@ -1,5 +1,5 @@ - hosts: all -- roles: + roles: - check - AccLib/prepare - AccLib/show diff --git a/plugins/boostkit/workspace/roles/check/tasks/main.yml b/plugins/boostkit/workspace/roles/check/tasks/main.yml index af5d542..6d03b0c 100644 --- a/plugins/boostkit/workspace/roles/check/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/check/tasks/main.yml @@ -17,8 +17,9 @@ tags: hardware_check - name: "[Network] Test connectivity to Baidu" - ping: - host: www.baidu.com + uri: + url: https://www.baidu.com + method: GET timeout: 5 register: network_test ignore_errors: yes -- Gitee From ed1922025a35717a7cf4f9e2b73a9b367f76a407 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Tue, 8 Apr 2025 16:52:02 +0800 Subject: [PATCH 03/24] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=92=8C=E6=A3=80=E6=9F=A5=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 在config.yaml中添加ansible_ssh_common_args配置项,默认跳过SSH主机密钥校验 2. 重构网络连通性检查,改用curl命令替代uri模块,提供更详细的返回信息 3. 为pip仓库检查添加条件判断,仅在pip_index_url定义时执行 --- plugins/boostkit/config.yaml | 2 ++ .../workspace/roles/check/tasks/main.yml | 17 ++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/boostkit/config.yaml b/plugins/boostkit/config.yaml index 86f1700..6e34ef7 100644 --- a/plugins/boostkit/config.yaml +++ b/plugins/boostkit/config.yaml @@ -14,3 +14,5 @@ all: vars: pip_index_url: "https://mirrors.huaweicloud.com/repository/pypi/simple" temp_path: /tmp + # 跳过 ssh 校验(如需禁用此功能,请注释以下配置项) + ansible_ssh_common_args: '-o StrictHostKeyChecking=no' diff --git a/plugins/boostkit/workspace/roles/check/tasks/main.yml b/plugins/boostkit/workspace/roles/check/tasks/main.yml index 6d03b0c..7759fd7 100644 --- a/plugins/boostkit/workspace/roles/check/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/check/tasks/main.yml @@ -1,6 +1,6 @@ - name: "[Check] Initialize check results" set_fact: - check_results: [] + check_results: [ ] check_failed: "false" - name: "[CPU] Verify Kunpeng-920 processor" @@ -16,11 +16,11 @@ check_failed: "{{ check_failed or (cpu_implementer.stdout != '0x48') }}" tags: hardware_check -- name: "[Network] Test connectivity to Baidu" - uri: - url: https://www.baidu.com - method: GET - timeout: 5 +- name: "[Network] Test connectivity to Baidu using curl" + command: >- + curl -sSf --connect-timeout 5 + -w "HTTP %{http_code}" -o /dev/null + https://www.baidu.com register: network_test ignore_errors: yes changed_when: false @@ -28,7 +28,9 @@ - name: "[Network] Record network check result" set_fact: - check_results: "{{ check_results + ['Network test: ' + (network_test is failed | ternary('Failed', 'Success'))] }}" + check_results: >- + {{ check_results + ['Network test: ' + + (network_test is failed | ternary('Failed', 'Success (' + network_test.stdout + ')'))] }} check_failed: "{{ check_failed or (network_test is failed) }}" tags: network_check @@ -51,6 +53,7 @@ set_fact: check_results: "{{ check_results + ['Pip repository: ' + (pip_validation is failed | ternary('Unavailable', 'Available'))] }}" check_failed: "{{ check_failed or (pip_validation is failed) }}" + when: pip_index_url is defined tags: python_check - name: "[Check] Display all check results" -- Gitee From bd44dfe06ec1b7a27255fdd05c78f918f229d6ea Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 9 Apr 2025 10:07:31 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=E4=BC=98=E5=8C=96AccLib=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E8=84=9A=E6=9C=AC=E5=B9=B6=E6=B7=BB=E5=8A=A0=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E9=85=8D=E7=BD=AE=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 在config.yaml中添加HTTP/HTTPS代理配置选项 2. 修改安装脚本路径引用方式,使用chdir参数指定工作目录 3. 添加python3-libselinux依赖安装任务 4. 将temp_dir变量统一更名为temp_path 5. 优化Boost库安装方式,改为直接使用yum安装 6. 调整文件传输路径与安装脚本工作目录保持一致 --- plugins/boostkit/config.yaml | 3 +++ .../workspace/roles/AccLib/install/tasks/main.yml | 4 +++- .../roles/AccLib/prepare/files/BoostKit-AccLib/install.py | 3 +-- .../workspace/roles/AccLib/prepare/tasks/main.yml | 8 +++++++- .../boostkit/workspace/roles/AccLib/show/tasks/main.yml | 4 +++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/boostkit/config.yaml b/plugins/boostkit/config.yaml index 6e34ef7..2f5ad8f 100644 --- a/plugins/boostkit/config.yaml +++ b/plugins/boostkit/config.yaml @@ -5,6 +5,9 @@ all: ansible_port: 22 ansible_user: root ansible_password: "" + # 按实际代理需要添加 + # http_proxy: + # https_proxy: children: AccLib: hosts: diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml index b8b267c..28cbffe 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -1,6 +1,8 @@ - name: "[Script] Execute install script" shell: | - python3 {{ temp_dir }}/install.py --component {{ item }} + python3 install.py --component {{ item }} + args: + chdir: {{ temp_path }}/BoostKit-AccLib changed_when: false tags: install loop: "{{ install_list | default([]) | list }}" diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py index dae80b1..a745ec6 100644 --- a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py @@ -162,8 +162,7 @@ class Installer(object): download = info.get("boost") bag = info.get("boost").split('/')[-1] - Runcmd.sendcmd(f"wget {download} --no-check-certificate", workspace=f"{self.__ROOT_PATH}/Hyperscan") - Runcmd.sendcmd(f"tar -zxf {bag}", workspace=f"{self.__ROOT_PATH}/Hyperscan") + Runcmd.sendcmd(f"yum install -y boost boost-devel") with self.__process("安装pcre"): download = info.get("pcre") diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml index 616e34e..f49bd6f 100644 --- a/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml @@ -1,5 +1,11 @@ +- name: "[Dependency] Install python3-libselinux" + yum: + name: python3-libselinux + state: present + tags: dependency + - name: "[File] Transfer local file to remote host" copy: src: "BoostKit-AccLib" - dest: "{{ temp_dir }}" + dest: "{{ temp_path }}" tags: file_transfer diff --git a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml index 8c021c3..6798bf6 100644 --- a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml @@ -1,6 +1,8 @@ - name: "[Script] Get info and display" shell: | - python3 {{ temp_dir }}/install.py -i + python3 install.py -i + args: + chdir: {{ temp_path }}/BoostKit-AccLib register: info_output changed_when: false tags: get_info -- Gitee From 59982a6efa6328819abc0f3f5eb4464b73f63094 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 9 Apr 2025 10:11:41 +0800 Subject: [PATCH 05/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8DYAML=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=ADchdir=E5=8F=82=E6=95=B0=E7=9A=84=E5=BC=95=E5=8F=B7?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在AccLib安装和显示任务中,为chdir参数添加缺失的双引号,确保路径变量正确解析 --- plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml | 2 +- plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml index 28cbffe..81bd616 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -2,7 +2,7 @@ shell: | python3 install.py --component {{ item }} args: - chdir: {{ temp_path }}/BoostKit-AccLib + chdir: "{{ temp_path }}/BoostKit-AccLib" changed_when: false tags: install loop: "{{ install_list | default([]) | list }}" diff --git a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml index 6798bf6..e4aee32 100644 --- a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml @@ -2,7 +2,7 @@ shell: | python3 install.py -i args: - chdir: {{ temp_path }}/BoostKit-AccLib + chdir: "{{ temp_path }}/BoostKit-AccLib" register: info_output changed_when: false tags: get_info -- Gitee From 316baad2b9e19e7979052730e177c16f4427bf1e Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 9 Apr 2025 10:18:34 +0800 Subject: [PATCH 06/24] =?UTF-8?q?=E6=9B=B4=E6=96=B0config.yaml=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E7=9A=84=E4=BB=A3=E7=90=86=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/boostkit/config.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/boostkit/config.yaml b/plugins/boostkit/config.yaml index 2f5ad8f..0bb4055 100644 --- a/plugins/boostkit/config.yaml +++ b/plugins/boostkit/config.yaml @@ -6,8 +6,9 @@ all: ansible_user: root ansible_password: "" # 按实际代理需要添加 - # http_proxy: - # https_proxy: + # proxy_env: + # http_proxy: + # https_proxy: children: AccLib: hosts: -- Gitee From a49ab1c38978faa31d7c51f145bbf57eb3186ec7 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 9 Apr 2025 10:20:47 +0800 Subject: [PATCH 07/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E9=85=8D=E7=BD=AE=E5=88=B0?= =?UTF-8?q?AccLib=E7=9B=B8=E5=85=B3YAML=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在AccLib-show.yml和AccLib-install.yml中添加environments字段,支持通过proxy_env变量配置代理环境,默认为空对象。 --- plugins/boostkit/workspace/AccLib-install.yml | 1 + plugins/boostkit/workspace/AccLib-show.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/boostkit/workspace/AccLib-install.yml b/plugins/boostkit/workspace/AccLib-install.yml index c17d919..2957d9c 100644 --- a/plugins/boostkit/workspace/AccLib-install.yml +++ b/plugins/boostkit/workspace/AccLib-install.yml @@ -1,4 +1,5 @@ - hosts: all + environments: "{{ proxy_env | default({}) }}" roles: - check - AccLib/prepare diff --git a/plugins/boostkit/workspace/AccLib-show.yml b/plugins/boostkit/workspace/AccLib-show.yml index 8c9ed12..6132fc0 100644 --- a/plugins/boostkit/workspace/AccLib-show.yml +++ b/plugins/boostkit/workspace/AccLib-show.yml @@ -1,4 +1,5 @@ - hosts: all + environments: "{{ proxy_env | default({}) }}" roles: - check - AccLib/prepare -- Gitee From 40af5e048460bfa79b9b32e3a10468593849f44b Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 9 Apr 2025 10:22:40 +0800 Subject: [PATCH 08/24] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAccLib=20YAML=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E7=9A=84environment=E6=8B=BC=E5=86=99?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/boostkit/workspace/AccLib-install.yml | 2 +- plugins/boostkit/workspace/AccLib-show.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/boostkit/workspace/AccLib-install.yml b/plugins/boostkit/workspace/AccLib-install.yml index 2957d9c..274e427 100644 --- a/plugins/boostkit/workspace/AccLib-install.yml +++ b/plugins/boostkit/workspace/AccLib-install.yml @@ -1,5 +1,5 @@ - hosts: all - environments: "{{ proxy_env | default({}) }}" + environment: "{{ proxy_env | default({}) }}" roles: - check - AccLib/prepare diff --git a/plugins/boostkit/workspace/AccLib-show.yml b/plugins/boostkit/workspace/AccLib-show.yml index 6132fc0..ffa7beb 100644 --- a/plugins/boostkit/workspace/AccLib-show.yml +++ b/plugins/boostkit/workspace/AccLib-show.yml @@ -1,5 +1,5 @@ - hosts: all - environments: "{{ proxy_env | default({}) }}" + environment: "{{ proxy_env | default({}) }}" roles: - check - AccLib/prepare -- Gitee From 437a4b158b3eca99d34a1d8d1eed52f66e957884 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 9 Apr 2025 16:54:29 +0800 Subject: [PATCH 09/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=80=89=E9=A1=B9=E5=B9=B6=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E4=BB=BB=E5=8A=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 主要变更: 1. 在config.yaml中添加skip_check配置项,默认为false 2. 在检查任务前添加条件判断,当skip_check为true时跳过所有检查 3. 将原有检查任务封装在block中,仅在skip_check为false时执行 --- plugins/boostkit/config.yaml | 1 + .../workspace/roles/check/tasks/main.yml | 142 ++++++++++-------- 2 files changed, 78 insertions(+), 65 deletions(-) diff --git a/plugins/boostkit/config.yaml b/plugins/boostkit/config.yaml index 0bb4055..7d4c324 100644 --- a/plugins/boostkit/config.yaml +++ b/plugins/boostkit/config.yaml @@ -16,6 +16,7 @@ all: vars: install_list: [] vars: + skip_check: false pip_index_url: "https://mirrors.huaweicloud.com/repository/pypi/simple" temp_path: /tmp # 跳过 ssh 校验(如需禁用此功能,请注释以下配置项) diff --git a/plugins/boostkit/workspace/roles/check/tasks/main.yml b/plugins/boostkit/workspace/roles/check/tasks/main.yml index 7759fd7..799c66d 100644 --- a/plugins/boostkit/workspace/roles/check/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/check/tasks/main.yml @@ -1,73 +1,85 @@ -- name: "[Check] Initialize check results" - set_fact: - check_results: [ ] - check_failed: "false" +- name: "[Check] Skip all checks if skip_check is true" + debug: + msg: "Skipping all checks" + when: > + skip_check is defined and + (skip_check == true or skip_check | string == "true") + tags: never -- name: "[CPU] Verify Kunpeng-920 processor" - shell: | - grep -m1 "CPU implementer" /proc/cpuinfo | awk '{print $4}' - register: cpu_implementer - changed_when: false - tags: hardware_check +- block: + - name: "[Check] Initialize check results" + set_fact: + check_results: [ ] + check_failed: "false" -- name: "[CPU] Record CPU check result" - set_fact: - check_results: "{{ check_results + ['CPU implementer: ' + cpu_implementer.stdout] }}" - check_failed: "{{ check_failed or (cpu_implementer.stdout != '0x48') }}" - tags: hardware_check + - name: "[CPU] Verify Kunpeng-920 processor" + shell: | + grep -m1 "CPU implementer" /proc/cpuinfo | awk '{print $4}' + register: cpu_implementer + changed_when: false + tags: hardware_check -- name: "[Network] Test connectivity to Baidu using curl" - command: >- - curl -sSf --connect-timeout 5 - -w "HTTP %{http_code}" -o /dev/null - https://www.baidu.com - register: network_test - ignore_errors: yes - changed_when: false - tags: network_check + - name: "[CPU] Record CPU check result" + set_fact: + check_results: "{{ check_results + ['CPU implementer: ' + cpu_implementer.stdout] }}" + check_failed: "{{ check_failed or (cpu_implementer.stdout != '0x48') }}" + tags: hardware_check -- name: "[Network] Record network check result" - set_fact: - check_results: >- - {{ check_results + ['Network test: ' + - (network_test is failed | ternary('Failed', 'Success (' + network_test.stdout + ')'))] }} - check_failed: "{{ check_failed or (network_test is failed) }}" - tags: network_check + - name: "[Network] Test connectivity to Baidu using curl" + command: >- + curl -sSf --connect-timeout 5 + -w "HTTP %{http_code}" -o /dev/null + https://www.baidu.com + register: network_test + ignore_errors: yes + changed_when: false + tags: network_check -- name: "[Python] Validate pip repository accessibility" - pip: - name: pip - index_url: "{{ pip_index_url | default('https://pypi.org/simple', true) }}" - extra_args: >- - --disable-pip-version-check - --timeout 30 - --retries 2 - state: present - when: pip_index_url is defined - register: pip_validation - ignore_errors: yes - changed_when: false - tags: python_check + - name: "[Network] Record network check result" + set_fact: + check_results: >- + {{ check_results + ['Network test: ' + + (network_test is failed | ternary('Failed', 'Success (' + network_test.stdout + ')'))] }} + check_failed: "{{ check_failed or (network_test is failed) }}" + tags: network_check -- name: "[Python] Record pip check result" - set_fact: - check_results: "{{ check_results + ['Pip repository: ' + (pip_validation is failed | ternary('Unavailable', 'Available'))] }}" - check_failed: "{{ check_failed or (pip_validation is failed) }}" - when: pip_index_url is defined - tags: python_check + - name: "[Python] Validate pip repository accessibility" + pip: + name: pip + index_url: "{{ pip_index_url | default('https://pypi.org/simple', true) }}" + extra_args: >- + --disable-pip-version-check + --timeout 30 + --retries 2 + state: present + when: pip_index_url is defined + register: pip_validation + ignore_errors: yes + changed_when: false + tags: python_check -- name: "[Check] Display all check results" - debug: - msg: "{{ item }}" - loop: "{{ check_results }}" - when: check_failed + - name: "[Python] Record pip check result" + set_fact: + check_results: "{{ check_results + ['Pip repository: ' + (pip_validation is failed | ternary('Unavailable', 'Available'))] }}" + check_failed: "{{ check_failed or (pip_validation is failed) }}" + when: pip_index_url is defined + tags: python_check + + - name: "[Check] Display all check results" + debug: + msg: "{{ item }}" + loop: "{{ check_results }}" + when: check_failed -- name: "[Check] Abort if any check failed" - fail: - msg: >- - Pre-deployment checks failed: - {% for result in check_results %} - - {{ result }} - {% endfor %} - Please fix the issues and try again. - when: check_failed + - name: "[Check] Abort if any check failed" + fail: + msg: >- + Pre-deployment checks failed: + {% for result in check_results %} + - {{ result }} + {% endfor %} + Please fix the issues and try again. + when: check_failed + when: > + skip_check is not defined or + (skip_check != true and skip_check | string != "true") -- Gitee From 70d009dfbf595dc60fb6c2e28e1ac40cb4d04304 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 9 Apr 2025 17:10:37 +0800 Subject: [PATCH 10/24] =?UTF-8?q?=E4=BC=98=E5=8C=96pip=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E9=AA=8C=E8=AF=81=E5=B9=B6=E9=87=8D=E6=9E=84?= =?UTF-8?q?AccLib=E8=84=9A=E6=9C=AC=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将pip仓库URL参数从index_url迁移至extra_args - 将BoostKit-AccLib相关脚本文件(install.py/requirements.txt/version.xml)移动到scripts子目录下 --- .../prepare/files/BoostKit-AccLib/{ => scripts}/install.py | 0 .../files/BoostKit-AccLib/{ => scripts}/requirements.txt | 0 .../prepare/files/BoostKit-AccLib/{ => scripts}/version.xml | 0 plugins/boostkit/workspace/roles/check/tasks/main.yml | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) rename plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/{ => scripts}/install.py (100%) rename plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/{ => scripts}/requirements.txt (100%) rename plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/{ => scripts}/version.xml (100%) diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py similarity index 100% rename from plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/install.py rename to plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/requirements.txt b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/requirements.txt similarity index 100% rename from plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/requirements.txt rename to plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/requirements.txt diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/version.xml b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml similarity index 100% rename from plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/version.xml rename to plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml diff --git a/plugins/boostkit/workspace/roles/check/tasks/main.yml b/plugins/boostkit/workspace/roles/check/tasks/main.yml index 799c66d..152f398 100644 --- a/plugins/boostkit/workspace/roles/check/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/check/tasks/main.yml @@ -46,8 +46,8 @@ - name: "[Python] Validate pip repository accessibility" pip: name: pip - index_url: "{{ pip_index_url | default('https://pypi.org/simple', true) }}" extra_args: >- + -i "{{ pip_index_url | default('https://pypi.org/simple', true) }}" --disable-pip-version-check --timeout 30 --retries 2 -- Gitee From 183193ea7be3f12a314ef7b1988fbb2c8d94caf8 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Thu, 10 Apr 2025 09:38:42 +0800 Subject: [PATCH 11/24] =?UTF-8?q?=E6=9B=B4=E6=96=B0AccLib=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=92=8C=E6=98=BE=E7=A4=BA=E4=BB=BB=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将BoostKit-AccLib的安装和显示任务中的工作目录路径从`temp_path/BoostKit-AccLib`修改为`temp_path/scripts/BoostKit-AccLib`,以匹配新的项目目录结构。 --- plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml | 2 +- plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml index 81bd616..ccf6107 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -2,7 +2,7 @@ shell: | python3 install.py --component {{ item }} args: - chdir: "{{ temp_path }}/BoostKit-AccLib" + chdir: "{{ temp_path }}/scripts/BoostKit-AccLib" changed_when: false tags: install loop: "{{ install_list | default([]) | list }}" diff --git a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml index e4aee32..21e94b0 100644 --- a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml @@ -2,7 +2,7 @@ shell: | python3 install.py -i args: - chdir: "{{ temp_path }}/BoostKit-AccLib" + chdir: "{{ temp_path }}/scripts/BoostKit-AccLib" register: info_output changed_when: false tags: get_info -- Gitee From 0e946a7d2af17f1289711ef9ad6e6722b7049f9c Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Thu, 10 Apr 2025 09:39:54 +0800 Subject: [PATCH 12/24] =?UTF-8?q?=E6=9B=B4=E6=96=B0AccLib=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=92=8C=E6=98=BE=E7=A4=BA=E4=BB=BB=E5=8A=A1=E7=9A=84?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将BoostKit-AccLib脚本路径从`scripts/BoostKit-AccLib`调整为`BoostKit-AccLib/scripts`,确保任务能正确找到安装脚本。 --- plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml | 2 +- plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml index ccf6107..e02d5a8 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -2,7 +2,7 @@ shell: | python3 install.py --component {{ item }} args: - chdir: "{{ temp_path }}/scripts/BoostKit-AccLib" + chdir: "{{ temp_path }}/BoostKit-AccLib/scripts" changed_when: false tags: install loop: "{{ install_list | default([]) | list }}" diff --git a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml index 21e94b0..5652f83 100644 --- a/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/show/tasks/main.yml @@ -2,7 +2,7 @@ shell: | python3 install.py -i args: - chdir: "{{ temp_path }}/scripts/BoostKit-AccLib" + chdir: "{{ temp_path }}/BoostKit-AccLib/scripts" register: info_output changed_when: false tags: get_info -- Gitee From 81954ed61d872022d1f937faacbcd5adb6b069a6 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Thu, 10 Apr 2025 14:36:27 +0800 Subject: [PATCH 13/24] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=92=8C=E5=AE=89=E8=A3=85=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=BC=BA=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=92=8C=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 更新config.yaml文件,添加注释说明,优化配置项组织方式 2. 重构安装任务流程,增加时间戳日志记录和详细的执行结果反馈 3. 添加目标目录检查步骤,确保文件传输前目录存在 --- plugins/boostkit/config.yaml | 12 +++++-- .../roles/AccLib/install/tasks/main.yml | 32 +++++++++++++++---- .../roles/AccLib/prepare/tasks/main.yml | 6 ++++ 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/plugins/boostkit/config.yaml b/plugins/boostkit/config.yaml index 7d4c324..9628b1c 100644 --- a/plugins/boostkit/config.yaml +++ b/plugins/boostkit/config.yaml @@ -5,19 +5,25 @@ all: ansible_port: 22 ansible_user: root ansible_password: "" - # 按实际代理需要添加 + # 按实际代理需要添加,如需全局使用代理请移动至 all:vars # proxy_env: # http_proxy: # https_proxy: + # 可在此添加更多主机 children: AccLib: hosts: host1: + # 可在此包含更多主机 vars: - install_list: [] + install_list: + - 'ALL' vars: + # 跳过所有基本检查项 skip_check: false + # pip 源地址,如不涉及 pip 安装可删除此项 pip_index_url: "https://mirrors.huaweicloud.com/repository/pypi/simple" + # 临时文件存放目录 temp_path: /tmp - # 跳过 ssh 校验(如需禁用此功能,请注释以下配置项) + # 跳过 ssh 校验,如需禁用此功能,请删除以下配置项 ansible_ssh_common_args: '-o StrictHostKeyChecking=no' diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml index e02d5a8..d9af1bf 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -1,9 +1,27 @@ - name: "[Script] Execute install script" - shell: | - python3 install.py --component {{ item }} - args: - chdir: "{{ temp_path }}/BoostKit-AccLib/scripts" - changed_when: false - tags: install - loop: "{{ install_list | default([]) | list }}" + block: + - name: Get timestamp + command: date +%Y%m%d%H%M%S + register: timestamp + changed_when: false + + - name: Execute install script for {{ item }} + shell: | + python3 install.py --component {{ item }} > {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log 2>&1 + args: + chdir: "{{ temp_path }}/BoostKit-AccLib/scripts" + register: install_result + changed_when: false + tags: install + + - name: Show execution result + debug: + msg: "Installation completed for {{ item }}. Log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log" + when: install_result is succeeded + + - name: Fail if installation failed + fail: + msg: "Installation failed for {{ item }}. Check log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log" + when: install_result is failed + loop: "{{ install_list | default(['ALL'], true) | list }}" when: install_list is defined and install_list | length > 0 diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml index f49bd6f..9597ff1 100644 --- a/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/tasks/main.yml @@ -4,6 +4,12 @@ state: present tags: dependency +- name: "[File] Ensure destination directory exists" + file: + path: "{{ temp_path }}" + state: directory + tags: file_transfer + - name: "[File] Transfer local file to remote host" copy: src: "BoostKit-AccLib" -- Gitee From 89052513fa7e8bfa84f5a2de048f4d919b4ba54f Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Thu, 10 Apr 2025 14:48:32 +0800 Subject: [PATCH 14/24] =?UTF-8?q?=E9=87=8D=E6=9E=84AccLib=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E4=BB=BB=E5=8A=A1=EF=BC=8C=E5=B0=86=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=8F=90=E5=8F=96=E5=88=B0=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将main.yml中的安装任务块提取到独立的execute_install.yml文件中,使用include_tasks引入 --- .../AccLib/install/tasks/execute_install.yml | 23 +++++++++++++++++ .../roles/AccLib/install/tasks/main.yml | 25 +------------------ 2 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml new file mode 100644 index 0000000..49a1ac1 --- /dev/null +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml @@ -0,0 +1,23 @@ +- name: Get timestamp + command: date +%Y%m%d%H%M%S + register: timestamp + changed_when: false + +- name: Execute install script for {{ item }} + shell: | + python3 install.py --component {{ item }} > {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log 2>&1 + args: + chdir: "{{ temp_path }}/BoostKit-AccLib/scripts" + register: install_result + changed_when: false + tags: install + +- name: Show execution result + debug: + msg: "Installation completed for {{ item }}. Log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log" + when: install_result is succeeded + +- name: Fail if installation failed + fail: + msg: "Installation failed for {{ item }}. Check log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log" + when: install_result is failed diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml index d9af1bf..e6a5a91 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -1,27 +1,4 @@ - name: "[Script] Execute install script" - block: - - name: Get timestamp - command: date +%Y%m%d%H%M%S - register: timestamp - changed_when: false - - - name: Execute install script for {{ item }} - shell: | - python3 install.py --component {{ item }} > {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log 2>&1 - args: - chdir: "{{ temp_path }}/BoostKit-AccLib/scripts" - register: install_result - changed_when: false - tags: install - - - name: Show execution result - debug: - msg: "Installation completed for {{ item }}. Log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log" - when: install_result is succeeded - - - name: Fail if installation failed - fail: - msg: "Installation failed for {{ item }}. Check log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log" - when: install_result is failed + include_tasks: install_block.yml loop: "{{ install_list | default(['ALL'], true) | list }}" when: install_list is defined and install_list | length > 0 -- Gitee From de183eccaeb7f623ffd1cfb67d1c38b90fefc3e5 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Thu, 10 Apr 2025 14:53:34 +0800 Subject: [PATCH 15/24] =?UTF-8?q?=E6=9B=B4=E6=96=B0AccLib=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E4=BB=BB=E5=8A=A1=E4=BB=A5=E4=BD=BF=E7=94=A8=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E6=89=A7=E8=A1=8C=E8=84=9A=E6=9C=AC=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将安装任务引用的脚本文件从install_block.yml更改为execute_install.yml,保持循环逻辑和条件判断不变。 --- plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml index e6a5a91..dc529b0 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -1,4 +1,4 @@ - name: "[Script] Execute install script" - include_tasks: install_block.yml + include_tasks: execute_install.yml loop: "{{ install_list | default(['ALL'], true) | list }}" when: install_list is defined and install_list | length > 0 -- Gitee From 1b7f2e8113b80eca95b1549dce5b1427b9ae115a Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Thu, 10 Apr 2025 15:12:08 +0800 Subject: [PATCH 16/24] =?UTF-8?q?=E5=9C=A8AccLib=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=B8=AD=E6=B7=BB=E5=8A=A0ignore=5Ferrors?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E4=BB=A5=E5=BF=BD=E7=95=A5=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改execute_install.yml文件,在安装任务中添加ignore_errors: true参数,使安装过程即使遇到错误也能继续执行后续步骤。 --- .../workspace/roles/AccLib/install/tasks/execute_install.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml index 49a1ac1..d2a4a00 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml @@ -10,6 +10,7 @@ chdir: "{{ temp_path }}/BoostKit-AccLib/scripts" register: install_result changed_when: false + ignore_errors: true tags: install - name: Show execution result -- Gitee From 3bf7cbdb0303f6bac0e4e53a1465a9d6f0f2828b Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Thu, 10 Apr 2025 19:23:39 +0800 Subject: [PATCH 17/24] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E5=B9=B6=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=8C=85=E4=B8=8B=E8=BD=BD=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除tcmalloc和测试集的安装步骤,简化安装流程 - 修改Hyperscan依赖包(pcre/ragel)的下载地址为国内镜像源 - 改进组件安装逻辑,支持同时安装多个组件 - 优化boost库路径处理,直接使用系统路径 - 添加更友好的命令行参数提示信息 - 修复环境变量检查时的命令执行选项 --- .../files/BoostKit-AccLib/scripts/install.py | 71 ++++++------------- .../files/BoostKit-AccLib/scripts/version.xml | 6 +- 2 files changed, 23 insertions(+), 54 deletions(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py index a745ec6..f04643a 100644 --- a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py @@ -91,7 +91,7 @@ class Installer(object): if libpath and value in libpath: return True - env_list = Runcmd.sendcmd(f"cat /etc/profile | grep {key}").split("\n") + env_list = Runcmd.sendcmd(f"cat /etc/profile | grep {key}", check=False).split("\n") for env in env_list: if value in env and not re.search("#.+export", env): return True @@ -159,10 +159,7 @@ class Installer(object): Runcmd.sendcmd(f"ragel -v") with self.__process("安装boost"): - download = info.get("boost") - bag = info.get("boost").split('/')[-1] - - Runcmd.sendcmd(f"yum install -y boost boost-devel") + Runcmd.sendcmd("yum install -y boost boost-devel") with self.__process("安装pcre"): download = info.get("pcre") @@ -177,14 +174,6 @@ class Installer(object): assert "-lsqlite3" in stdout, "安装sqlite失败" Runcmd.sendcmd("yum install -y cmake make gcc gcc-c++") - with self.__process("下载测试集"): - Runcmd.sendcmd("wget https://cdrdv2.intel.com/v1/dl/getContent/739375 --no-check-certificate", - workspace=f"{self.__ROOT_PATH}/Hyperscan") - Runcmd.sendcmd("unzip 739375 && mv '[Hyperscan] hsbench-samples' hsbench-samples", - workspace=f"{self.__ROOT_PATH}/Hyperscan") - Runcmd.sendcmd(f"cp ./2_suricata_rule_hs_9.txt {self.__ROOT_PATH}/Hyperscan/hsbench-samples/pcres", - workspace=f"{self.__ROOT_PATH}/resources/hsbench-samples") - def __install_hyperscan(self): self.__install_hyperscan_dep() @@ -208,8 +197,7 @@ class Installer(object): else: Runcmd.sendcmd(f"git clone {download} -b {branch}", workspace=f"{self.__ROOT_PATH}/Hyperscan") - boost_path = Runcmd.sendcmd("ls | grep boost | grep -v tar", workspace=f"{self.__ROOT_PATH}/Hyperscan") - boost_path = f"{self.__ROOT_PATH}/Hyperscan/{boost_path}" + boost_path = "/usr/include" Runcmd.sendcmd(f"ln -s {boost_path}/boost include/boost", workspace=f"{self.__ROOT_PATH}/Hyperscan/{dir}") pcre_path = Runcmd.sendcmd("ls | grep pcre | grep -v tar", workspace=f"{self.__ROOT_PATH}/Hyperscan") @@ -427,33 +415,6 @@ class Installer(object): ksl_version = re.search("boostkit-ksl-(\d+.\d+.\d+)", res).group(1) assert check_version(ksl_version, "2.4.0"), "ksl版本过低,请指定2.4.0以上版本" - with self.__process("安装tcmalloc"): - Runcmd.sendcmd("yum install -y jemalloc-devel jemalloc") - - with self.__process("编译安装tcmalloc"): - tcmalloc_info = self.__get_element_text("Tcmalloc") - download = tcmalloc_info.get("code") - branch = tcmalloc_info.get("branch") - dir = download.split('/')[-1].split('.')[0] - - Runcmd.sendcmd("rm -rf /opt/tcmalloc") - Runcmd.sendcmd(f"git clone {download} -b {branch} --depth=1", - workspace=f"{self.__ROOT_PATH}/KQMalloc/resource") - Runcmd.sendcmd( - './autogen.sh && ./configure --prefix=/opt/tcmalloc CFLAGS=" -O3 -march=armv8.2-a " CXXFLAGS=" -O3 -march=armv8.2-a "', - workspace=f"{self.__ROOT_PATH}/KQMalloc/resource/{dir}") - Runcmd.sendcmd("make -j && make install", workspace=f"{self.__ROOT_PATH}/KQMalloc/resource/{dir}") - - with self.__process("安装KQMalloc benchmark"): - Runcmd.sendcmd(f"cp -r ./* {self.__ROOT_PATH}/KQMalloc/resource", - workspace=f"{self.__ROOT_PATH}/resources/benchmark") - if check_version(ksl_version, "2.5.0", "<"): - Runcmd.sendcmd("sed -i 's/-lkqmalloc/-lkqmallocmt/g' Makefile", - workspace=f"{self.__ROOT_PATH}/KQMalloc/resource") - - Runcmd.sendcmd("make", workspace=f"{self.__ROOT_PATH}/KQMalloc/resource") - Runcmd.sendcmd(f"mv ./bin_* {self.__ROOT_PATH}/KQMalloc", workspace=f"{self.__ROOT_PATH}/KQMalloc/resource") - def __init_func_dict(self): self.__function_dict["Hyperscan"] = self.__install_hyperscan self.__function_dict["Libgcrypt"] = self.__install_libgcrypt @@ -471,10 +432,10 @@ class Installer(object): def get_support(self): return ' '.join(self.__function_dict.keys()) - def install(self, component): + def install(self, components): self.__check_env() - if "ALL" == component: + if "ALL" == components: for func in self.__function_dict.values(): try: func() @@ -483,11 +444,17 @@ class Installer(object): if not args.ignore: raise e else: - func = self.__function_dict.get(component) - if func: - func() - else: - raise "没有找到安装方法" + for component in components.split(): + func = self.__function_dict.get(component) + if func: + try: + func() + except Exception as e: + print(e) + if not args.ignore: + raise e + else: + raise f"没有找到安装方法, {component}" if __name__ == '__main__': @@ -495,11 +462,13 @@ if __name__ == '__main__': supports = installer.get_support() parser = argparse.ArgumentParser() - parser.add_argument("--component", type=str, help=f"support component eg. [{supports}], default ALL", default='ALL') + parser.add_argument("--component", type=str, + help=f"support component eg. ALL | component | 'component1 component2...', default ALL", + default='ALL') parser.add_argument("-q", '--quiet', action='store_true', help="print quiet") parser.add_argument('--ignore', action='store_true', help="ignore error for each installing component while component is ALL") - parser.add_argument("-i", '--info', action='store_true') + parser.add_argument("-i", '--info', action='store_true', help="check supported components") args = parser.parse_args() quiet = args.quiet info_t = args.info diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml index 4e3436c..d9419a2 100644 --- a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml @@ -13,9 +13,9 @@ gperftools-2.16.90 - http://www.colm.net/files/ragel/ragel-6.10.tar.gz + https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/ragel-6.10.tar.gz https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz - https://sourceforge.net/projects/pcre/files/pcre/8.43/pcre-8.43.tar.gz + https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/pcre-8.43.tar.gz https://gitee.com/kunpengcompute/hyperscan.git v5.4.2.aarch64 https://github.com/intel/hyperscan.git @@ -36,4 +36,4 @@ https://gitee.com/anolis/hygon-devkit.git hct_2.1.0.20241030_release - + \ No newline at end of file -- Gitee From c5a624bbf1409415ff14239a08b625329eeecfd8 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Tue, 15 Apr 2025 16:06:43 +0800 Subject: [PATCH 18/24] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E5=8E=8B=E7=BC=A9=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E5=87=BD=E6=95=B0=E5=92=8CTcmalloc=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除install.py中不再需要的__install_compress_decompress_tools()调用 - 移除version.xml中已废弃的Tcmalloc组件配置项 --- .../AccLib/prepare/files/BoostKit-AccLib/scripts/install.py | 2 -- .../AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml | 4 ---- 2 files changed, 6 deletions(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py index f04643a..4c87437 100644 --- a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py @@ -292,8 +292,6 @@ class Installer(object): print("成功安装KAE, 已经添加必要环境变量, 执行source /etc/profile使能") - self.__install_compress_decompress_tools() - def __install_libgcrypt_dep(self): with self.__process("安装libgcrypt相关依赖"): Runcmd.sendcmd("yum install -y texinfo transfig hwloc hwloc-devel autoconf automake") diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml index d9419a2..7af9504 100644 --- a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/version.xml @@ -8,10 +8,6 @@ 2.5.0 https://repo.oepkgs.net/openEuler/rpm/{}/extras/aarch64/Packages/b/boostkit-hmpp-{}-1.aarch64.rpm - - https://github.com/gperftools/gperftools.git - gperftools-2.16.90 - https://repo.oepkgs.net/openEuler/rpm/openEuler-24.03-LTS/contrib/oedp/files/ragel-6.10.tar.gz https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz -- Gitee From a4fe48e33e3fcc0bf810fe14be0bd4cc62e7f734 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 16 Apr 2025 15:57:38 +0800 Subject: [PATCH 19/24] =?UTF-8?q?=E4=BC=98=E5=8C=96AccLib=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E4=BB=BB=E5=8A=A1=E4=B8=AD=E7=9A=84=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 简化并重构了install_list的条件判断逻辑,使用更简洁的表达式来处理各种输入情况: 1. 当install_list未定义或为空时,默认使用['ALL'] 2. 当install_list为字符串时,转换为单元素列表 3. 当install_list为可迭代对象时直接使用 --- plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml index dc529b0..525a999 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/main.yml @@ -1,4 +1,3 @@ - name: "[Script] Execute install script" include_tasks: execute_install.yml - loop: "{{ install_list | default(['ALL'], true) | list }}" - when: install_list is defined and install_list | length > 0 + loop: "{{ (install_list if install_list is defined and (install_list is iterable and not install_list is string) else [install_list]) if install_list is defined and install_list | length > 0 else ['ALL'] }}" -- Gitee From c84f4c20509ea420363e476efb63f6a042b509ad Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 16 Apr 2025 16:05:36 +0800 Subject: [PATCH 20/24] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC=EF=BC=8C=E5=B0=86=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=88=86=E9=9A=94=E7=AC=A6=E4=BB=8E=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E9=80=97=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 该变更将install.py脚本中组件名称的分隔方式从空格分隔改为逗号分隔,提高了组件列表的可读性和易用性。当用户输入多个组件时,现在需要使用逗号而非空格作为分隔符。 --- .../AccLib/prepare/files/BoostKit-AccLib/scripts/install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py index 4c87437..c6c0abb 100644 --- a/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py +++ b/plugins/boostkit/workspace/roles/AccLib/prepare/files/BoostKit-AccLib/scripts/install.py @@ -442,7 +442,7 @@ class Installer(object): if not args.ignore: raise e else: - for component in components.split(): + for component in components.split(','): func = self.__function_dict.get(component) if func: try: -- Gitee From 6c0244df755070c52d09ad1a89dd4cdd6a6719c7 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 16 Apr 2025 16:15:56 +0800 Subject: [PATCH 21/24] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=B5=81=E7=A8=8B=EF=BC=8C=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=86=97=E4=BD=99=E7=9A=84=E8=B0=83=E8=AF=95=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 该提交移除了在检查失败时输出调试信息的冗余条件判断,简化了任务逻辑。原条件`when: check_failed`与后续的失败任务重复,因此被移除以提高代码清晰度。 --- plugins/boostkit/workspace/roles/check/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/boostkit/workspace/roles/check/tasks/main.yml b/plugins/boostkit/workspace/roles/check/tasks/main.yml index 152f398..c058d64 100644 --- a/plugins/boostkit/workspace/roles/check/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/check/tasks/main.yml @@ -69,7 +69,6 @@ debug: msg: "{{ item }}" loop: "{{ check_results }}" - when: check_failed - name: "[Check] Abort if any check failed" fail: -- Gitee From ff9e2bea1981444028ff46006c01f9a9db7830ce Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 16 Apr 2025 16:21:58 +0800 Subject: [PATCH 22/24] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E7=8A=B6=E6=80=81=E6=A0=87=E8=AE=B0=E5=92=8C?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 在AccLib安装任务中添加changed_when: false 2. 在检查任务中添加changed_when: false --- .../workspace/roles/AccLib/install/tasks/execute_install.yml | 1 + plugins/boostkit/workspace/roles/check/tasks/main.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml index d2a4a00..23e1c44 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml @@ -22,3 +22,4 @@ fail: msg: "Installation failed for {{ item }}. Check log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log" when: install_result is failed + changed_when: false diff --git a/plugins/boostkit/workspace/roles/check/tasks/main.yml b/plugins/boostkit/workspace/roles/check/tasks/main.yml index c058d64..ff0787e 100644 --- a/plugins/boostkit/workspace/roles/check/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/check/tasks/main.yml @@ -79,6 +79,7 @@ {% endfor %} Please fix the issues and try again. when: check_failed + changed_when: false when: > skip_check is not defined or (skip_check != true and skip_check | string != "true") -- Gitee From 90ce982ef65de4344f8a9da520abb3e298f35a28 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Wed, 16 Apr 2025 16:23:41 +0800 Subject: [PATCH 23/24] =?UTF-8?q?Revert=20"=E4=BC=98=E5=8C=96=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=89=A7=E8=A1=8C=E7=8A=B6=E6=80=81=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=92=8C=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ff9e2bea1981444028ff46006c01f9a9db7830ce. --- .../workspace/roles/AccLib/install/tasks/execute_install.yml | 1 - plugins/boostkit/workspace/roles/check/tasks/main.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml b/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml index 23e1c44..d2a4a00 100644 --- a/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml +++ b/plugins/boostkit/workspace/roles/AccLib/install/tasks/execute_install.yml @@ -22,4 +22,3 @@ fail: msg: "Installation failed for {{ item }}. Check log file: {{ temp_path }}/BoostKit-AccLib/scripts/{{ timestamp.stdout }}.log" when: install_result is failed - changed_when: false diff --git a/plugins/boostkit/workspace/roles/check/tasks/main.yml b/plugins/boostkit/workspace/roles/check/tasks/main.yml index ff0787e..c058d64 100644 --- a/plugins/boostkit/workspace/roles/check/tasks/main.yml +++ b/plugins/boostkit/workspace/roles/check/tasks/main.yml @@ -79,7 +79,6 @@ {% endfor %} Please fix the issues and try again. when: check_failed - changed_when: false when: > skip_check is not defined or (skip_check != true and skip_check | string != "true") -- Gitee From 3021696c83b558ab843283c294f5cff32f0c95d4 Mon Sep 17 00:00:00 2001 From: shupiaoyang Date: Thu, 17 Apr 2025 19:23:07 +0800 Subject: [PATCH 24/24] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=B3=A8=E9=87=8A=E8=AF=B4=E6=98=8E=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0ftp=5Fproxy=E5=92=8Cno=5Fproxy=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整代理配置注释格式,使其更清晰易读 - 增加ftp_proxy和no_proxy配置示例 - 修改注释说明,指导用户如何启用代理配置 --- plugins/boostkit/config.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/boostkit/config.yaml b/plugins/boostkit/config.yaml index 9628b1c..575e390 100644 --- a/plugins/boostkit/config.yaml +++ b/plugins/boostkit/config.yaml @@ -5,10 +5,12 @@ all: ansible_port: 22 ansible_user: root ansible_password: "" - # 按实际代理需要添加,如需全局使用代理请移动至 all:vars - # proxy_env: - # http_proxy: - # https_proxy: + # 按实际代理需要添加,添加时删除以下第一行和所需行的井号;如需全局使用代理请移动至 all:vars + #proxy_env: + # http_proxy: + # https_proxy: + # ftp_proxy: + # no_proxy: # 可在此添加更多主机 children: AccLib: -- Gitee