freebsd / poudriere

Port/Package build and test system
https://github.com/freebsd/poudriere/wiki
BSD 2-Clause "Simplified" License
393 stars 162 forks source link

'jail -i -j $JAIL' does not accurately reflect Status #413

Open rootwyrm opened 8 years ago

rootwyrm commented 8 years ago

The 'Status' line from poudriere jail -i -j $JAIL should reflect that a jail is running if it was started from poudriere, but actually does not. This complicates several common activities, such as building a single port from an external job control.

root@teldrassil:/usr/home/obdev # poudriere jail -s -j 9RELEASE-amd64
root@teldrassil:/usr/home/obdev # poudriere jail -i -j 9RELEASE-amd64
Jail name:         9RELEASE-amd64
Jail version:      9.3-RELEASE-p29
Jail arch:         amd64
Jail method:       ftp
Jail mount:        /usr/local/poudriere/jails/9RELEASE-amd64
Jail fs:           poudriere/poudriere/jails/9RELEASE-amd64
Jail updated:      2015-11-01 21:53:51
Tree name:         default
Tree method:       portsnap
Status:
root@teldrassil:/usr/home/obdev # jls
   JID  IP Address      Hostname                      Path
    41  127.0.0.1       teldrassil.REMOVED       /usr/local/poudriere/data/.m/9RELEASE-amd64-default/ref
    42  -               teldrassil.REMOVED       /usr/local/poudriere/data/.m/9RELEASE-amd64-default/ref
root@teldrassil:/usr/home/obdev # pkg info | grep poudriere
poudriere-3.1.14_2             Port build and test system
root@teldrassil:/usr/home/obdev # poudriere version
3.1.14
bdrewery commented 8 years ago

You have a jail mounted, but is it running a testport? It can't be bulk since there's no builder jails listed.

rootwyrm commented 8 years ago

This is correct; as discussed on IRC, it's not impossible (or unlikely) for someone to need to pop up the 'real' build environment for spot work or such and an automated scheduler (i.e. Jenkins) to collide with that. Ultimately, poudriere has no idea of the state of it's own jails, which I see as a fairly significant shortcoming. Status should at minimum accurately reflect any states that were initiated by poudriere including non-build states.

I'm happy to start putting something together to address this. The big question is how should poudriere store non-build state changes (e.g. jail -s $JAIL) so that it can at least avoid assuming someone did something bad? For Status itself, I would propose the following: Started indicating it was started with poudriere jail -s, Stopped indicating it was unmounted by poudriere jail -k, Mounted indicating something outside of poudriere has mounted it, and Unknown if it's showing in jls but poudriere has no knowledge of state.

bdrewery commented 8 years ago

I'll come up with something for this, since you cannot start a testport in this state so it really should be 'running' or 'started' (to go with jail -s)