简体   繁体   English

如何正确配置jenkins群集作为服务以获取正确的快照?

[英]how to properly configure jenkins swarm as a service to get proper scrshoots?

I have a trouble to find out what is the problem in node setup (centos+gnome+swarm as a service) as it does connect,run gui tests properly but returns "broken" (whole white or "something went wrong) screenshots. 我很难找出节点设置(centos + gnome + swarm即服务)中存在的问题,因为它确实连接了,正确运行了gui测试,但返回了“残破”(全白或“出问题了”)的屏幕截图。

In our CI env, we build and test GUI application (RED - Robot Editor) using Eclipse tool RCPTT which can click on GUI elements to validate functionalities. 在我们的CI环境中,我们使用Eclipse工具RCPTT构建并测试GUI应用程序(红色-机器人编辑器),该工具可以单击GUI元素以验证功能。

Tests are are executed on nodes Centos7 with metacity+gnome+vncserver, whenever something with GUI is wrong (GUI element is not found,validation is not consistant with test criteria), report is created together with screenshot,so tester is able to have a look what has changed in tested app. 测试是在具有metacity + gnome + vncserver的Centos7节点上执行的,每当GUI出错(找不到GUI元素,验证不符合测试标准)时,报告就会与屏幕截图一起创建,因此测试人员可以拥有一个看看经过测试的应用程序发生了什么变化。

When node is manually configured (from Jenkins Nodes configuration page) or swarm script is executed by user on Node (via ssh), screenshots are fine. 当手动配置节点(从Jenkins Nodes配置页面)或用户在Node上执行swarm脚本(通过ssh)时,可以使用屏幕截图。

When swarm as a service is executed (node is connected, systemctl status is green,by the same user as run manually), everything is ok besides sreenshots are off (screen res is fine,whole screen is white or with error "Oh no! Something has gone wrong" 当执行群集即服务(节点已连接,系统ctl状态为绿色,由与手动运行相同的用户)时,除了关闭屏幕快照(屏幕分辨率很好,整个屏幕为白色或错误为“哦,不!出问题了” 在此处输入图片说明 .

I do not see any error in logs from RCPTT,xvnc,in job console. 在作业控制台中,RCTPT,xvnc的日志中没有看到任何错误。 What can be a root cause of broken screenshots? 导致屏幕截图损坏的根本原因是什么?

env setup: service definition 环境设置:服务定义

[Unit]
Description=Swarm client to create Jenkins slave
After=network.target
After=display-manager.service

[Service]
ExecStart=<path>/swarm_client.sh start
ExecStop=<path>/swarm_client.sh stop
Type=forking
PIDFile=<path>/slave.pid
User=root
Group=root

[Install]
WantedBy=graphical.target

swarm_client.sh swarm_client.sh

function startclient {
                PUBIP=`public ip string`

        java  \
           -jar ${SWARM_HOME}/swarm-client-3.3.jar \
           -executors 1 \
           -deleteExistingClients \
           -disableClientsUniqueId \
           -fsroot ${CLIENT_HOME} \
           -labels "linux"  \
           -master <jenkins> \
           -name node-Swarm-${PUBIP} 2>&1 > ${CLIENT_HOME}/slave.log &
    PID=$!
        RETCODE=$?
        echo $PID > ${CLIENT_HOME}/slave.pid
        exit $RETCODE
}

function stopclient {
        if [ -f ${CLIENT_HOME}/slave.pid ];then
                PID=`head -n1 ${CLIENT_HOME}/slave.pid`
                kill $PID
                rm -f ${CLIENT_HOME}/slave.pid
        fi
}
SWARM_HOME=<path>/jenkins/swarm
CLIENT_HOME=<path>/jenkins
case "$1" in
  start)
        startclient
        ;;
  stop)
        stopclient
        ;;
  *)
        echo "Usage: systemctl {start|stop} swarm_client.service" || true
        exit 1
esac

xvnc logs: xvnc日志:

Fri Jul  7 11:05:40 2017
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5942
 vncext:      created VNC server for screen 0
gnome-session-is-accelerated: llvmpipe detected.

ok, after rubber duck session and some googling it seems that while setting up a service which will be dependant on user environment properties/settings (swarm client is indeed a reverse remote shell), such service should import at least env properties from user shell. 好的,在橡皮鸭会话和一些谷歌搜索之后,似乎在设置将取决于用户环境属性/设置的服务时(群客户端确实是反向远程外壳),此类服务应至少从用户外壳导入env属性。

In my case, if swarm_client.sh was working fine from ssh but not as service, it needed to use user's ssh/bash env properties 就我而言,如果swarm_client.sh在ssh上运行良好,但不能作为服务运行,则需要使用用户的ssh / bash env属性

#export environment of user to file
env > user.env

Add such file to service description under [Service] section: 将此类文件添加到[服务]部分的服务描述中:

EnvironmentFile=<path>/user.env

I have not investigated what exactly was missing but this is good enough for my case. 我尚未调查到底缺少了什么,但这对我的情况已经足够了。

Hope that it will help someone with the same problems with swarm as a service under Centos/RH 希望它可以帮助在Centos / RH下将遇到群体问题的人作为服务

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM