Build job constraints can define requirements for the hardware or software of the build host. Constraints can be defined per package or for repositories.
The build constraints for an entire project or specific repositories is part of the project config. For each constraint, it contains a line
Constraint: <SELECTOR> <STRING>
The selector is a colon-separated list.
The build constraints for a package are part of the package sources, as a _constraints XML source file (validated on submission). The _constraints source file can contain the values listed below.
NOTE: If no build host meets the constraints, the package will stay in state "scheduled" and never be dispatched.
hostlabel
# The hostlabel is any string which can be assigned to build hosts when
starting the bs_worker process. It can be used to run on specific hosts,
which may be used for running benchmarks in a reproducible way. This
constraint can also be defined as a negative definition using the
exclude=true
attribute. However, the hostlabel is always specific to one OBS instance.
You should avoid it as much as possible, since building with this constraint
in another instance is usually not possible. Use any of the other
constraints if possible.
Example for _constraints file:
<constraints exclude="false"> <hostlabel>benchmark_runner</hostlabel> </constraints>
Example for project configuration:
Constraint: hostlabel benchmark_runner
sandbox
# Defines the sandbox which is used for the build job. Sandboxes are
chroot, Xen or KVM environments. There is also the virtual secure sandbox,
which allows building on Xen or KVM. This constraints may also be defined as
a negative definition via the exclude=true
attribute.
Example for _constraints
file:
<constraints exclude="true"> <sandbox>secure</sandbox> </constraints>
Example for project configuration:
Constraint: sandbox secure
linux
#The Linux kernel specific part.
To require a specific Linux kernel version.
Example for _constraints file:
<constraints> <linux><version> <min>3.0</min> <max>4.0</max> </version></linux> </constraints>
Example for project configuration:
Constraint: linux:version:min 3.0 Constraint: linux:version:max 4.0
min
#Minimal kernel version.
max
#Maximal kernel version.
flavor
#A specific kernel flavor like default or smp (from kernel packages kernel-default or kernel-smp).
Example for _constraints file:
<constraints> <linux> <flavor>default</flavor> </linux> </constraints>
Example for project configuration:
Constraint: linux:flavor default
hardware
#To require hardware or build instance features.
cpu
#To require a specific Linux kernel version.
flag
#CPU features which are provided by the hardware. On Linux they can be found in /proc/cpuinfo. The flag element may be used multiple times to require multiple CPU features.
Example for _constraints file:
<constraints> <hardware><cpu> <flag>mmx</flag> <flag>sse2</flag> </cpu></hardware> </constraints>
Example for project configuration:
Constraint: hardware:cpu:flag mmx Constraint: hardware:cpu:flag sse2
processors
#To require a minimal number of processors for the build job.
Example for _constraints file:
<constraints> <hardware> <processors>4</processors> </hardware> </constraints>
Example for project configuration:
Constraint: hardware:processors 4
disk
#Hard disk specific.
size
#To require a minimal size of the disk.
Example for _constraints file:
<constraints> <hardware> <disk> <size unit="G">4</size> </disk> </hardware> </constraints>
Example for project configuration:
Constraint: hardware:disk:size unit="G" 4
memory
#Memory specific.
size
#To require a minimal memory size including swap space.
Example for _constraints file:
<constraints> <hardware> <memory> <size unit="M">1400</size> </memory> </hardware> </constraints>
Example for project configuration:
Constraint: hardware:memory:size unit="M" 1400
physicalmemory
#Memory specific.
size
#To require a minimal memory size. Swap space is not taken into account here.
Example for _constraints file:
<constraints> <hardware> <physicalmemory> <size unit="M">1400</size> </physicalmemory> </hardware> </constraints>
Example for project configuration:
Constraint: hardware:physicalmemory:size unit="M" 1400
The constraint handling depends on what is met by the restrictions. The handling starts when there is no worker to fulfill the constraints.
The job will just stay in state scheduled and no further notification is set.
The job will stay in state scheduled and the dispatch details are set to tell the user that this job can take a long time to be built. This will be shown in the Web UI on mouse over and the scheduled state will be highlighted as well.
waiting for 4 compliant workers (4 down)
The (4
down)
means that 4 of the 4 compliant workers are down and that
someone should have a look.
If no worker can handle the constraints defined by the package or project the build job fails. There is also a hint in the build log what has failed.
package build was not possible: no compliant workers (constraints mismatch hint: hardware:processors sandbox) Please adapt your constraints.
osc
#You can check the constraints of a project / package with the osc tool. You have to be in an osc working directory.
osc checkconstraints [OPTS] REPOSITORY ARCH CONSTRAINTSFILE
Either you give a repository and an arch or osc will check the constraints for all repository / arch pairs for the package. A few examples:
# osc checkconstraints
Repository Arch Worker
---------- ---- ------
openSUSE_Leap_42.2 x86_64 1
openSUSE_Leap_42.1 x86_64 1
If no file is given it takes the local _constraints file. If this file does not exist or the --ignore-file switch is set only the project constraints are used.
# osc checkconstraints openSUSE_Leap_42.1 x86_64
Worker
------
x86_64:worker:1
x86_64:worker:2
If a repository and an arch is given a list of compliant workers is returned.
Another command to verify a worker and display the worker information is osc workerinfo.
<worker hostarch="x86_64" registerserver="http://localhost:5252" workerid="worker:1"> <hostlabel>MY_WORKER_LABEL_1</hostlabel> <sandbox>chroot</sandbox> <linux> <version>4.1.34-33</version> <flavor>default</flavor> </linux> <hardware> <cpu> <flag>fpu</flag> <flag>vme</flag> <flag>de</flag> </cpu> <processors>2</processors> <jobs>1</jobs> </hardware> </worker>
It returns the information of the desired worker.