Closed Bug 1232407 Opened 9 years ago Closed 9 years ago

Allow starting desktop-test images with VNC if requested

Categories

(Taskcluster Graveyard :: Docker Images, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: armenzg, Assigned: armenzg)

References

Details

Attachments

(2 files, 1 obsolete file)

This would allow to see what is going on inside of the images when running tests.
In this image you can do the following: * Load a task and grab the steps from the "run locally" section * Add --device and set the variables START_VNC and SKIP_RUNNING_SCRIPT > chmod +x bin/test.sh > ./bin/test.sh * Use xtightvncviewer to connect * cd workspace * Find the mozharness command, copy/paste it and add at the beginning "sudo -E -u worker" [1] image_name=armenzg/desktop-test:0.5.1 docker pull 'armenzg/desktop-test:0.5.1' # Find a unique container name container_name='task-etxd0T9QQ6iewMRWDb10jw-container' # Run docker command docker run -ti \ --name "${container_name}" \ --device=/dev/video1:/dev/video1 \ -e START_VNC='true' \ -e SKIP_RUNNING_SCRIPT='true' \ -e MOZILLA_BUILD_URL='https://queue.taskcluster.net/v1/task/LRLjlqenTQOS7O3yEoURPA/artifacts/public/build/target.tar.bz2' \ -e MOZHARNESS_SCRIPT='mozharness/scripts/desktop_unittest.py' \ -e GECKO_HEAD_REPOSITORY='https://hg.mozilla.org/try/' \ -e MOZHARNESS_URL='https://queue.taskcluster.net/v1/task/LRLjlqenTQOS7O3yEoURPA/artifacts/public/build/mozharness.zip' \ -e NEED_PULSEAUDIO='true' \ -e NEED_WINDOW_MANAGER='true' \ -e MOZHARNESS_CONFIG='mozharness/configs/unittests/linux_unittest.py mozharness/configs/remove_executables.py ' \ -e GECKO_HEAD_REV='3961f20f20a358a53b81231050395e9fc4e415f3' \ ${image_name} \
Assignee: nobody → armenzg
We can't forget setting DISPLAY=:0 (since that gets set and forgotten within test-linux.sh).
A couple of changes ended inside of other patches so I've fixed it and now it shows in this patch. I'm not neccessarily tied to the DO_NOT_EXIT feature as I don't use it much, however, it might handy one day.
Attachment #8699633 - Attachment is obsolete: true
Attachment #8699633 - Flags: feedback?(dustin)
Attachment #8700017 - Flags: feedback?(dustin)
Comment on attachment 8700017 [details] [diff] [review] allow enabling VNC, prevent ending of execution and running in an environment without running Mozharnes Review of attachment 8700017 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/docker/desktop-test/Dockerfile @@ +45,5 @@ > > +# In test.sh we accept START_VNC to start a vnc daemon. > +# Exposing this port allows it to work. > +EXPOSE 5900 > +RUN apt-get install -y x11vnc Aside from the difficulty of updating all three docker images, is there a good reason to install this in desktop-test instead of in ubuntu1204-test? ::: testing/taskcluster/scripts/tester/test-linux.sh @@ +19,5 @@ > +: START_VNC ${START_VNC:=false} > +: DO_NOT_EXIT ${DO_NOT_EXIT:=false} > +# Skipping running the script at the end of this file is meant > +# to access the container and interact with it in the same environment. > +: SKIP_RUNNING_SCRIPT ${SKIP_RUNNING_SCRIPT:=false} Maybe SKIP_MOZHARNESS_RUN? Would DO_NOT_EXIT and SKIP_RUNNING_SCRIPT ever be used separately? Also, move the comment from here down to where it's used at the bottom of the script. @@ +37,5 @@ > cleanup() { > + # We can use SKIP_RUNNING_SCRIPT to prevent killing xvfb > + # and still be able to keep a VNC session > + # XXX: Perhaps we want this to be controlled by START_VNC > + if [ -n "$xvfb_pid" ] && [ $SKIP_RUNNING_SCRIPT == false ] ; then I think START_VNC would make more sense, but either way, how does this help? Once this script exits, the container is closed out and Xvfb will be killed anyway. Isn't DO_NOT_EXIT all that's required to interact via VNC after the script runs? @@ +64,5 @@ > > # run XVfb in the background, if necessary > if $NEED_XVFB; then > + Xvfb :0 -nolisten tcp -screen 0 1600x1200x24 > \ > + ~/artifacts/public/xvfb.log 2>&1 & nit: move the > to the next line @@ +88,5 @@ > fi > > +if $START_VNC; then > + x11vnc > ~/artifacts/public/x11vnc.log 2>&1 & > + sleep 3 Sleeps always make me leery. What is this accomplishing? @@ +134,5 @@ > > +if $DO_NOT_EXIT; then > + while : > + do > + read -r -p "Enter anything to exit the container " c Is this practical within TaskCluster? Or maybe this should be "To exit the run, hit enter (on your system) or cancel the task (in TaskCluster)"
Attachment #8700017 - Flags: feedback?(dustin) → feedback+
It would be great to separate the initialization of the environment from test execution and have less hackyness. I verified my steps and wanted to paste them somewhere for reference: docker run -ti --device=/dev/video1:/dev/video1 -e START_VNC=true -e SKIP_RUNNING_SCRIPT=true -e MOZILLA_BUILD_URL=https://queue.taskcluster.net/v1/task/WDVgc-FdRaqZkN0xjZhnkQ/artifacts/public/build/target.tar.bz2 -e MOZHARNESS_SCRIPT=mozharness/scripts/desktop_unittest.py -e GECKO_HEAD_REPOSITORY=https://hg.mozilla.org/try/ -e MOZHARNESS_URL=https://queue.taskcluster.net/v1/task/WDVgc-FdRaqZkN0xjZhnkQ/artifacts/public/build/mozharness.zip -e NEED_PULSEAUDIO=true -e NEED_WINDOW_MANAGER=true -e MOZHARNESS_CONFIG='mozharness/configs/unittests/linux_unittest.py mozharness/configs/remove_executables.py' -e GECKO_HEAD_REV=fbe188bab4b09f8e61d4e47f1b54ae9f6d24dee6 armenzg/desktop-test:0.5.1 chmod +x bin/test.sh ./bin/test.sh cd workspace export DISPLAY=:0 # Connect to VNC sudo -E -u worker python2.7 /home/worker/workspace/mozharness/scripts/desktop_unittest.py --config-file mozharness/configs/unittests/linux_unittest.py --config-file mozharness/configs/remove_executables.py --no-read-buildbot-config --installer-url=https://queue.taskcluster.net/v1/task/WDVgc-FdRaqZkN0xjZhnkQ/artifacts/public/build/target.tar.bz2 --test-packages-url=https://queue.taskcluster.net/v1/task/WDVgc-FdRaqZkN0xjZhnkQ/artifacts/public/build/test_packages.json --download-symbols=ondemand --reftest-suite=reftest --total-chunk=4 --this-chunk=1
Comment on attachment 8700017 [details] [diff] [review] allow enabling VNC, prevent ending of execution and running in an environment without running Mozharnes Review of attachment 8700017 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/docker/desktop-test/Dockerfile @@ +45,5 @@ > > +# In test.sh we accept START_VNC to start a vnc daemon. > +# Exposing this port allows it to work. > +EXPOSE 5900 > +RUN apt-get install -y x11vnc No reason. We should do that. ::: testing/taskcluster/scripts/tester/test-linux.sh @@ +19,5 @@ > +: START_VNC ${START_VNC:=false} > +: DO_NOT_EXIT ${DO_NOT_EXIT:=false} > +# Skipping running the script at the end of this file is meant > +# to access the container and interact with it in the same environment. > +: SKIP_RUNNING_SCRIPT ${SKIP_RUNNING_SCRIPT:=false} SKIP_MOZHARNESS_RUN is fine. I thought of making it general. DO_NOT_EXIT and SKIP_RUNNING_SCRIPT can be used separately. I'm going to drop DO_NOT_EXIT as I don't really have a strong need for it. @@ +37,5 @@ > cleanup() { > + # We can use SKIP_RUNNING_SCRIPT to prevent killing xvfb > + # and still be able to keep a VNC session > + # XXX: Perhaps we want this to be controlled by START_VNC > + if [ -n "$xvfb_pid" ] && [ $SKIP_RUNNING_SCRIPT == false ] ; then The container won't exit if you don't give it a command. In production, we give it a command [1] However, when running locally, we don't have to give it a command, hence, not exiting. Yes, VNC makes more sense. [1] bash /home/worker/bin/test.sh --no-read-buildbot-config '--installer-url=https://queue.taskcluster.net/v1/task/LRLjlqenTQOS7O3yEoURPA/artifacts/public/build/target.tar.bz2' '--test-packages-url=https://queue.taskcluster.net/v1/task/LRLjlqenTQOS7O3yEoURPA/artifacts/public/build/test_packages.json' '--download-symbols=ondemand' '--reftest-suite=reftest' '--total-chunk=4' '--this-chunk=1' \ @@ +88,5 @@ > fi > > +if $START_VNC; then > + x11vnc > ~/artifacts/public/x11vnc.log 2>&1 & > + sleep 3 I saw it in one of your patches [1] The only reason I have is to make sure that there are no issues of starting VNC just before gnome-session and not working properly. I can try it without it and see if it still works. [1] https://bug1223123.bmoattachments.org/attachment.cgi?id=8689675 @@ +134,5 @@ > > +if $DO_NOT_EXIT; then > + while : > + do > + read -r -p "Enter anything to exit the container " c I will be dropping this as I mentioned.
Comment on attachment 8701117 [details] MozReview Request: Bug 1232407 - Enable VNC and skip running Mozharness if requested. r=dustin https://reviewboard.mozilla.org/r/28889/#review25657
Attachment #8701117 - Flags: review?(dustin) → review+
I'm rebuilding the images now.
Comment on attachment 8701117 [details] MozReview Request: Bug 1232407 - Enable VNC and skip running Mozharness if requested. r=dustin https://reviewboard.mozilla.org/r/28889/#review25663 Actually, this also needs ``` diff --git a/testing/docker/ubuntu1204-test-upd/Dockerfile b/testing/docker/ubuntu1204-test-upd/Dockerfile --- a/testing/docker/ubuntu1204-test-upd/Dockerfile +++ b/testing/docker/ubuntu1204-test-upd/Dockerfile @@ -1,9 +1,9 @@ -FROM taskcluster/ubuntu1204-test:0.1.4 +FROM taskcluster/ubuntu1204-test:0.1.5 MAINTAINER Dustin J. Mitchell <dustin@mozilla.com> ### update to latest from upstream repositories # if this becomes a long list of packages, consider bumping the # ubunt1204-test version RUN apt-get update && apt-get upgrade -y --force-yes # Set a default command useful for debugging ``` r+ with that in place
Comment on attachment 8701117 [details] MozReview Request: Bug 1232407 - Enable VNC and skip running Mozharness if requested. r=dustin Review request updated; see interdiff: https://reviewboard.mozilla.org/r/28889/diff/1-2/
Attachment #8701117 - Flags: review?(dustin)
I amended the commit to include your change. I asssume the building will take a while with all 3 images being re-built. I will be gone before EOD so I won't be able to land the patch.
Comment on attachment 8701117 [details] MozReview Request: Bug 1232407 - Enable VNC and skip running Mozharness if requested. r=dustin https://reviewboard.mozilla.org/r/28889/#review25685
Attachment #8701117 - Flags: review?(dustin) → review+
It seems that the builds were deployed. 0.5.2 https://hub.docker.com/r/taskcluster/desktop-test/tags/ 0.1.5.20151222110000 https://hub.docker.com/r/taskcluster/ubuntu1204-test-upd/tags/ 0.1.5 https://hub.docker.com/r/taskcluster/ubuntu1204-test/tags/ I will land the change. armenzg@armenzg-thinkpad:~/repos/mozilla-central$ docker run taskcluster/desktop-test:0.5.2 armenzg@armenzg-thinkpad:~/repos/mozilla-central$ docker run -ti taskcluster/desktop-test:0.5.2 root@taskcluster-worker:~# ls -l bin/test.sh -rwxrwxr-x 1 root root 938 Nov 2 22:49 bin/test.sh root@taskcluster-worker:~# echo $DISPLAY :0
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: Taskcluster → Taskcluster Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: