ToTest Plugin Documentation
===========================
:author: openSUSE Team at SUSE
:toc:


Introduction
------------
[id="intro"]

In the current Factory model,
https://build.opensuse.org/project/show/openSUSE:Factory:ToTest[Factory:ToTest]
represents the project that stores several Factory Snapshots that are
candidates to be released if the measured quality (according to
openQA) is good enough.

This plugin encapsulates several conditions that are needed to decide
if a snapshot can be published or not:

* Check if the overall status of openQA is green.

* Check if all the repositories in openSUSE:Factory can be published.

If Factory meets both criteria, this plugin will publish a new version
of the project openSUSE:Factory:ToTest, if the version is different
from the current Factory.


Setup
------------
[id="cli"]

Create a :ToTest subproject of the project you like to have ttm running. The
user account of the ttm needs to have access, eg.

-------------------------------------------------------------------------------
$ osc meta prj MyProject:ToTest
[...]
<person userid="totest-manager" role="maintainer"/>
[...]
-------------------------------------------------------------------------------

If images or products are meant to be released make sure to set the image type:

-------------------------------------------------------------------------------
$ osc meta prjconf MyProject:ToTest
%if "%_repository" == "images"
%Type: kiwi
%Repotype: staticlinks
%Patterntype: none
%Prefer: openSUSE-release
%endif
-------------------------------------------------------------------------------

In the main project meta, add release targets for the repos that you want to
have released into :ToTest

-------------------------------------------------------------------------------
$ osc meta prj MyProject
[...]
<repository name="images">
  <releasetarget project="MyProject:ToTest" repository="images" trigger="manual"/>
[...]
-------------------------------------------------------------------------------

Configure the attribute for ttm so it knows what to release:

-------------------------------------------------------------------------------
$ cat <<EOF > myattribute
jobs_num: 2
openqa_group: My Product 66.6
openqa_server: https://openqa.opensuse.org
product_repo: images
product_arch: x86_64
products:
  ftp:
  - 000product:MyProduct-ftp-ftp-x86_64
  main:
  - 000product:MyProduct-dvd5-dvd-x86_64
  images:
  - MyProduct-Live:
      - x86_64
take_source_from_product: true
need_same_build_number: true
set_snapshot_number: true
test_subproject: ToTest
EOF
$ osc meta attribute MyProject -c -a OSRT:ToTestManagerConfig -F myattribute
-------------------------------------------------------------------------------

Create a 00Meta package in the main project for ttm to store some metadata:

-------------------------------------------------------------------------------
$ osc meta pkg -e MyProject/00Meta
[...]
<person userid="totest-manager" role="maintainer"/>
[...]
-------------------------------------------------------------------------------

Force release initially

-------------------------------------------------------------------------------
./totest-manager.py release --force MyProject
-------------------------------------------------------------------------------

After that run

-------------------------------------------------------------------------------
./totest-manager.py run MyProject
-------------------------------------------------------------------------------
