Current BrewSignRPMEvent and BrewSignRPMEventHandler is specific to single signed RPM, but in the end it rebuilds Docker image with all the RPMs from advisory. This makes it hard to track the advisory rebuild in database and API, because it is stored there as "BrewSignRPMEvent". The real event we are building based on is when "all RPMs in advisory are signed" and not when "single RPM is signed".
When advisory contains multiple packages, we are completely ignoring them and just rebuild based on the last BrewSignRPMEvent. So if there is httpd and apr in advisory and apr is signed as the last one, we are rebuilding docker image just with "apr-*" RPMs, and not with httpd.
When there are multiple concurrent advisories, for example httpd and nss advisory, we are not rebuilding httpd advisory with updated nss packages.
How are these problems solved
New ErrataAdvisoryRPMsSignedEvent is introduced. This event represents the state of Errata advisory when all its RPMs are signed.
Scope of BrewSignRPMHandler is changed heavily. It now only checks whether all the RPMs in advisory in which the signed RPM belongs to are signed. If they are signed, it emits internal ErrataAdvisoryRPMsSignedEvent which is handled by the ErrataAdvisoryRPMsSignedEventHandler. This handler does the rebuild work done by BrewSignRPMHandler previously.
ErrataAdvisoryRPMsSignedEventHandler works similarly like old BrewSignRPMHandler, but it finds out Docker images to rebuild for every package in advisory (not just the single one) and also generates the ODCS compose for every package in advisory.
ErrataAdvisoryRPMsSignedEventHandler also finds out the list of extra ErrataAdvisoryRPMsSignedEvent which were rebuilding the same Docker image as the currently handled event. For example, if we rebuilt image foo as a result of NSS advisory and now we are rebuilding httpd docker image which depends on foo, ErrataAdvisoryRPMsSignedEventHandler will trigger rebuild of httpd and foo images with the packages from NSS advisory and also with packages from httpd advisory.
This is done by introduction of models.Event.released bool which if False until the Errata is not in SHIPPED_LIVE state. Freshmaker listens for the errata.activity.state.change messages to update this bool.
Freshmaker tries to find out those extra_events in all unreleased events - the events for which the errata is not in SHIPPED_LIVE state.
Problems this PR solves
BrewSignRPMEventandBrewSignRPMEventHandleris specific to single signed RPM, but in the end it rebuilds Docker image with all the RPMs from advisory. This makes it hard to track the advisory rebuild in database and API, because it is stored there as "BrewSignRPMEvent". The real event we are building based on is when "all RPMs in advisory are signed" and not when "single RPM is signed".How are these problems solved
ErrataAdvisoryRPMsSignedEventis introduced. This event represents the state of Errata advisory when all its RPMs are signed.BrewSignRPMHandleris changed heavily. It now only checks whether all the RPMs in advisory in which the signed RPM belongs to are signed. If they are signed, it emits internalErrataAdvisoryRPMsSignedEventwhich is handled by theErrataAdvisoryRPMsSignedEventHandler. This handler does the rebuild work done byBrewSignRPMHandlerpreviously.ErrataAdvisoryRPMsSignedEventHandlerworks similarly like oldBrewSignRPMHandler, but it finds out Docker images to rebuild for every package in advisory (not just the single one) and also generates the ODCS compose for every package in advisory.ErrataAdvisoryRPMsSignedEventHandleralso finds out the list of extraErrataAdvisoryRPMsSignedEventwhich were rebuilding the same Docker image as the currently handled event. For example, if we rebuilt imagefooas a result of NSS advisory and now we are rebuildinghttpddocker image which depends onfoo,ErrataAdvisoryRPMsSignedEventHandlerwill trigger rebuild ofhttpdandfooimages with the packages from NSS advisory and also with packages fromhttpdadvisory.models.Event.releasedbool which if False until the Errata is not in SHIPPED_LIVE state. Freshmaker listens for theerrata.activity.state.changemessages to update this bool.