[笔记-防止以后遗忘便于查找]ubuntu上配置jenkins+pytest+allure+gitlab过程

1.ubuntu服务器上安装配置python
2.ubuntu服务器上安装配置git

安装git
sudo apt-get update
sudo apt-get install git

配置git全局账号密码:
git config --global user.name "your username"
git config --global user.email "your email"

生成公钥并配置在远程仓库上配置ssh-key
1.ssh-keygen -t rsa -b 4096 -C "your.email@example.com"
2.cat ~/.ssh/id_ras.pub
3.复制id_ras.pub中的内容
4.在gitlab上点击setting-repository-deploy keys添加key
5.在ubuntu服务器上新建一个目录并进入这个目录
6.在新建的目录下使用 git clone git@xxx.git 克隆远程仓库项目

3.ubuntu服务器上安装配置java

sudo apt update
sudo apt install openjdk-11-jre-headless

4.ubuntu服务器上安装jenkins

配置jenkins安装包的下载源

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

安装jenkins
sudo apt update
sudo apt install jenkins

启动jenkins服务
sudo systemctl start jenkins
systemctl status jenkins

4.ubuntu服务器上安装配置allure

下载allure(默认下载到当前路径)
curl -O https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.23.0/allure-commandline-2.23.0.tgz

解压allure包
tar -zxvf allure-commandline-2.23.0.tgz

cd ./allure-2.23.0/bin | pwd

建立allure执行文件的软连接
ln -s /tools/allure-2.23.0/bin /usr/bin/allure

添加allure环境变量(在/etc/profile中添加一行:export PATH=$PATH:{解压的后的allure bin目录}):
vim /etc/profile
在/etc/profile追加一行:export PATH=$PATH:/tools/allure-2.23.0/bin  并保存退出

source /etc/profile(使刚添加的环境变量生效)
allure --verison(显示版本号表示allure环境变量已生效)