Commit df9eba37 authored by Diego Giovane Pasqualin's avatar Diego Giovane Pasqualin
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !1
parents 11024222 b4420e29
Pipeline #10622 failed with stages
in 24 minutes and 33 seconds
package/debian/le-conf
package/debian/le-conf.debhelper.log
package/debian/le-conf.substvars
package/debian/le-conf.*.debhelper
package/debian/files
package/debian/debhelper-build-stamp
le-conf_*.tar.xz
le-conf_*.build
le-conf_*.dsc
le-conf_*.changes
le-conf_*.deb
build.sh
## Template para empacotamento utilizando o Gitlab-ci.
stages:
- build
- test
- deploy
build:
stage: build
artifacts:
paths:
- build/
tags:
- ubuntu
- regular
script:
- if [ ! -d "package/debian/" ] ; then exit 1; fi
# TODO: find a way to get the dependencies automatically
# - apt-get update && apt-get --allow-downgrades --allow-remove-essential --allow-change-held-packages install -y libc6=2.23-0ubuntu9 libc-bin=2.23-0ubuntu9
- apt-get update && apt-get install -y build-essential devscripts dh-make dh-systemd quilt adwaita-icon-theme apt autopoint bf-utf-source check dctrl-tools debconf debconf-utils debhelper devio dh-autoreconf dh-di dh-systemd dpkg-dev gir1.2-soup-2.4 gir1.2-timezonemap-1.0 gir1.2-webkit2-4.0 gir1.2-xkl-1.0 gobject-introspection imagemagick intltool intltool-debian iso-codes isoquery keymapper libbogl-dev libcairo2-dev libdebconfclient0-dev libdebian-installer4-dev libgirepository1.0-dev libglib2.0-dev libgtk-3-dev libido3-0.1-dev libindicator3-dev libiw-dev liblocale-gettext-perl libparted-dev librsvg2-bin libsubunit-dev locales pep8 pkg-config po-debconf pyflakes3 python-gi-dev python-scour python3-all python3-apt python3-cairo python3-dbus python3-gi python3-gi-cairo python3-icu python3-mock python3-pam tzdata ubuntu-artwork udev wget xkb-data xkb-data-i18n xvfb
- LINE=$(head -n 1 package/debian/changelog)
- PACKAGE=$(echo $LINE | cut -d' ' -f1)
- VERSION=$(echo $LINE | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
- tar --exclude=debian -czf ${PACKAGE}_${VERSION}.orig.tar.gz package/*
- cd package ; debuild -us -uc
- cd ../
- mkdir build/
- rm ubiquity-*
- rm oem*
- mv ${PACKAGE}* build/
- echo "Estágio de Build finalizado."
test:
stage: test
tags:
- ubuntu
- regular
script:
# TODO: find a way to get the dependencies automatically
- export DEBIAN_FRONTEND=noninteractive
- apt-get update && apt-get -q -y install libc6 libdebconfclient0 libdebian-installer4 libiw30 libparted-fs-resize0 libparted2 debconf init-system-helpers lsb-base python3:any ubiquity-frontend-gtk ubiquity-artwork-2.21.63.3 laptop-detect lsb-release ubiquity-casper python3-apt console-setup iso-codes passwd adduser os-prober rdate ntfs-3g ecryptfs-utils cryptsetup policykit-1 python3-icu python3-pam language-selector-common archdetect-deb dpkg-repack apt-clone wget grub-common dbus-x11 sbsigntool
- dpkg -i build/*.deb
- echo "Estágio de Teste finalizado"
dependencies:
- build
deploy:
stage: deploy
only:
- master
tags:
- ubuntu
- regular
script:
- echo "Estágio de Deploy"
- apt-get update && apt-get install -y dput ssh
- eval $(ssh-agent -s)
- ssh-add <(echo "$PRIV_KEY")
- dput -u -f --config=dput.cf repo build/*.changes
- echo "Estágio de Deploy finalizado"
dependencies:
- build
[repo]
fqdn = repo.c3sl.ufpr.br
method = scp
incoming = /home/repository/www/le6/incoming
allow_unsigned_uploads = 1
ssh_config_options = User=repository
StrictHostKeyChecking=no
post_upload_command = ssh -l repository -i ~/.ssh/id_rsa repo.c3sl.ufpr.br "reprepro -Vb /home/repository/www/le6 processincoming default"
limit = 0
unusedNames = [ '_', 'empty', 'unused', 'dummy', 'dummypkg', 'args', 'kwargs', ]
blacklist = [ 'subprocess', 'Tkinter', 'wxPython', 'gtk', 'GTK', 'GDK', 'apt', 'debconf', ]
maxLocals = 50 # arguably scripts/install.py:copy_all should be fixed ...
## Process this file with automake to produce Makefile.in
SUBDIRS = data pixmaps po src
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = m4/ChangeLog
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update
#! /bin/sh -e
if ! type intltool-update >/dev/null 2>&1; then
echo "Install intltool and try again." >&2
exit 1
fi
autoreconf -I m4 -fi
intltoolize --copy --force --automake
# We want to keep po/ubiquity.pot in the source package.
sed -i '/rm .*\$(GETTEXT_PACKAGE)\.pot/s/ \$(GETTEXT_PACKAGE)\.pot//' \
po/Makefile.in.in
Introduction
============
This document describes how to setup and run automated autopilot tests of
Ubiquity. These testcases work for Ubuntu, Xubuntu and Lubuntu. and should work
for all other flavours of Ubuntu.
Source code: `lp:ubiquity`
Tests use python3 version of autopilot.
When this code is modified, check that it is compliant with PEP8 and there is
no pyflakes error by executing the following command in the top directory of
the checkout:
$ fakeroot debian/rules check
Project Structure
=================
The project is structured as follow:
* *autopilot/* Contains the tests, the runner and a wrapper for autopilot and
ubiquity
* *ubiquity-autopilot-runner/* Runner to setup a VM from an ISO
and execute autopilot tests
* *config/* Contains configuration examples to override default values of
the runner
* *custom-installation/iso-override/* Content of this directory will
override the content on the ISO
* *jenkins/* Scripts, templates and configuration files to deply jenkins
jobs
* *ubiquity_autopilot_tests/* Autopilot tests
Running the tests
=================
Directly from a Live Session
----------------------------
Install the following dependencies :
$ sudo apt-get install python-autopilot libautopilot-gtk python-xlib
To run the tests, open 2 terminals.
Run in Terminal 1 :
$ cd ubiquity/autopilot
$ ./run_ubiquity
To execute the test *test_english_default* Run in Terminal 2:
$ cd ubiquity/autopilot
$ ./autopilot run ubiquity_autopilot_tests.tests.test_english_default
Other tests are available from *ubiquity_autopilot_tests/tests/*. To get a list
of available tests run:
$ autopilot-py3 list ubiquity_autopilot_tests.tests
On a local machine with the runner
----------------------------------
* Install the following dependencies:
$ sudo apt-get install bsdtar qemu-system-x86 bzr xz-utils cpio
* Download a desktop image from *http//cdimage.ubuntu.com/*
* Execute the command:
$ ./ubiquity-autopilot-runner/run-ubiquity-test <ISO>
e.g
$ ./ubiquity-autopilot-runner/run-ubiquity-test ~/iso/ubuntu/trusty-desktop-amd64.iso
* If you want to watch what is running use option `--sdl`
* If your system have enough memory you can run tests in memory (in /dev/shm
actually) with option `-s|--shm`
* And of course `-h|--help` for a list of available options
* At the end of the run, results are collected in `/tmp/ubiquity.tests`
Executing in Jenkins
====================
Execute the tasks below on the slave:
* Create a user called `ubiquity`. This account will pull all the code
required to execute the tests. It can update the code without any specific
jenkins privileges. You can then import ssh keys of the person you want to
be able to manage this account.
* Create a directory `$HOME/bin` for this user.
* Branch ubiquity trunk:
$ bzr branch lp:ubiquity
* Branch ubuntu-qa-tools (to get the script `dl-ubuntu-test-iso`)
$ bzr branch lp:ubuntu-qa-tools
* Get the script `download-latest-test-iso.py` from the project
`lp:ubuntu-server-iso-testing`. This script is a wrapper around
dl-ubuntu-test-iso that adds additional checksums validation, cache and lock
handling to run multiple time in parallel.
$ bzr cat lp:ubuntu-server-iso-testing/download-latest-test-iso.py > ~/bin/download-latest-test-iso.py
$ chmod 755 ~/bin/download-latest-test-iso.py
* Create the following links in ~/bin/
$ ln -s ~/ubuntu-qa-tools/dl-ubuntu-test-iso/dl-ubuntu-test-iso ~/bin
$ ln -s ~/ubiquity/autopilot/ubiquity-autopilot-runner/jenkins/publish2jenkins
* On **jenkins server** create an account in jenkins with job management
privileges.
* On the slave create a credential file in ~/.jenkins.credentials for the
account create on the server with the following content:
<INSTANCE>: # Name of the instance, must match SERVER in publish2jenkins
username: <JENKINS USER NAME>
password: <JENKINS PASSWORD>
url: <JENKINS SERVER URL>
token: <REMOTE JOBS TOKEN>
* Login as **user jenkins** and create the directory `bin`
* Create the same symlinks than symlinks in `/home/ubiquity/bin/`
$ find /home/ubiquity/bin/ ! -type d -exec ln -s {} $HOME/bin/ \;
$ ln -s /home/ubiquity/ubiquity/autopilot/ubiquity-autopilot-runner/ ubiquity-autopilot-runner
* **Logout** from user jenkins
* As **user ubiquity** deploy jenkins jobs:
$ publish2jenkins
* If it runs without error, verify that jenkins jobs are created or updated if
they already existed on `<JENKINS SERVER URL>`
* On **jenkins server** create the following jenkins views:
* **Main** view is a `nested view` that defaults to `All`
* **All** view is a `dashboard view` with the following configuration:
* Regular expression to include jobs: `ubiquity_ap.*`
* Left portlet: `Unstable jobs` and `Jobs statistics`
* Right portlet: `Latest builds`
* Bottom portlet: `Jenkins jobs list`
* Each **flavor view** is a list view with a regular expression to include
jobs set to `ubiquity_ap-<FLAVOR>_.*` . Replace `<FLAVOR>` by the name of
the flavor.
The hierachy of jobs is:
* `ubiquity_ap-<flavor>_devel_daily-download`: Monitor the publication of new
images, download the image and start a new run
* `ubiquity_ap-<flavor>_devel_daily-run`: Run all the tests for a given
flavor.
* `ubiquity_ap-flavor_devel_daily-<test>`: Executes a test for a flavor.
This is a matrix job with an architecture axis. Supported architectures
are amd64 and i386.
There is one job for each test defined in the flavor
configuration file in `ubiquity-autopilot-runner/jenkins/config/`
The tests will start automatically when a new image is available. This is done
a URL content's change trigger that monitor the URL defined in the flavor
configuration file; for example
`http://cdimage.ubuntu.com/daily-live/pending/MD5SUMS`
You can run a specific flavor manually from jenkins by running the job
`ubiquity_ap-ubuntu_devel_daily-download` if there is no ISO already downloaded
on the system, or `ubiquity_ap-ubuntu_devel_daily-run` is an ISO is already
present.
To modifiy jenkins configuration, do not do it directly from the UI but instead
either modify the template in
`ubiquity/autopilot/ubiquity-autopilot-runner/jenkins/templates/` or the configuration
of the flavor in `ubiquity/autopilot/ubiquity-autopilot-runner/jenkins/config/`
To add a new flavor, add a configuration file for the flavor in
`ubiquity/autopilot/ubiquity-autopilot-runner/jenkins/config/`.
To add/remove/modify the list of autopilot tests to run for a flavor, change it
in its configuration file.
Contact Information
-------------------
Authors:
Dan Chapman <dpniel@ubuntu.com>
Jean-Baptiste Lallement <jean-baptiste.lallement@ubuntu.com>
Report Autopilot tests or test runner bugs at: http://bugs.launchpad.net/ubiquity
#!/bin/sh
. /var/log/installer/autopilot
export DBUS_SESSION_BUS_ADDRESS
export UBIQUITY_PID
# Disable X access control to let root access :0
xhost +
sudo -E autopilot3 $@
#!/bin/sh
. /var/log/installer/autopilot
export DBUS_SESSION_BUS_ADDRESS
export UBIQUITY_PID
# Disable X access control to let root access :0
xhost +
#launch vis using autopilot py2
sudo -E autopilot vis
#!/bin/sh
sudo dbus-launch ubiquity --autopilot
#
# Example configuration file for the test runner
# This file allows user to override some of the variables defined in the
# testrunner
#
# Branch to fetch containing autopilot tests
TSBRANCH=lp:ubiquity
# Additional artifacts to collect at the end of the test
ARTIFACTS="/var/log/upstart/"
# Additional options for autopilot
# -f xml <FILE> is always appended to this option
AP_OPTS="-v"
# By default the test environment powers off at the end of the test. Set this to
# 0 to keep it running
SHUTDOWN=0
# Extra packages to install. EXTRAPACKAGE is appended to PACKAGES defined in the
# runner
EXTRAPACKAGES="eatmydata"
# Test timeout.
# Note that this apply to autopilot running inside the test environment and
# doesn't affect the global timeout of the runner set in the main script
TIMEOUT=600
# Debug Mode
# Set to 1 to enable debug mode. This will start an xterm in the live session
# for example.
DEBUG=1
#!/bin/sh
#
# Put here every steps that must be executed on the target system and can not
# be done with the iso-override facility
#
PREREQ=""
DESCRIPTION="Running custom script..."
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
. /scripts/casper-functions
log_begin_msg "$DESCRIPTION"
sed -i 's/^%admin.*/%admin ALL=(ALL) NOPASSWD: ALL/' /root/etc/sudoers
# Workaround feature described in LP: #1283619
SHELL=/bin/sh chroot /root 2>/dev/null <<EOF
echo
echo "INFO: Applying workaround for 'tutorial' feature LP: #1283619"
mkdir -p /home/ubuntu/.cache/unity/
touch /home/ubuntu/.cache/unity/first_run.stamp
chown -R 999:999 /home/ubuntu
EOF
log_end_msg
deb http://archive.ubuntu.com/ubuntu/ RELEASE main restricted universe multiverse
# Default rules for rsyslog.
#
# For more information see rsyslog.conf(5) and /etc/rsyslog.conf
#
# First some standard log files. Log by facility.
#
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/dev/ttyS0
*.*;auth,authpriv.none -/var/log/syslog
#cron.* /var/log/cron.log
#daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
#user.* -/var/log/user.log
#
# Logging for the mail system. Split it up so that
# it is easy to write scripts to parse these files.
#
#mail.info -/var/log/mail.info
#mail.warn -/var/log/mail.warn
mail.err /var/log/mail.err
#
# Logging for INN news system.
#
news.crit /var/log/news/news.crit
news.err /var/log/news/news.err
news.notice -/var/log/news/news.notice
#
# Some "catch-all" log files.
#
#*.=debug;\
# auth,authpriv.none;\
# news.none;mail.none -/var/log/debug
#*.=info;*.=notice;*.=warn;\
# auth,authpriv.none;\
# cron,daemon.none;\
# mail,news.none -/var/log/messages
#
# Emergencies are sent to everybody logged in.
#
*.emerg *
#
# I like to have messages displayed on the console, but only on a virtual
# console I usually leave idle.
#
#daemon,mail.*;\
# news.=crit;news.=err;news.=notice;\
# *.=debug;*.=info;\
# *.=notice;*.=warn /dev/ttyS0
# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
# busy site..
#
daemon.*;mail.*;\
news.err;\
*.=debug;*.=info;\
*.=notice;*.=warn |/dev/xconsole
[Desktop Entry]
Encoding=UTF-8
Name=Fire-up Autopilot tests for Ubiquity
Comment=Starts the Autopilot tests
Exec=/usr/local/bin/run-autopilot.sh -R
Terminal=false
Type=Application
Categories=
X-GNOME-Autostart-Delay=10
#!/bin/sh
#
# This script runs autopilot
#
# Copyright © 2013-2014 Canonical Ltd.
# Author: Jean-baptiste Lallement <jean-baptiste.lallement@canonical.com>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2, as published by the
# Free Software Foundation.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
set -eu
# Lock management to prevent this script of running twice
LOCKFILE=/tmp/$(basename $0).lock
if [ -e ${LOCKFILE} ] && kill -0 $(cat ${LOCKFILE}); then
echo "W: $(basename $0) already running. Exiting!"
exit
fi
echo $$>${LOCKFILE}
# The following variables can be overridden with a configuration file
TSBRANCH=lp:ubiquity
EXTRAPACKAGES=""
ARTIFACTS=""
AP_OPTS="-v"
SHUTDOWN=1
TIMEOUT=1200 # 20min timeout
DEBUG=0
SHAREDVOL=""
# Custom configuration
# Do not use the variable TESTBASE because we don't want it to be overridden
[ -f /var/local/autopilot/config ] && . /var/local/autopilot/config
TESTBASE=/var/local/autopilot/
AP_ARTIFACTS=$TESTBASE/videos/
AP_RESULTS=$TESTBASE/junit/
AP_LOGS=$TESTBASE/logs/
AP_TESTSUITES=$TESTBASE/testsuites
AP_LOGFILE=$AP_LOGS/autopilot.log
AP_SUMMARY=$AP_LOGS/summary.log
AP_INFO=$AP_LOGS/build_info.txt
RMD_OPTS="-r -rd $AP_ARTIFACTS --record-options=--fps=6,--no-wm-check"
SPOOLDIR=$TESTBASE/spool
TSEXPORT=$HOME/ubiquity-autopilot
SESSION_LOG=""
# Append mandatory artifacts
ARTIFACTS="$TESTBASE /var/log/installer /var/log/syslog $HOME/.cache/upstart /var/crash $ARTIFACTS"
# Specific configurations for various DE
if [ -n "${SESSION+1}" ]; then
case $SESSION in
ubuntu) # Covers Ubuntu and Edubuntu
SESSION_LOG=$HOME/.cache/upstart/gnome-session.log
;;
xubuntu)
SESSION_LOG=$HOME/.cache/upstart/startxfce4.log
;;
Lubuntu)
SESSION_LOG=$HOME/.cache/lxsession/Lubuntu/run.log
ARTIFACTS="$ARTIFACTS $HOME/.cache/lxsession"
;;
esac
elif [ -n "${DESKTOP_SESSION+1}" ]; then
# These 2 don't seem to log apt stuff to syslog
# And there doesn't seem to be a user session log???
# So let's tail it and also include in the artifacts
case $DESKTOP_SESSION in
mate) # Covers Ubuntu-mate
SESSION_LOG=/var/log/apt/term.log
ARTIFACTS="$ARTIFACTS /var/log/apt"
;;
gnome) #ubuntu-gnome
SESSION_LOG=/var/log/apt/term.log
ARTIFACTS="$ARTIFACTS /var/log/apt"
;;
esac
else
echo "I: Unknown SESSION"