Add a resource for the installed version of Ubuntu

Bug #1865526 reported by Jeff Lane 
6
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

Revision history for this message
Pierre Equoy (pieq) wrote :

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]
--------------[ Running job 1 / 2. Estimated time left: 0:00:06 ]---------------
----------[ Collect information about installed system (lsb-release) ]----------
ID: com.canonical.certification::lsb
Category: com.canonical.plainbox::uncategorised
... 8< -------------------------------------------------------------------------
distributor_id: Ubuntu
description: Ubuntu 18.04.4 LTS
release: 18.04
codename: bionic
------------------------------------------------------------------------- >8 ---
Outcome: job passed
--------------[ Running job 2 / 2. Estimated time left: 0:00:01 ]---------------
-------------------------------[ pieq/over2004 ]--------------------------------
ID: com.canonical.certification::pieq/over2004
Category: com.canonical.plainbox::uncategorised
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.

Revision history for this message
Jeff Lane  (bladernr) wrote :

perfect... that's exactly what I was looking for.

Changed in plainbox-provider-resource:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.