Compare commits

...

17 Commits

Author SHA1 Message Date
fumingwei
ed15d48272 增加docker环境基础安装 2020-07-22 12:14:03 +08:00
fumingwei
8364667a79 1、修改自检项目名称为tsg-diagnose 2、删除自检多余操作 2020-07-20 16:57:16 +08:00
fumingwei
799f3e4a2f 删除 构建包过程中,从docker register 下载 docker image 并生成tar的过程 2020-07-16 20:20:51 +08:00
fumingwei
a75a3a44f4 删除调试信息 2020-07-15 10:52:28 +08:00
付明卫
beffa2443f upload file sha256 not match 2020-07-14 23:08:16 +08:00
fumingwei
a6f43fbaa0 修改调用upload脚本错误问题 2020-07-14 19:51:39 +08:00
fumingwei
3356920496 1、删除gitlab的 artifact 2、新增upload tar包到pulp file 存储 3、将共用变量从group_var 目录分离出来 2020-07-14 19:46:06 +08:00
root
6dfccaaf53 增加调试信息 2020-07-07 19:58:29 +08:00
root
988ea5c6b3 修改'dict object' has no attribute 'downpath'错误 2020-07-07 08:24:28 +08:00
root
ad148140fa 修改下载rpm失败问题 2020-07-07 08:12:05 +08:00
root
2c197d969d 修改 include 错误问题 2020-07-07 08:05:24 +08:00
root
06bb553d57 新建空文件,保持文件夹存在 2020-07-07 07:35:51 +08:00
root
3f3ff290c2 添加debug信息 2020-07-07 07:24:35 +08:00
root
cb497593e7 修改ansible 路径错误 2020-07-07 06:59:50 +08:00
root
662486eed3 增加debug 信息 2020-07-07 06:38:17 +08:00
root
9fc6d3f40c 增加自检打包和roles 规则 2020-07-07 06:23:37 +08:00
root
2c2efeade0 数据面离线安装包制作 2020-07-07 05:48:01 +08:00
15 changed files with 186 additions and 0 deletions

35
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,35 @@
stages:
- build
.build_tar:
image: "git.mesalab.cn:7443/mesa_platform/build-env:self-test-env"
variables:
GIT_STRATEGY: "clone"
BUILD_PADDING_PREFIX: /tmp/padding_for_PACK_TAR_BUILD_DIRS_PREFIX/
TESTING_VERSION_BUILD: 0
before_script:
- dockerd > /dev/null &
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- mkdir -p $BUILD_PADDING_PREFIX/$CI_PROJECT_NAMESPACE/
- ln -s $CI_PROJECT_DIR $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
- cd $BUILD_PADDING_PREFIX/$CI_PROJECT_PATH
- pwd
- chmod +x ./ci/travis.sh
script:
- yum makecache
- ./ci/travis.sh
tags:
- share
file_build:
stage: build
variables:
VER_NAME: $CI_COMMIT_REF_NAME
PULP3_REPO_NAME: install-package-stable
PULP3_DIST_NAME: install-package-stable
extends: .build_tar
only:
- tags

3
buildPackage.yml Normal file
View File

@@ -0,0 +1,3 @@
- hosts: local
roles:
- package-build

View File

@@ -0,0 +1,10 @@
tarpath:
src:
- /tmp/padding_for_PACK_TAR_BUILD_DIRS_PREFIX/tsg/tsg-scripts/install_config
- /tmp/padding_for_PACK_TAR_BUILD_DIRS_PREFIX/tsg/tsg-scripts/deploy.yml
- /tmp/padding_for_PACK_TAR_BUILD_DIRS_PREFIX/tsg/tsg-scripts/roles/tsg-diagnose
destdict: /tmp/padding_for_PACK_TAR_BUILD_DIRS_PREFIX/tsg/tsg-scripts/build/
tsgDiagnoseDockerFile:
unarchiveUrl: https://repo.internal.geedge.net/pulp/content/install/stable/package/docker-rpm-test-docker-ce-7.tar.gz
unarchiveDest: /tmp/padding_for_PACK_TAR_BUILD_DIRS_PREFIX/tsg/tsg-scripts/roles/tsg-diagnose/files

2
build_config/hosts Normal file
View File

@@ -0,0 +1,2 @@
[local]
localhost ansible_connection=local

14
ci/travis.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env sh
mkdir build || true
cat ./customize.yml >> ./build_config/group_vars/local.yml
cat ./customize.yml >> ./install_config/group_vars/all.yml
ansible-playbook -i ./build_config -e tarname=tsg-scripts-${VER_NAME}.tar.gz buildPackage.yml
ls -halt ./build/tsg-scripts-${VER_NAME}.tar.gz
cd build
cp ~/file_upload_tools.py ./
python3 file_upload_tools.py ${PULP3_REPO_NAME} ${PULP3_DIST_NAME} *.tar.gz

52
customize.yml Normal file
View File

@@ -0,0 +1,52 @@
rpmdict:
tsgDiagnose:
fullname: "tsg-diagnose-test_edit_name-1.el7.x86_64.rpm"
name: "tsg-diagnose"
downpath: "/tmp/padding_for_PACK_TAR_BUILD_DIRS_PREFIX/tsg/tsg-scripts/roles/tsg-diagnose/files/rpms"
dockerEnvRpm:
dockerCe:
- container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
- selinux-policy-targeted-3.13.1-266.el7_8.1.noarch.rpm
- selinux-policy-3.13.1-266.el7_8.1.noarch.rpm
- containerd.io-1.2.13-3.2.el7.x86_64.rpm
- policycoreutils-python-2.5-34.el7.x86_64.rpm
- policycoreutils-2.5-34.el7.x86_64.rpm
- libselinux-utils-2.5-15.el7.x86_64.rpm
- libselinux-python-2.5-15.el7.x86_64.rpm
- libseccomp-2.3.1-4.el7.x86_64.rpm
- iptables-1.4.21-34.el7.x86_64.rpm
- libcgroup-0.41-21.el7.x86_64.rpm
- audit-libs-python-2.8.5-4.el7.x86_64.rpm
- setools-libs-3.3.8-4.el7.x86_64.rpm
- libsemanage-python-2.5-14.el7.x86_64.rpm
- checkpolicy-2.5-8.el7.x86_64.rpm
- libnetfilter_conntrack-1.0.6-1.el7_3.x86_64.rpm
- python-IPy-0.75-6.el7.noarch.rpm
- libnfnetlink-1.0.1-4.el7.x86_64.rpm
- libmnl-1.0.3-7.el7.x86_64.rpm
- docker-ce-cli-19.03.12-3.el7.x86_64.rpm
- docker-ce-19.03.12-3.el7.x86_64.rpm
dockerCompose:
- libtirpc-0.2.4-0.16.el7.x86_64.rpm
- libyaml-0.1.4-11.el7_0.x86_64.rpm
- python3-3.6.8-13.el7.x86_64.rpm
- python36-cached_property-1.5.1-2.el7.noarch.rpm
- python36-chardet-3.0.4-1.el7.noarch.rpm
- python36-docker-2.6.1-3.el7.noarch.rpm
- python36-dockerpty-0.4.1-18.el7.noarch.rpm
- python36-docker-pycreds-0.2.1-2.el7.noarch.rpm
- python36-docopt-0.6.2-8.el7.noarch.rpm
- python36-idna-2.7-2.el7.noarch.rpm
- python36-jsonschema-2.5.1-4.el7.noarch.rpm
- python36-pysocks-1.6.8-7.el7.noarch.rpm
- python36-PyYAML-3.13-1.el7.x86_64.rpm
- python36-requests-2.14.2-2.el7.noarch.rpm
- python36-six-1.14.0-2.el7.noarch.rpm
- python36-texttable-1.6.2-1.el7.noarch.rpm
- python36-urllib3-1.25.6-1.el7.noarch.rpm
- python36-websocket-client-0.47.0-2.el7.noarch.rpm
- python3-libs-3.6.8-13.el7.x86_64.rpm
- python3-pip-9.0.3-7.el7_7.noarch.rpm
- python3-setuptools-39.2.0-10.el7.noarch.rpm
- docker-compose-1.18.0-4.el7.noarch.rpm

View File

@@ -16,6 +16,7 @@
- certstore - certstore
- cert-redis - cert-redis
- telegraf_statistic - telegraf_statistic
- tsg-diagnose
- hosts: blade-01 - hosts: blade-01
roles: roles:

View File

@@ -0,0 +1,6 @@
---
- name: 'Unarchive docker env rpm file from remote host'
unarchive:
src: "{{ tsgDiagnoseDockerFile.unarchiveUrl }}"
dest: "{{ tsgDiagnoseDockerFile.unarchiveDest }}"
remote_src: yes

View File

@@ -0,0 +1,8 @@
---
- name: "download rpm package by rpm list"
yum:
name: "{{ item.value.name }}"
state: present
download_only: true
download_dir: "{{ item.value.downpath }}"
with_dict: "{{ rpmdict }}"

View File

@@ -0,0 +1,6 @@
---
- name: "build install tar package"
archive:
path: "{{ tarpath.src }}"
dest: "{{ tarpath.destdict }}{{ tarname }}"
format: gz

View File

@@ -0,0 +1,4 @@
---
- include: DockerEnvDownload.yml
- include: RpmDownload.yml
- include: TarBuild.yml

View File

View File

@@ -0,0 +1,19 @@
---
- name: "Install docker-ce"
yum:
name: "/tmp/ansible_deploy/tsg-diagnose/rpms/rpm-docker/docker-ce/{{ item }}"
state: present
with_items: "{{ dockerEnvRpm.dockerCe }}"
- name: "Install docker-compose"
yum:
name: "/tmp/ansible_deploy/tsg-diagnose/rpms/rpm-docker/docker-compose/{{ item }}"
state: present
with_items: "{{ dockerEnvRpm.dockerCompose }}"
- name: 'Docker service start'
systemd:
name: docker
enabled: yes
daemon_reload: yes

View File

@@ -0,0 +1,12 @@
---
- name: "Install tsg-diagnose rpm package"
yum:
name:
- "/tmp/ansible_deploy/tsg-diagnose/rpms/{{rpmdict.tsgDiagnose.fullname}}"
state: present
- name: 'Tsg-diagnose service start'
systemd:
name: tsg-diagnose
enabled: yes
daemon_reload: yes

View File

@@ -0,0 +1,14 @@
---
- name: 'Copy tsg-diagnose file to device'
copy:
src: "{{item.src}}"
dest: "{{item.dest}}"
mode: "{{item.mode}}"
with_items:
- { src: "{{ role_path }}/files/", dest: "/tmp/ansible_deploy/tsg-diagnose", mode: '0755' }
- name: 'Install docker env rpm'
include: DockerEnv.yml
- name: 'Install Tsg-diagnose'
include: TsgDiagnose.yml