BobBuildTool/bob

bob archive behavior

mahaase opened this issue · 5 comments

hi, I tried bob archive for first time, but the it doesn't work like expected.

command: bob archive clean --dry-run "meta.package == \"x86_64::linux/image::ros\""

the jenkins job config:

Roots: x86_64::linux/image::ros
Prefix: x86_64-linux-ros-
Obsolete jobs: delete
Download: enabled
Upload: enabled
Clean builds: enabled
Sandbox: enabled

The result of the command: just all (552) artifacts stored in the "artifactory".

Inside the factory there are just recipes related the this one jenkins job: image, dependencies and sandbox(es).

I expected, that the result would be empty?!

This is indeed unexpected. Could you have a look at the audit trail of the top level artifact? Obviously the package name in the "meta" section is different. I'm curious what it is really...

The others then are transitive problems. If the root package artifact is not kept then the other artifacts are unreferenced as well and will be deleted...

ohh i realized, that the root-package hasn't built on jenkins, but all dependencies are fine. if e.g. an automated scripted would called this bob archive command now, all fine dependencies would be deleted.

Yes. Unless you specify it by some other means. The archive command will delete everything that is neither matched directly by the retention expression nor indirectly by some other retained artifact.

If you want to make sure that intermediate results are kept, even if they are not referenced, you have to match them directly with the expression somehow (e.g. by a custom meta env tag). It's also a good idea to match all artifacts that are at least one or two days old (e.g. build.date >= \"$(date -u -Idate -d-2days)\", see the manpage for more examples). Otherwise you could loose intermediate artifacts if "bob archive" runs while a build is running and the root package was not built yet.

for productive system, this will be a very long expression-chain, at least for all projects/variants and so on. i understand the system, thanks!

for productive system, this will be a very long expression-chain, at least for all projects/variants and so on. i understand the system, thanks!

I doesn't need to be complicated. You could build your production artifacts with some custom meta environment tag (bob build -M mode=release or bob jenkins [add|set-options] -o audit.meta.mode=release) and match on this via bob archive 'meta.mode == "release"'. It really depends on how fine grained you want to garbage collect your artifacts...