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.
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.
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.
When node is manually configured (from Jenkins Nodes configuration page) or swarm script is executed by user on Node (via ssh), screenshots are fine.
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" .
I do not see any error in logs from RCPTT,xvnc,in job console. 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
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:
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.
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
#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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.