ARPA-SIMC / moncic-ci

Continuous integration tool and development helper.
GNU General Public License v2.0
2 stars 0 forks source link

Keep build logs as artifacts #67

Closed spanezz closed 2 years ago

spanezz commented 2 years ago

It is possible, and I think desirable, to save build logs among the artifacts. It's also possible, with python logging, to use INFO or DEBUG levels for storing build logs, independently on the requested log level at the terminal.

Build logs can then also contain a dump of Moncic, System, Container, and Run configs used for the build

spanezz commented 2 years ago

I implemented keeping a file with build logs inside the container in /srv/moncic-ci/buildlog.

In Debian builds, this is stored as an artifact by build_debian.Debian.collect_artifacts.

RPM builds could do the same in build_arpa.ARPA.collect_artifacts, but I don't know how to give the build log a good name. @edigiacomo do you have some ideas?

edigiacomo commented 2 years ago

Naming things is generally a very difficult task, but let's try it :)

The name could be derived from package name and version of the RPM, e.g.

$(rpmspec --query --srpm --queryformat="%{name}.%{version}"  SPECFILE).log

We could use a moncic as prefix/suffix to highlight that the log is created by this tool.

What do you think @spanezz @brancomat ?

brancomat commented 2 years ago

The name could be derived from package name and version of the RPM, e.g.

$(rpmspec --query --srpm --queryformat="%{name}.%{version}"  SPECFILE).log

We could use a moncic as prefix/suffix to highlight that the log is created by this tool.

Ok! I'd suggest adding the release information too, something like:

moncic-$(rpmspec --query --srpm --queryformat="%{name}.%{version}.%{release}"  SPECFILE).log

(for the record, rpmspec tool is a part of rpm-build package that should be already installed in redhat-derived distro images)

spanezz commented 2 years ago

Ok, since the artifact collection code runs in the host system which may not be a rpm system, I'm looking at the other artifacts collected, and if I see one that ends in .src.rpm, I use that as its basename.

If no .src.rpm has been produced (say, in case of some build failure), then I use the $(basename $specfile .spec).buildlog

Would that work?

spanezz commented 2 years ago

And I just realised that all the nice smart things I did for this for debian builds only work if the host system has dpkg-parsechangelog :/

spanezz commented 2 years ago

Ok, we have a good approximation now, with the same basic strategy for debian and rpm systems, that works without needing foreign tooling installed