Please note that this patch does not change the use of database session
in MBS. So, in the frontend, the database session is still managed by
Flask-SQLAlchemy, that is the db.session. And the backend, running event
handlers, has its own database session created from SQLAclehmy session
API directly.
This patch aims to reduce the number of scoped_session created when call
original function make_db_session. For technical detailed information,
please refer to SQLAlchemy documentation Contextual/Thread-local
Sessions.
As a result, a global scoped_session is accessible from the
code running inside backend, both the event handlers and functions
called from handlers. The library code shared by frontend and backend,
like resolvers, has no change.
Similarly, db.session is only used to recreate database for every test.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This will result in the error actually being in the state reason
of the failed module build instead of "An unknown error occurred
while validating the modulemd".
This change deploys a KDC using the c3i-library (https://pagure.io/c3i-library) and configures MBS
to require Kerberos authentication for submitting builds to the frontend.
The original code before changing to is_unbuilt is to check if any
component builds in current batch has state None. This patch fixes that.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
A new method _map_message is added for converting a message object to
corresponding event handler and module build. This is used to shorten the
process_message method.
process_message is refactored so that:
* when handler is NO_OP, just return as earlier as possible because setting it
make no sense to set MBSConsumer.current_module_build_id back and forth.
* Re-raise error thrown from handler execution so that the caller is able to
get a chance to collect monitoring metric inside except clause handling
Exception. Otherwise, no failed metric is collected. This is the major
problem this patch is to fix.
* Ensure MBSConsumer.current_module_build_id is set back to None.
In consumer method, no traceback is logged inside except clause catching
Exception. process_method does that.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
It is not necessary to initialize the build variable before following
if-elif-else branch.
After the if-elif-else branch, if no build is found, process_message
just returns immediately. So, no need to check if build is None during
handling error raised from handler call.
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This is the first step to have some tests, that we could run against an
MBS instance, to check that it's functionally correct. Ultimately, these
will replace the test scripts (`contrib/test-*`).
This doesn't really do anything yet, but I would like to make sure that
everyone is on the same page regarding how this will be set up.
Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
After merging #1469, CI runs are failing on the merge step
11:33:39 fatal: proposed/devel-build-modulemd - not something we can merge
This seems to be caused by the change to the fetch line. It seems older versions
of git might have slightly different behavior when asked to fetch a branch name.
With the use of C3IaaS, resource contention in the main OpenShift project will
be dramatically reduced. This allows jobs to run in paralle, increasing throughput
and reducing lag time for feedback on changes.