jenkins+docker+robot环境搭建

1.docker必须添加jenkins用户的执行权限

sudo usermod -aG docker jenkins
sudo systemctl restart docker
sudo systemctl restart jenkins

2.构建robot基础镜像

#Dockerfile
FROM daocloud.io/library/python
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
#requirements.txt
robotframework
robotframework-requests

3.jenkins在下载git代码后,执行docker命令

docker run -v /var/lib/jenkins/workspace/devops/compass:/data myrobot robot --outputdir /data /data//devops/测试案例/API/API.txt

4.安装robot插件,并设置好输出结果的目录

/var/lib/jenkins/workspace/devops/compass

你可能感兴趣的:(jenkins+docker+robot环境搭建)