2445 Commits

Author SHA1 Message Date
Jan Kaluza
34dc744041 Version 2.26.0 v2.26.0 2019-08-12 10:54:17 +02:00
Chenxiong Qi
6f1d0b3ad9 Return empty result if short=true is specified on empty list of builds
Fixes #1376

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-11 22:18:38 +08:00
Chenxiong Qi
ac09fb55ba Merge #1379 Start build logs from init event handler 2019-08-09 14:55:11 +00:00
Chenxiong Qi
0917d6aa4d Start build logs from init event handler
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-09 16:47:46 +08:00
Chenxiong Qi
e3b14beacc Allow to run tests in containers in parallel
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-07 21:45:07 +08:00
Valerij Maljulin
e5735efc76 Skip prefix validation for modules in allowed_privileged_module_names and base_module_names
Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2019-08-07 14:17:39 +02:00
Matt Prahl
2690af4142 Merge #1373 Add documentation about dependency resolution 2019-08-07 12:10:34 +00:00
Jan Kaluža
f759a4ec1c Merge #1374 Remove the “All” MMDResolver policy 2019-08-07 06:29:38 +00:00
Jan Kaluža
83570f59fd Merge #1368 Ignore *.pyc for building test images and install pytest<5.0 for py2 test image 2019-08-06 11:10:25 +00:00
Jan Kaluža
758cf9c112 Merge #1365 Allow components to be reused from module builds even if the buildrequires commit hashes changed for the changed-and-after rebuild strategy 2019-08-06 11:08:46 +00:00
Chenxiong Qi
30b03c2ca6 Remove the “All” MMDResolver policy
Fixes #1339

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-06 10:52:55 +08:00
Chenxiong Qi
51c3b39a52 Install pytest<5.0 for building py2 test image
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-06 10:21:03 +08:00
Chenxiong Qi
13c7e450e5 Ignore *.pyc for building test images
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-06 10:21:03 +08:00
Chenxiong Qi
b185b51721 Merge #1375 Fix name s2nsvc in MMDResolver.solve 2019-08-06 01:50:17 +00:00
Chenxiong Qi
b5df1457c4 Merge #1363 Rewrite import_mmd 2019-08-06 01:48:42 +00:00
mprahl
a6bf9f88dd Allow components to be reused from module builds even if the buildrequires commit hashes changed for the changed-and-after rebuild strategy
This behavior was not documented, and it was confusing to users since module builds
in a stream should always have a compatible API.
2019-08-05 09:23:44 -04:00
Jan Kaluža
602e93589a Merge #1367 Fix the database migrations 2019-08-05 08:53:44 +00:00
Chenxiong Qi
9c6c4da80f Rewrite import_mmd
* xmd/mbs is always set if it is not present in xmd, so move the code on
  the top of function. This change is also helpful for accessing keys
  under xmd/mbs.
* By setting xmd/mbs in the beginning, code is simplified to get
  disttag_marking and virtual_streams. The result is much straightforwar
  for getting a default value for them.
* Move disttag_marking validation code next to the line getting
  disttag_marking from xmd/mbs. As a result, the code structure is
  easier to read as getting disttag_marking and validate it, getting
  virtual_streams and validate.
* Rewrite the part of code for check_buildrequires. Always set
  xmd/mbs/buildrequires if it is not present and check_buildrequires is
  set to True, as it is required by
  ModuleBuild.get_buildrequired_base_modules.
* Using in operator instead of dict.get to check if key koji_tag exists.
  Using dict.get would be ambiguous because even if koji_tag exists
  under xmd/mbs, but due to its value is set to None occasionally, there
  is still a message logged to tell koji_tag is not set.
* Rwrite all lines of code for updating virtual streams. A new method
  update_virtual_streams is added to ModuleBuild. This also fixes
  FACTORY-4561.
* Tests are added for the rewrite of virtual streams update.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-05 16:10:57 +08:00
Chenxiong Qi
3b95b09408 Fix name s2nsvc in MMDResolver.solve
The original name s2nsvc does not contain the name of arch.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-05 16:09:29 +08:00
Jan Kaluža
bc18a592ff Merge #1370 Increase the timeout when running the unit tests in Jenkins 2019-08-05 07:55:46 +00:00
mprahl
530136a522 Add documentation about dependency resolution
This was written with the help of Jan Kaluža.

Co-authored-by: Jan Kaluža <jkaluza@redhat.com>
2019-08-02 15:49:47 -04:00
Matt Prahl
49465fc761 Merge #1372 Allow to run specific test in py3 test container 2019-08-02 16:39:23 +00:00
Chenxiong Qi
df66d4f1b2 Allow to run specific test in py3 test container
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-08-02 23:40:18 +08:00
mprahl
671f78965b Increase the timeout when running the unit tests in Jenkins 2019-08-02 11:07:19 -04:00
Valerij Maljulin
aa8fae180f Ignore mbstest.db in git
Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2019-08-02 16:35:50 +02:00
mprahl
84e3f6f437 Add a missing foreign key constraint that was missed in 40b2c7d988d7_add_reused_module_id_column.py 2019-08-02 09:33:16 -04:00
mprahl
971aade159 Add SQLite support for the downgrade function in 40b2c7d988d7_add_reused_module_id_column.py 2019-08-02 09:32:41 -04:00
mprahl
f13b7308e1 Add a missing column in 0b00036c540f_add_log_messages_table.py 2019-08-02 09:32:41 -04:00
mprahl
4f3692c711 Fix a flake8 error in 0b00036c540f_add_log_messages_table.py 2019-08-02 09:04:45 -04:00
Jan Kaluža
8dd65a79fa Merge #1340 Added an REST endpoint to display log messages 2019-07-31 12:49:03 +00:00
Martin Curlej
c5d484fb81 Added an REST endpoint to display log messages
The issue is that users don't get feedback from MBS about why a
component was not reused. There was added logic which enables to
store log messages in the database and can be viewed through the
REST api of MBS.

Ticket-ID: #1284

Signed-off-by: Martin Curlej <mcurlej@redhat.com>
2019-07-31 13:32:33 +02:00
Valerij Maljulin
5fb6a2f28a Check dependencies in reuse
Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2019-07-31 11:23:52 +02:00
Chenxiong Qi
308f5bc7cf Serialize component build state trace correctly if state is None
Fixes #1179

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-29 15:56:30 +08:00
Jan Kaluža
24e3d0a31c Merge #1358 Reduce duplicate libsolv API calls 2019-07-25 04:55:30 +00:00
Jan Kaluža
26c816f04c Merge #1356 Refactor make_module for tests 2019-07-23 10:50:19 +00:00
Qixiang Wan
ab8abef058 Fix recover_orphaned_artifact for module-build-macros
When recover_orphaned_artifact is called for module-build-macros
and the module-build-macros is not tagged in the -build Koji tag,
then the tag_artifacts() is called to tag it there.

This is correct, but the issue is that module-build-macros need
to be added to "build" and "srpm-build" Koji tag groups, otherwise
it is not installed in the buildroot by default.
2019-07-23 16:11:27 +08:00
Chenxiong Qi
965d2ab2d4 Reduce duplicate libsolv API calls
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-22 23:32:05 +08:00
Matt Prahl
efb0ab307e Merge #1354 Make fetch_mmd public 2019-07-22 13:59:21 +00:00
Chenxiong Qi
b242b12136 Remove handling of negative deps in _deps2reqs
Fixes #1338

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-22 15:24:07 +08:00
Chenxiong Qi
5017fbae7f Refactor make_module for tests
The original motivation for this refactor is to reuse make_module and
drop TestMMDResolver._make_mmd. Some tests require a modulemd created
and some tests also require those modulemd to be stored into database as
a module build. The problem is db_session has to be passed to
make_module even if no need to store into database.

Major changes in this patch:

* Argument db_session is optional.
* Arguments requires_list and build_requires_list are replaced by a
  single argument dependencies which is a list of group of requires and
  buildrequires
* A new make_module_in_db is created for creating and storing the new
  modulemd into database conveniently.
* Tests are updated with the new make_module and make_module_in_db.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-22 10:07:53 +08:00
Chenxiong Qi
0d6a26b71e Make fetch_mmd public
fetch_mmd was imported at other places like in views.py for
ImportModuleAPI. So, make it public.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-19 09:29:05 +08:00
Chenxiong Qi
68fe2b69f1 Allow to run tests with PostgreSQL inside Vagrant machine
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-19 06:34:08 +08:00
Chenxiong Qi
7a38c730e4 Merge #1353 Adjust logs for reading logs easily 2019-07-18 22:33:16 +00:00
Chenxiong Qi
4b1ab34c84 Log full modulemd in debug level in modules.wait handler
A full modulemd is usually a loooon text. This change would be much
easier for reading logs at INFO level only.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-18 22:57:42 +08:00
Chenxiong Qi
9d6a34a8e4 Show state name in state transition log
This will show log like "State transition: init -> wait, ...", which is
much straightforward than showing state number "state 1->2".

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-18 22:57:42 +08:00
Chenxiong Qi
3b938dba26 No need of argument component_id for ComponentBuild.state_trace
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-18 22:27:59 +08:00
Chenxiong Qi
f5717e3469 Fix incorrect error message and method call on ComponentRpm
When resubmitting a module build, if some component is found out that
its attributes have changed, MBS will raise an error to stop the work to
recording components. The problem is original code tells a module build
exists in database already rather than a component build, meanwhile
get_module_name() call on an ComponentRpm object is also incorrect.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-18 22:09:45 +08:00
Chenxiong Qi
26033bd8f7 Reuse ComponentBuild.from_component_name in tests
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-18 22:09:41 +08:00
Chenxiong Qi
5028746a2f Fix arguments passed to log.debug
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-18 22:08:42 +08:00
Chenxiong Qi
3878affa41 Separate use of database sessions
This patch separates the use of database session in different MBS components
and do not mix them together.

In general, MBS components could be separated as the REST API (implemented
based on Flask) and non-REST API including the backend build workflow
(implemented as a fedmsg consumer on top of fedmsg-hub and running
independently) and library shared by them. As a result, there are two kind of
database session used in MBS, one is created and managed by Flask-SQLAlchemy,
and another one is created from SQLAclhemy Session API directly. The goal of
this patch is to make ensure session object is used properly in the right
place.

All the changes follow these rules:

* REST API related code uses the session object db.session created and
  managed by Flask-SQLAlchemy.
* Non-REST API related code uses the session object created with SQLAlchemy
  Session API. Function make_db_session does that.
* Shared code does not created a new session object as much as possible.
  Instead, it accepts an argument db_session.

The first two rules are applicable to tests as well.

Major changes:

* Switch tests back to run with a file-based SQLite database.
* make_session is renamed to make_db_session and SQLAlchemy connection pool
  options are applied for PostgreSQL backend.
* Frontend Flask related code uses db.session
* Shared code by REST API and backend build workflow accepts SQLAlchemy session
  object as an argument. For example, resolver class is constructed with a
  database session, and some functions accepts an argument for database session.
* Build workflow related code use session object returned from make_db_session
  and ensure db.session is not used.
* Only tests for views use db.session, and other tests use db_session fixture
  to access database.
* All argument name session, that is for database access, are renamed to
  db_session.
* Functions model_tests_init_data, reuse_component_init_data and
  reuse_shared_userspace_init_data, which creates fixture data for
  tests, are converted into pytest fixtures from original function
  called inside setup_method or a test method. The reason of this
  conversion is to use fixture ``db_session`` rather than create a
  new one. That would also benefit the whole test suite to reduce the
  number of SQLAlchemy session objects.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-07-18 21:26:50 +08:00