IBM / dbb-zappbuild

zAppBuild is a generic build solution for building z/OS applications using Apache Groovy build scripts and IBM Dependency Based Build (DBB) APIs.
Apache License 2.0
41 stars 140 forks source link

HowTo - Modify records created by zAppbuild at runtime #281

Closed FALLAI-Denis closed 1 year ago

FALLAI-Denis commented 1 year ago

Hi,

I need is to manage the current construction report and to access the EXECUTE record of a step (MVSExec), either to remove attributes from this record, or to add attributes to this record, (and in particular the outputs attribute). For this I need to find this particular record in the construction report: no direct acces for this.

I can find this record with the buildReport.getRecords() method and by filtering the list to isolate the desired EXECUTE record but then I have no method to modify the record, and in particular to delete all or part of the Outputs of the EXECUTE record.

Is there a way to intervene on a (EXECUTE) record created by zAppbuild before the build report is saved in the DBB Collections?

dennis-behm commented 1 year ago

@FALLAI-Denis ,

the BuildReport is stored/persisted at the end of the build process :

https://github.com/IBM/dbb-zappbuild/blob/99624f601019ca6483023eb00c9d420535ced6d4/build.groovy#L692-L709

You should be able to obtain the BuildReport through the BuildReportFactory and even make updates to it before saving the BuildResult .

The CreateUCDComponentVersion script for example is removing outputs without a deployType or when the type is ZUNIT on a BuildReport object.

Persisting information is controlled via the report(true) and deployType('DBRM') options. I think you have opened another thread which is talking about your issue on the ibm/dbb repository (if I am not mistaken). Assuming this is the same area, you have two options:

1) Modify the BuildReport, see above OR 2) Skip documenting the DBRM in the scripts but invoke when needed an additional MVSExec step, which just invokes an IEFBR14 but registers an output through the above API. I assume this to be "cheaper" than rescanning the expanded source for example.

FALLAI-Denis commented 1 year ago

Hi @dennis-behm

Thanks for your response and your great help.

I apply same solution as CreateUCDComponentVersion script for removing unwanted output. Works fine! 👍 👏