ubuntu系统搭建jenkins

开启ssh服务
vim /etc/ssh/sshd_config PermitRootLogin yes
/etc/init.d/ssh restart
设置apt下载镜像
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim /etc/apt/sources.list
deb ubuntu安装包下载_开源镜像站-阿里云 bionic main restricted universe multiverse
deb-src ubuntu安装包下载_开源镜像站-阿里云 bionic main restricted universe multiverse
deb ubuntu安装包下载_开源镜像站-阿里云 bionic-security main restricted universe multiverse
deb-src ubuntu安装包下载_开源镜像站-阿里云 bionic-security main restricted universe multiverse
deb ubuntu安装包下载_开源镜像站-阿里云 bionic-updates main restricted universe multiverse
deb-src ubuntu安装包下载_开源镜像站-阿里云 bionic-updates main restricted universe multiverse
deb ubuntu安装包下载_开源镜像站-阿里云 bionic-backports main restricted universe multiverse
deb-src ubuntu安装包下载_开源镜像站-阿里云 bionic-backports main restricted universe multivers
deb ubuntu安装包下载_开源镜像站-阿里云 bionic-proposed main restricted universe multiverse
deb-src ubuntu安装包下载_开源镜像站-阿里云 bionic-proposed main restricted universe multiverse
sudo apt-get update (sudo rm /var/lib/apt/lists/lock)
sudo apt-get install openjdk-8-jre
sudo apt install openjdk-8-jdk

wget -o /etc /yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Wget -o /etc /yum.Storage.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

修改默认python
sudo apt install python3.8
update-alternatives --list python
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 2
update-alternatives --install /usr/bin/python python /usr/bin/python3.6 3
update-alternatives --config python
python --version

安装ssh服务
sudo apt-get install openssh-server
sudo service ssh start

sudo apt-get install -y nodejs
sudo apt-get install -y npm

sudo npm install npm@latest -g

sudo npm install -g cnpm -registry=http://registry.npm.taobao.org
sudo cnpm install -g appium
sudo cnpm install -g appium-doctor

系统管理-插件管理-可选插件

安装 SSH Agent,SSH Build Agents, git, pipeline, blueocean

系统管理-全局安全配置-SSH Server-随机选取
系统管理-节点管理-新建节点(Jenkins高级篇之Pipeline-补充篇-如何添加一个windows节点的jenkins agent 服务_Anthony_tester的博客-CSDN博客)
系统管理-管理用户-新建用户
系统管理-全局安全配置-授权策略-安全矩阵
系统管理-插件管理

Multiple SCMs plugin 版本管理工具git
Rebuilder 重新构建
Safe Restart Plugin 安全重启插件
Pipeline 流水线
Text Finder 文件信息查找
Blue Ocean 美化jenkins
Allure 报告

配置Email Email Extension, Email Extension Template
系统管理-系统配置-系统管理员邮件地址-tangyihuai@ceshiren.com
Extended E-mail Notification-- SMTP server(smtp.qq.com) SMTP Port(465)
邮件通知(smtp.qq.com)-用户默认邮件后缀(@qq.com)-高级-用户名密码(授权码)-勾选使用SSL协议-SMTP端口(465)-Reply-To Address tangyihuai@ceshiren.com

构建触发器-其他工程构建后触发-选择关注的项目–稳定,不稳定,失败
exit 0 成功 exit 1 失败 Text Finder

git config --global user.name “tangdaren”
git config --global user.email “1229238297@qq.com"
1.限制项目的运行节点
2.git Repository URL-- git@gitee.com:AoeRunner/iSelenium_Python.git
Additional Behaviours-- check out to a sub-director(检出到子目录,仓库的本地子目录)
引入自己环境变量,配置
. ~/.bash_profile
cd iInterface_python
pip3 install -r requirements.txt
pytest -sv test/weather_test.py --alluredir=./allure-results

安装 Allure → 全局工具配置(Allure Commandline) → 构建后操作 → Path iInterface_python/allure-results

cd iSelenium_Python
pip3 install -r requirements.txt

pytest -sv test/web_ut.py --alluredir=./allure-results
self.driver = webdriver.Remote(
command_executor=‘http://42.192.73.147:4444/wd/hub’,
desired_capabilities=capabilities,
options=chrome_options)

轮询/Poll SCM

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE=“Nexus 5” --name android-container butomo1989/docker-android-x86-7.1.1
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE=“Samsung Galaxy S6” --name android-container butomo1989/docker-android-x86-8.1
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE=“Nexus5” --name android1 butomo1989/docker-android-x86-6.0
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE=“Nexus5” --name android2 butomo1989/docker-android-x86-7.1.1
docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE=“Nexus5” --name android3 budtmo/docker-android-x86-6.0
docker run -it --rm -v $PWD/android-testing/ui/espresso/BasicSample:/root/tmp butomo1989/docker-android-x86-8.1 tmp/gradlew build

webhook 打通jenkins和gitlab的连接 gitlab api token

mvn install -Dmaven.test.skip=true

nohup java -jar -Dspring.config.location=./application.properties online_xdclass-0.0.1-SNAPSHOT.jar &

curl 127.0.0.1:8089/api/v1/pub/video/list_banner

http://42.192.73.147:8089/api/v1/pub/video/list_banner

[ -d venv ] || python3 -m venv venv
source venv/bin/activate
pip install -i Simple Index -r requirements.txt