Commit Graph

2203 Commits

Author SHA1 Message Date
mprahl
d46ce667cf Whitelist flake8 in tox 2019-04-03 15:24:20 -04:00
mprahl
bc2a1e8d3c Fix the unit tests 2019-04-03 14:40:52 -04:00
Merlin Mathesius
06e903c3c1 Fixes and test improvements based on review feedback.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-04-03 18:15:59 +00:00
Merlin Mathesius
cd76a1dca5 Update scratch context uniqueness suffix character from '.' to '_'.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-04-03 18:15:59 +00:00
Merlin Mathesius
663b7fc4d0 Allow resubmitting the same NSV for scratch module builds.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-04-03 18:15:59 +00:00
Owen W. Taylor
da57146bf2 GenericBuilder: Add a boolean 'succeeded' parameter to finalize
Previously MockModuleBuilder was checking the module state to see if
it should run a final createrepo, but since eafa93037f, finalize() is
called before changing the module state; add an explicit boolean to
GenericBuilder.finalize() to avoid worrying about ordering.
2019-04-03 18:12:57 +00:00
mprahl
63bccb28ff Use Fedora 29 when developing with Vagrant 2019-04-02 14:35:27 +00:00
Jan Kaluza
4bc6e7ed65 Set the $releasever variable in Mock config. 2019-04-02 14:04:16 +00:00
Chenxiong Qi
0ee801877b Move module build to ready from done according to Greenwave
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-04-02 16:11:43 +08:00
Chenxiong Qi
3992a1f1ac Fix syntax error when checking if --offline is specified in CLI
Signed-off-by: Chenxiong Qi <cqi@redhat.com>
2019-04-02 08:33:20 +08:00
Jan Kaluza
1c535fa755 Set the module_platform_id in the yum.conf 2019-04-01 13:13:08 +00:00
Jan Kaluza
360a8f3b84 Add support for local component repository using file://.
This is needed for offline local builds to build a component which is
stored on local git repository.

This PR also adds OfflineLocalBuildConfiguration configuration class
for offline local builds to set the RESOLVER.
2019-04-01 13:13:08 +00:00
Jan Kaluza
67a5a9d1b0 Allow building module in --offline module with dependencies from local repositories.
There are following changes introduced in this commit:

- The `koji_tag` of module builds imported from the local repositories
  is now in `repofile:///etc/yum.repos.d/some.repo` format to store the
  repository from which the module was imported to local MBS DB.
- The `koji_tag` of fake base module is set to empty `repofile://`
  and in `MockModuleBuilder` the `conf.base_module_repofiles` list
  is used as source for the repositories defining platform. We can't
  simply use single repository, because there might be fedora.repo
  and fedora-update.repo and so on.
- The list of default .repo files for platform are passed using the
  `-r` switch in `build_module_locally` `mbs-manager` command.
- The LocalResolver (subclass of DBResolver) is added which is used
  to resolve the build dependencies when building modules offline
  locally.
- The `MockModuleBuilder` enables the buildrequired modules and
  repositories from which they come in the mock config.

With this commit, it is possible to build testmodule locally
without any external infra.
2019-04-01 13:13:08 +00:00
Jan Kaluza
e43d979bc8 Import modules found in the local repositories to MBS database for Offline local builds.
This is the first PR in many for Offline local builds. This PR:

- Adds --offline flag to build_module_locally mbs-manager command to enable
  offline local builds.
- If this flag is used, new `import_builds_from_local_dnf_repos` method is
  called which uses DNF API to get all the available installable modulemd
  files and imports each module into MBS local SQLite database.
- It also adds fake "platform:stream" module based on the /etc/os-release,
  so the buildrequirements of the imported modules are satisfied.

The idea here is that in upcoming commits, I will create LocalResolver
which will be similar to DBResolver with some extra rules to resolve
local module builds. This new LocalResolver will still be based on
the models.ModuleBuild methods and therefore we need the modules
imported in database.
2019-04-01 13:13:08 +00:00
mprahl
56b234c2bb Update python-ldap3 to 2.6.1 for the unit tests
We had issues in the current released version in EPEL7, this is an
update in testing that we should use once it reaches stable.
2019-03-29 13:11:10 -04:00
Jan Kaluza
d1f6631f3b Fix traceback in MMDResolver when transitive dependency cannot be satisfied.
This fixes problems from #1184 when new platform stream is added and the
input module depends on another module which is not built against this
new platform, but in the same time the input module wants to be built
against this new platform stream. See the unit-test for more info.

The problem is that `MMDResolver.solve()` method sets the `alternative`
to an empty list and stores the data there only if the alternative
is found valid. If the alternative is not found valid, then it stays
set to an empty list, but the code using `alternative` later expects
it to only contains valid alternatives.

This commit fixes this by setting the `alternative` only in a case
we found it is valid alternative.
2019-03-27 06:36:43 +01:00
mprahl
d75c3042c7 Release v2.18.2 v2.18.2 2019-03-25 12:06:40 -04:00
mprahl
9651891d74 Support base modules with x.y.z versioning and no virtual streams 2019-03-25 15:59:06 +00:00
Jan Kaluza
780ed117b4 Find compatible base modules based on the virtual streams.
Before this commit, the compatible base modules for Module Stream Expansion
have been found without any limitation, just based on the stream version.
It was therefore possible that `platform:lp29.0.0` was found as compatible
module for `platform:f29.1.0` although those platform streams are not
compatible at all.

In this commit, the module can be treated as compatible only if it has
the same virtual stream as the input module. The idea behind this
is that both `platform:f29.0.0` and `platform:f29.1.0` should include
the `virtual_streams: [f29]` in their XMD section which tells MBS
that they are actually compatible. The `lp29` stream will not
have the same virtual stream (most likely it won't have any virtual
stream at all).

The `virtual_streams` is already used for this use-case in `MMDResolver`,
but it was not used to limit the inputs to `MMDResolver` which is what
this commit is doing.

This commit also fixes the issue in `get_last_builds_in_stream_version_lte`
which was simply broken if multiple stream_versions of single base module
existed and their builds had different version. In this case, only
builds with single (randomly chosen) version were returned.
2019-03-25 16:53:54 +01:00
mprahl
f81c25d6dd Fix the failing test of test_auth_header_not_set 2019-03-20 20:06:32 +00:00
mprahl
1528cc52c0 Fix the indentation in the virtual modules documentation 2019-03-20 14:40:03 -04:00
mprahl
ff251b14db Release v2.18.1 v2.18.1 2019-03-20 14:25:47 -04:00
mprahl
c65e1b0a53 Log the exception when an invalid modulemd is encountered
This will help us determine why a modulemd couldn't be parsed
other than formatting issues. An example of this is if the database
session becomes stale, the exception is not due to the modulemd being
invalid.
2019-03-20 13:43:24 -04:00
mprahl
40ce635164 Keep the database session alive when checking the base module modulemd 2019-03-20 13:42:28 -04:00
mprahl
803d5409c1 Remove semicolons from virtual modules documentation 2019-03-20 12:04:15 -04:00
Jan Kaluza
1631a1ba4f Release 2.18.0 v2.18.0 2019-03-20 09:22:42 +01:00
mprahl
a8a8913bbc Add the ability to override a buildrequired module stream based on a module's branch
This moves the functionality that was in rpkg to MBS. See the following
PRs for more context:
https://pagure.io/rpkg/pull-request/390
https://pagure.io/rpkg/pull-request/420
2019-03-19 16:45:00 -04:00
mprahl
998084b441 Don't default the module name to "unnamed" on a direct modulemd submission
The module name should either be set in the modulemd file or provided
by the `module_name` parameter.
2019-03-19 08:31:33 -04:00
mprahl
275e7e4509 Remove the concept of required and optional parameters
Since the required parameters vary based on if the modulemd
comes from SCM or a direct submission, the concept of optional
parameters doesn't really apply.
2019-03-19 08:02:39 -04:00
mprahl
6d61a59b13 Clean up the valid API parameters
The MBS submission API endpoint should not accept every parameter
that is also a column on the ModuleBuild table. There are two
reasons for this. The first is that a user should be notified if
the supplied parameter is invalid, whereas it could get silently
ignored. The second reason is that a nefarious user could pass
in specially crafted API parameters causing MBS to do something
unexpected or undesired.
2019-03-19 08:01:23 -04:00
Merlin Mathesius
7b7b07211e Add/improve documentation for scratch module build requests,
particularly for the new 'modulemd' and 'module_name' parameters.

Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-03-19 11:56:47 +00:00
Merlin Mathesius
aaf9eaa6ec Use log.exception when reporting JSON parsing exceptions.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-03-19 11:56:47 +00:00
Merlin Mathesius
a46a4ec470 Accept modulemd for scratch module builds as a parameter in the submitted JSON.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-03-19 11:56:47 +00:00
mprahl
64053e7fed Document virtual platforms 2019-03-19 11:40:20 +00:00
mprahl
3d3da4def1 Fix RHBZ#1686473 2019-03-18 13:30:04 -04:00
Jan Kaluza
765e640129 Allow setting the Koji tag extra options using the conf.koji_tag_extra_opts.
The Koji tag extra options used to be hard-coded and to change them,
we had to release new MBS version.

We do not change them often, but right now fedora-infra is requesting
to use new `mock.new_chroot` option and we need to release new MBS
because of that.

This commit makes such changes easier in the future.
2019-03-18 17:27:57 +00:00
mprahl
40e534ff9d Don't allow a dash in the value that will be used for an RPM disttag
When importing a base module, we must ensure the value that will be
used in the RPM disttags doesn't contain a dash since a dash isn't
allowed in the release field of the NVR.
2019-03-15 13:14:25 -04:00
mprahl
6bb41e786c Add the ability to override the base module marking used in the RPM disttags
MBS uses the base module's stream that was buildrequired by the module
in the RPM disttags for that module build. The stream name may not be
ideal for all situations, so now this is customizable by setting the
xmd['mbs']['disttag_marking'] in the base module's modulemd.
2019-03-15 13:14:25 -04:00
mprahl
63c7a35e4b Instruct the user to delete the container after the test is run 2019-03-15 12:06:51 -04:00
Jan Kaluža
2f70945ba7 Merge #1166 Ignore some SQLAlchemy DeprecationWarnings 2019-03-15 06:47:30 +00:00
Jan Kaluza
9a6646f27c Use the scrmod prefix also for build targets for scratch builds.
Currently, the Koji tags have properly set the scrmod- prefix, but
the build target still sets module- prefix even for scratch builds.

In this commit, build target has the scrmod- prefix too.
2019-03-14 13:10:47 +01:00
Valerij Maljulin
b39f92b820 Categorize log messages
This fixes #1064

Signed-off-by: Valerij Maljulin <vmaljuli@redhat.com>
2019-03-13 13:38:08 +01:00
Filip Valder
14f1b582c9 Ignore some SQLAlchemy DeprecationWarnings 2019-03-12 22:00:53 +01:00
mprahl
b570948484 Don't allow building modules with the same name as a base module (e.g. platform)
A user managed to build a module called "platform", which stopped dependency
resolution from working. This should stop that from happening again.
2019-03-12 14:58:28 -04:00
Jan Kaluza
57d5548105 Fix conversion to bytes in Python3 in tests. 2019-03-12 18:33:27 +00:00
Jan Kaluza
9778812ab5 Version 2.17.0 v2.17.0 2019-03-12 07:51:18 +01:00
Merlin Mathesius
244d873130 Always allow submitting yaml for scratch module builds.
Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
2019-03-08 11:58:46 -06:00
Jan Kaluža
b38feb5deb Merge #1160 Fix the way how KojiContentGenerator computes filesize. 2019-03-07 15:44:43 +00:00
Jan Kaluža
293e74c3a5 Merge #1158 Fix config name MODULES_ALLOW_SCRATCH in docs 2019-03-07 14:58:56 +00:00
Jan Kaluza
04082047fe Fix the way how KojiContentGenerator computes filesize.
The current code reads the data, converts them to unicode string and
then uses the `len()` of that string as filesize. This is wrong,
because Koji expects filesize to be really number of bytes, not number
of characters.

Therefore, in this commit, the filesize is computed from raw data (bytes).
2019-03-07 15:29:16 +01:00