62 Commits

Author SHA1 Message Date
Brendan Reilly
23f77986e2 Add authentication for product pages 2025-04-29 10:01:31 -04:00
Brendan Reilly
b175c827cf Nudge non-scratch builds stuck in done
Fixes #1783
2025-03-18 15:59:22 -04:00
Mike McLean
1870748249 provide missing fields in api 2023-03-23 13:26:11 +00:00
Owen W. Taylor
e776a77048 Redirect createrepo_c output to the build logs
It's more useful to have the createrepo_c output in the build logs
than cluttering the build stdout.
2023-03-20 10:58:59 -04:00
Owen W. Taylor
646b0590ee MBSConsoleHandler: show status of ongoing repository downloads
When downloading files from Koji to make a local repository, display
a temporary status of which files are being displayed to the console
appended after any log messages. Updates are done by erasing the status
that was written, adding a log message, then writing the status again.
2023-03-15 17:16:24 +00:00
Owen W. Taylor
f5100609aa Filter console output through a special handler
When running in local mode, add a special handler that filters log
messages to the console to produce attractive output. Implemented
behaviors include:

 - INFO level messages are only displayed if done through
   MBSLogger.console() rather than MBSLogger.info().
 - Timestamps and thread names are omitted unless the local build
   is started with the -d option
 - Warning/error messages have the level highlighted in red
 - Special handling can be added to log messages, initially:
    - Long running operations can be displayed to the console as
      "Doing foo ... <pause>done"
2023-03-15 17:16:24 +00:00
Owen W. Taylor
a276a33969 LocalBuildConfiguration: log to <build_dir>/build.log not <build_dir>/build-2.log
Since the build log is already within the a build-specific directory, we
don't need to put the build ID (which ends up always being "2") into the
build log filename.
2023-03-07 18:33:30 +00:00
Owen W. Taylor
1c8e2a07d8 Local builds: buffer up initial logs and replay to the module build file
Logging during a build that occurs before the build directory is created
used to be logged to the console, but not retained in the build log
file. This made referring to the build log file confusing. Solve this
by buffering logs in memory until the log file is created and replaying
them.

A little bit of hackery is needed to avoid saving dangling references to
libsolv objects.
2023-03-07 18:33:30 +00:00
jmicanek
8709c632b0 Allow krb ccache to be configured
Access to the kernel keyring may be restricted in containers. Allow users to specify non keyring ccache for kerberos.
2023-02-27 18:35:53 +01:00
Mike McLean
f6dcf6c346 switch to using gssapi_login for koji
Fixes https://pagure.io/fm-orchestrator/issue/1777

koji recently dropped this old call
https://pagure.io/koji/pull-request/3599

Previously, koji was ignoring the ctx arg and wrapping gssapi_login,
so this change is completely equivalent to the old behavior.
2023-02-22 10:22:53 -05:00
Owen W. Taylor
b6c11f83d8 Improve handling of configuration file
* Allow MBS_CONFIG_FILE="" to entirely suppress loading any configuration
   file (useful for running tests and avoiding loading a system-wide
   configuration file.)
 * When loading the configuration file:
   * If the default configuration file path doesn't exist, silently fall back
     to the default configuration
   * For any other OSError, print the exact error
   * Let any other exception throw through, to allow people to debug their
     configuration file
2023-01-23 18:39:25 -05:00
Brendan Reilly
d4c213d678 Resolve issues reported by bandit 2022-07-21 09:09:12 -04:00
Brendan Reilly
c24038198e Merge #1672 Don't pass SQLAlchemy objects between threads 2022-05-13 16:47:07 +00:00
Brendan Reilly
f4040c09f4 Merge #1670 Go back to using a file-backed SQLite database for tests 2022-05-03 18:35:13 +00:00
Brendan Reilly
a06d1a678d Merge #1746 Add default branch configuration option 2022-05-03 16:48:24 +00:00
Brendan Reilly
6b76877d6d Merge #1661 MBSResolver - caching, tests, fixes 2022-05-03 16:42:22 +00:00
Owen W. Taylor
7761bbf5b4 Tweak behavior of get_compatible_base_module_modulemds
Fix some oddities in the DBResolver implementation of
get_compatible_base_module_modulemds() and make the MBSResolver version -
which was previously just buggy - match that. (Tests for the MBSResolver
version are added in a subsequent commit.)

 * If an empty virtual_streams argument was passed in, *all* streams
   were considered compatible. Throw an exception in this case - it
   should be considered an error.
 * If stream_version_lte=True, but the stream from the base module
   wasn't in the form FOOx.y.z, then throw an exception. This was
   previously treated like stream_version_lte=False, which is just
   a recipe for confusion and mistakes.

test_get_reusable_module_use_latest_build() is rewritten to
comprehensively test all possibilities, including the case that changed
above.

test_add_default_modules_compatible_platforms() is changed to run
under allow_only_compatible_base_modules=False, since it expected
Fedora-style virtual streams (versions not in FOOx.y.z form, all
share the same stream), which doesn't make sense with
allow_only_compatible_base_modules=True.
2022-04-29 15:47:08 -04:00
Owen W. Taylor
c4230a352d LocalBuildConfiguration: Set ALLOW_ONLY_COMPATIBLE_BASE_MODULES = False
The default LocalBuildConfiguration builds against Fedora - which has
ALLOW_ONLY_COMPATIBLE_BASE_MODULES = False on the server side. Match that
to avoid warnings that f33 isn't in <stream>x.y.z form.
2022-04-29 15:47:08 -04:00
Owen W. Taylor
e48983132c Clarify the meaning conf.allow_only_compatible_base_modules=False
config.allow_compatible_base_modules=False does different things for
build-requires selection and for module reuse. Clarify this in the config
key documentation.

(This config key is really: True: "do what RHEL expects"
False: "do what Fedora expects")
2022-04-29 15:47:08 -04:00
Owen W. Taylor
5dcd63ebf9 batches.py: Don't pass SQLAlchemy objects between threads
SQLAlchemy objects can't be used from multiple threads - so when starting
threads for builds, pass the ComponentBuild id rather than the object.
(Note that despite the comment that the threads were sharing a session,
they weren't - what was passed to the thread was a scoped_session that
acts as a separate thread-local session per-thread.)

BUILD_COMPONENT_DB_SESSION_LOCK - a threading.Lock() object that was used
in a few places - but not nearly enough places to effectively lock usage
of a shared session - is removed.
2022-04-26 17:04:40 -04:00
Owen W. Taylor
a96774a1fd Go back to using a file-backed SQLite database for tests
Using a memory database causes tests/test_build to intermittently
fail, because using the same pysqlite3 connection object from multiple
threads - as was done so that the threads shared the same memory database
- is not, in the end, thread safe. One thread will stomp on the transaction
state of other threads, resulting in errors from starting a new transaction
when another is already in progress, or trying to commit a transaction
that is not in progress.

To avoid a significant speed penalty, the session-scope fixture sets up
a database in the pytest temporary directory, which will typically be on
tmpfs. Time to complete all tests:

 memory backend:               38 seconds
 file on tmpfs:                40 seconds
 file on nvme ssd with btrfs: 137 seconds

MBSSQLAlchemy, which attempted to make the memory backend work, is removed.

Session hooks are installed on the Session class rather than on the
scoped_session instance - this works better when we're changing from
one database to another at test setup time.
2022-04-26 16:59:59 -04:00
Owen W. Taylor
e06a7e33cd Move 'Connecting to koji <url>' messages to debug 2022-04-25 12:27:02 -04:00
Owen W. Taylor
53d35e546d Local builds: avoid 'Hub not initialized. Queueing on the side' warnings
We don't need messages at all for local builds, so use a separate "drop"
backend and reserve the "in_memory" backend for tests, where we sometimes
want to inspect the messages. This avoids a warning for each published
message.
2022-04-25 12:27:01 -04:00
Brendan Reilly
6cd10004c8 Add default branch configuration option
Fixes: #1735
2022-04-13 10:42:53 -04:00
Brendan Reilly
4a30847bea Remove Greenwave Code
No implementations of MBS are using Greenwave, and there are no current plans
to do so. Koji Resolver will be sufficient for any usecase dependent on gating.
2022-03-30 14:27:34 -04:00
Brendan Reilly
2cb057daf6 update 2021-08-12 15:53:53 -04:00
Brendan Reilly
39add4382c Clarify common 500 errors 2021-08-12 15:48:37 -04:00
Brendan Reilly
1883fa8567 Update handler name used by SQLAlchemy 2021-08-12 11:50:46 -04:00
Joe Talbott
06d31786e8 Improve error messaging for module submission.
Fixes: https://pagure.io/fm-orchestrator/issue/1098
2021-07-29 16:34:03 -04:00
Brendan Reilly
669318f1fd Exclude specific platform streams from stream expansion
Fixes: #1639
2021-07-29 15:15:03 -04:00
Joe Talbott
1957d7db86 resolve: Fix docstring. 2021-06-25 15:49:09 -04:00
Joe Talbott
f1a3025a9a resolve: Update docstring with added return field. 2021-06-25 15:49:09 -04:00
Joe Talbott
b3203caf76 List missing streams in exception message.
Fixes: https://pagure.io/fm-orchestrator/issue/1574
2021-06-25 15:49:09 -04:00
Mike McLean
7b56c6429e strict_module_state_transitions config option
Fixes: https://pagure.io/fm-orchestrator/issue/1678
2021-06-15 15:05:06 -04:00
Mike McLean
a8adfd4f74 defer commit of module entry until we set the context and validate 2021-05-13 11:36:53 -04:00
Mike McLean
872320a230 use scm_stream instead of scm.branch 2021-05-13 11:05:35 -04:00
Mike McLean
1f37c646f7 add allow_dashes_in_svc config option 2021-05-06 12:05:07 -04:00
Mike McLean
42f5f82a89 allow setting multiple schedule task names for product pages
this adds a new setting, product_pages_schedule_task_names, which
is the list version of product_pages_schedule_task_name.
2021-04-22 15:52:19 -04:00
Mike McLean
865296b8c7 fix flake8 issues 2021-04-21 14:41:23 -04:00
Brendan Reilly
d0579a16c1 Fix mmd.copy calls to support PackagerV3
Fixes #1685
2021-03-10 15:00:42 -05:00
Martin Curlej
7976b1f084 Added the support for the new libmodulemd v3 packager format.
This will enable building modules from the new libmodulemd v3 format.
This format fixes major issue with modularity which enables clear
upgrade paths for multicontext modules.

Signed-off-by: Martin Curlej <mcurlej@redhat.com>
2021-03-03 13:01:50 +01:00
jobrauer
8a5bf3a579 Move ComponentBuildTrace creation from before_commit to before_flush
Since ComponentBuildTrace(s) get created with db_session.commit() call,
is is not possible to commit more items in bulk if they already have been flushed.

Current unit-tests' setup can be significantly sped up if items can be quickly
flushed on the fly and bulk-commited only once at the end. Moreover in general it
seems more appropriate/safer to handle this in before_flush as any implicit
or accidental flush could cause new build traces not to be created at all. As flush
is implicitly called before every commit anyway, this change shouldn't pose any harm.
2020-07-13 05:55:45 +00:00
mprahl
fee1dff8d0 Honor the MBS_CONFIG_SECTION environment variable when performing a local build 2020-03-17 17:08:27 -04:00
Brendan Reilly
88597a7c92 Check schedule date when adding new streams 2020-03-05 16:28:42 -05:00
Chenxiong Qi
1c0715662a Cleanup module_build_service/__init__.py
Most of the code are moved to dedicated subpackages, but some others
can't due to the cycle dependencies.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2020-03-03 14:48:48 -05:00
Chenxiong Qi
81b36b1d6e Add indexes to ModuleBuild and ComponentBuild
Tests are updated accordingly as well.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2020-03-03 14:48:47 -05:00
Chenxiong Qi
b70c632a70 Send module build state change message after commit to database
In MBS, there are two cases to send a message when a module build moves
to a new state. One is to create a new module build, with
ModuleBuild.create particularly, when user submit a module build.
Another one is to transition a module build to a new state with
ModuleBuild.transition. This commit handles these two cases in a little
different ways.

For the former, existing code is refactored by moving the publish call
outside ModuleBuild.create.

For the latter, message is sent in a hook of SQLAlchemy ORM event
after_commit rather than immediately inside the ModuleBuild.transition.

Both of these changes ensure the message is sent after the changes are
committed into database successfully. Then, the backend can have
confidence that the database has the module build data when receive a
message.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2020-03-03 14:48:47 -05:00
mprahl
f1f92a4d25 Use an in-memory SQLite database to run the tests
This change was lost from the following PR during a rebase:
https://pagure.io/fm-orchestrator/pull-request/1511
2020-03-03 14:48:47 -05:00
mprahl
81f2bffdda Rearrange the imports to meet the style guide
This also includes `from __future__ import absolute_import`
in every file so that the imports are consistent in Python 2 and 3.
The Python 2 tests fail without this.
2020-03-03 14:48:47 -05:00
mprahl
c10a6769ed Move scm.py to common/scm.py 2020-03-03 14:48:47 -05:00