Add a resource for the installed version of Ubuntu
Bug #1865526 reported by
Jeff Lane
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Checkbox Provider - Resource |
Invalid
|
Undecided
|
Unassigned |
Bug Description
As we add tests that may depend on a specific version of Ubuntu (or later) it could be very useful to have some sort of resource job that can be used as a constraint when defining jobs, for instance:
id: myjobs/foo
requires:
installed.version > 18.04
which would mean that foo will only run if the installed version is later than 18.04
To post a comment you must log in.
Hi Jeff!
There is already such a feature in Checkbox: lsb.release.
For instance, if I write the following two jobs:
plugin: shell
id: pieq/is1804
requires: lsb.release == "18.04"
estimated_duration: 1
command: true
plugin: shell
id: pieq/over2004
requires: lsb.release >= "20.04"
estimated_duration: 1
command: true
and run them on a 18.04 device:
$ checkbox-cli run .*pieq.*
======= ======= ======= ======[ Running Selected Jobs ]====== ======= ======= ======= = [6/3224] certification: :lsb plainbox: :uncategorised ------- ------- ------- ------- ------- ------- ------- ------- ------- --- ------- ------- ------- ------- ------- ------- ------- ------- ------- --- >8 --- ------- ------- ------- ---[ pieq/over2004 ]------ ------- ------- ------- ----- certification: :pieq/over2004 plainbox: :uncategorised
--------------[ Running job 1 / 2. Estimated time left: 0:00:06 ]---------------
----------[ Collect information about installed system (lsb-release) ]----------
ID: com.canonical.
Category: com.canonical.
... 8< -------
distributor_id: Ubuntu
description: Ubuntu 18.04.4 LTS
release: 18.04
codename: bionic
-------
Outcome: job passed
--------------[ Running job 2 / 2. Estimated time left: 0:00:01 ]---------------
-------
ID: com.canonical.
Category: com.canonical.
Job cannot be started because:
- resource expression 'lsb.release >= "20.04"' evaluates to false
Outcome: job cannot be started
======= ======= ======= ======= ======[ Results ]====== ======= ======= ======= ======= =
☑ : Collect information about installed system (lsb-release)
☑ : pieq/is1804
☐ : pieq/over2004
I've played with it a bit and it seems to work as expected. Keep in mind that the comparison here is made on the string and not on the numbers, but it behaves as expected since Python sorts the strings properly in this case.
If that answers your question, you can mark this issue as Invalid.