Commit Graph

2578 Commits

Author SHA1 Message Date
Chenxiong Qi
cab9cb8ee3 Merge #1479 Minor fixes to consume and process_message 2019-10-30 01:24:38 +00:00
Chenxiong Qi
251239621d Refactor consume and process_message
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>
2019-10-29 22:22:10 +08:00
Chenxiong Qi
fa227698ef Fix wrong value passed to ModuleBuild.transition state argument
state argument expects an int value represeting a module build state
rather than a string value.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-10-29 22:19:46 +08:00
Chenxiong Qi
4bebd13872 Fix wrong argument name in docstring and assert its value
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-10-29 22:19:46 +08:00
Chenxiong Qi
3bdbdaee20 Remove unnecessary code from process_message
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>
2019-10-28 20:49:52 +08:00
Matt Prahl
0596dad784 Merge #1477 Do not drop realm from user's kerberos principal name 2019-10-25 14:56:50 +00:00
Matt Prahl
1de4cfcc64 Merge #1476 Use the new internal container registry 2019-10-25 14:55:21 +00:00
Chenxiong Qi
d1026c0df7 Do not drop realm from user's kerberos principal name
Save the realm and just keep the variable there for any further possible
use.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-10-25 13:46:54 +08:00
Hunor Csomortáni
0066c79dae Bootstrap integration tests
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>
2019-10-24 10:16:16 +02:00
Luiz Carvalho
246cae6328 Use the new internal container registry
Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
2019-10-23 17:49:19 -04:00
Mike McLean
2b5deca8ec Merge #1464 Fix the name field in modulemd text for -devel builds 2019-10-21 22:12:44 +00:00
Mike Bonnet
6868454fcc increase build timeouts 2019-10-18 10:29:29 -07:00
Mike McLean
e90fa30841 revert part of #1469
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.
2019-10-18 12:13:02 -04:00
Matt Prahl
9379e9ac9c Merge #1469 avoid shallow clone, but limit second fetch to branch under consideration 2019-10-18 15:24:35 +00:00
Matt Prahl
5fc3e0a73f Merge #1467 use C3I-as-a-Service to allocate a dynamic project for building and testing 2019-10-18 15:20:23 +00:00
Mike McLean
920c4efa46 avoid shallow clone, but limit second fetch to branch under consideration 2019-10-18 11:18:10 -04:00
Mike McLean
107df94776 fix unit test 2019-10-18 09:44:45 -04:00
Mike McLean
dbcb0f30d1 drop unnecessary parentheses 2019-10-18 09:44:45 -04:00
Mike McLean
5e854f503d adjust unit test 2019-10-18 09:44:45 -04:00
Mike McLean
620263c34b combine common code 2019-10-18 09:44:45 -04:00
Mike McLean
ad6afecc69 also fix build.extra 2019-10-18 09:44:45 -04:00
Mike McLean
8a83a17c53 update devel case assertion 2019-10-18 09:44:45 -04:00
Mike McLean
8581b9d02f adjust name for devel builds in modulemd.txt 2019-10-18 09:44:45 -04:00
Mike McLean
72621277f3 Merge #1465 run-unittests.sh: docker pull needed images 2019-10-17 15:13:55 +00:00
Mike McLean
1b02a45331 no need to update database image 2019-10-17 11:06:20 -04:00
Mike Bonnet
78ee32bc83 enable parallel job execution
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.
2019-10-17 07:32:16 -07:00
Mike Bonnet
f86b736c70 use C3I-as-a-Service to allocate a dynamic project for building and testing
The C3I-as-a-Service system (https://pagure.io/c3i-library/blob/master/f/c3iaas)
enables creation of new OpenShift projects, which will be deleted after a
configurable period of time, and are suitable for building and testing proposed
changes. The MBS-Koji integration tests now make use of C3IaaS, to reduce resource
contention and avoid false failures due to quota limitations.
2019-10-17 07:32:16 -07:00
Chenxiong Qi
9fd3731ff7 Remove KerberosAuthenticate and get kerberos username from REMOTE_USER
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-10-17 10:20:59 +08:00
Mike McLean
120681806b update script options in CONTRIBUTING doc 2019-10-15 11:17:51 -04:00
Mike McLean
0d8af77ce4 run-unittests.sh: docker pull needed images
Related: https://pagure.io/fm-orchestrator/issue/1463
2019-10-15 11:14:10 -04:00
Jan Kaluza
eeb65c97da KojiResolver: Filter module builds based on the real stream name.
Query Koji for the real stream name of each module and keep only those matching
requested `stream`.

This needs to be done, because MBS stores the stream name in the "version" field in Koji,
but the "version" field cannot contain "-" character. Therefore MBS replaces all "-"
with "_". This makes it impossible to reconstruct the original stream name from the
"version" field.

We therefore need to ask for real original stream name here and filter out modules based
on this real stream name.
2019-10-14 14:13:34 +02:00
Jan Kaluža
578d6f1e33 Merge #1461 Add KojiResolver doc. 2019-10-11 07:36:29 +00:00
Jan Kaluza
3fedb14483 Add KojiResolver doc. 2019-10-11 09:34:19 +02:00
Matt Prahl
74bf638cdc Merge #1458 Only use default modules that were built with the same base module 2019-10-09 12:44:52 +00:00
Jan Kaluža
514e4c115a Merge #1457 Make reuse_shared_userspace_init_data faster 2019-10-09 05:24:00 +00:00
mprahl
27f4d71392 Only use default modules that were built with the same base module 2019-10-08 11:38:39 -04:00
Chenxiong Qi
800f606b83 Make reuse_shared_userspace_init_data faster
* A significant performance improvement is to avoid repeating call of
  mmd.get_xmd() in a looping.
* Function is refactored to avoid call of mmd_to_str twice for a module
  build.
* Test using this fixture already has a setup_method to clean database,
  so no need to call clean_database again.
* Calculate build context directly without calculating other contexts
  together.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-10-08 11:30:50 +08:00
Jan Kaluza
339c1ef98d Add KojiResolver to config.SUPPORTED_RESOLVERS. 2019-10-07 12:52:13 +02:00
Jan Kaluza
5ffdeb4649 Fallback to DBResolver in KojiResolver.get_compatible_base_module_modulemds.
In case KojiResolver is not enabled for the base module, fallback to
DBResolver in `KojiResolver.get_compatible_base_module_modulemds`.
2019-10-04 15:22:35 +02:00
Jan Kaluža
9e38493112 Merge #1452 Support KojiResolver in MBSResolver. 2019-10-04 06:45:39 +00:00
Jan Kaluza
72d2c3daf4 Support KojiResolver in MBSResolver.
If KojiResolver is enabled for buildrequired base module and
MBSResolver is used, then `MBSResolver.get_buildrequired_modulemds`
will use KojiResolver to get the list of buildrequired module builds.

Otherwise it uses the current behavior.

To implement this, the `KojiResolver.get_buildrequired_modules` was
split into two methods:

- `get_buildrequired_koji_builds` returns buildrequired Koji builds.
- `get_buildrequired_modules` calls `get_buildrequired_koji_builds`
  and finds the corresponding ModuleBuilds in MBS DB.
2019-10-04 07:43:11 +02:00
Mike McLean
e9946fcd00 Release v2.29.1 v2.29.1 2019-10-03 16:37:02 -04:00
mprahl
540e2ceac3 Fix a fork in the database migration scripts 2019-10-03 16:29:47 -04:00
Mike McLean
bbe10fd2da Release 2.29.0 v2.29.0 2019-10-03 15:10:54 -04:00
Valerij Maljulin
2c0291987f Raise Unathorized exception instead of general one whenever OIDC auth fails
This fixes #1147
2019-10-03 17:02:33 +02:00
Valerij Maljulin
689d949a48 buildonly support
This fixes #1307

Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2019-10-03 16:20:04 +02:00
Jan Kaluža
6e34e50c18 Merge #1451 Add support for KojiResolver in component reuse code. 2019-10-03 13:16:00 +00:00
Jan Kaluza
486dc39898 Add support for KojiResolver in component reuse code.
In this commit, when component reuse code finds out that the base module uses
KojiResolver, it uses the `KojiResolver.get_buildrequired_modules` method
to find out possible modules to reuse and limits the original query just
by the IDs of these modules.

In order to do that, this commit splits the original
`KojiResolver.get_buildrequired_modulemds` into two methods:

- The `get_buildrequired_modules` returning the ModuleBuilds.
- The `get_buildrequired_modulemds` calling the `get_buildrequired_modules`
  and returning modulemd metadata.
2019-10-03 15:14:29 +02:00
mprahl
8c6cfb702d Use small license headers in the Python files
This also removes the outdated comments around authorship of each
file. If there is still interest in this information, one can just
look at the git history.
2019-10-03 08:47:24 -04:00
Matt Prahl
df295516e3 Merge #1449 Use double quotes instead of single quotes to match the style guide 2019-10-02 13:57:36 +00:00