Commit graph

106 commits

Author SHA1 Message Date
Michal Konečný
0e4c7d5c53 Deprecation of the project 2024-09-12 12:38:29 +00:00
Pierre-Yves Chibon
c69cc689c1 Strip the bugzilla email in case it has trailing spaces
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-09-01 11:05:48 +02:00
Pierre-Yves Chibon
0083b8ee66 Update the versions available on bugzilla for the rpms and the containers
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-08-20 14:13:29 +02:00
Pierre-Yves Chibon
74a550ecd3 Only report namespace mis-configuration once and not always
Basically, instead of reporting that the namespace did not exist for
every package/component in that namespace, we now only report it once
per namespace (but we still print the full info in the logs if verbose
is enabled).

Then, instead of always emailing the admins for mis-configurations, we'll
only email them if there are other errors then these which will happen
all the time due to the flatpaks and tests namespaces which do not exist
in PDC and bugzilla.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-08-20 12:54:51 +02:00
Pierre-Yves Chibon
809b88e328 Wait for 10 seconds instead of 20 when querying bugzilla failed
This should make the script a little faster and 10 seconds should be
enough.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-08-20 12:54:18 +02:00
Pierre-Yves Chibon
6428a58b06 Drop the bz_product_name override
Instead of having a product name and an override via the bz_product_name
just use always the product name.

This fixes the issue around "Fedora Container Images" which were somehow
not cached from bugzilla. This led to the script trying to create them
instead of updating them, which of course failed since they did exist
in bugzilla.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-08-20 12:48:14 +02:00
Pierre-Yves Chibon
438b5c806d Fix inverting the user cache
In the previous commit we changed the key from ``bugzilla_email``
to simply ``email`` to be consistent with the data we retrieve
from FAS, but it looks like we forgot to update this method which
thus results in the script failing with a KeyError on
``bugzilla_email``.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-08-18 10:23:31 +02:00
Pierre-Yves Chibon
5088abf327 Retrieve the email field rather than the bugzilla_email one
The bugzilla_email relies on a user id -> email mapping that is kept
in python-fedora fedora/client/fas2.py.
That mapping is out-dated and, in fact, conflicts with the one used
in this project in email_overrides.toml.

So instead of retrieving the bugzilla_email, we retrieve the regular
email and use our, up to date and maintained mapping to do the
overrides.

Otherwise, we end up in the situation described at:
https://pagure.io/fesco/issue/2460#comment-669474
where user A was marked as having an invalid account because they had
a bugzilla_email entry that was returning an invalid bugzilla account.
Changing to use the email field led to more people having invalid
accounts because their mapping had not been updated.
So let's make sure that mapping remains up to date now and use only
one.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-08-06 12:46:50 +02:00
Pierre-Yves Chibon
e9cc33ff09 Fix the branch_regex for Fedora EPEL so that it also matches on el6
This was reported by a former maintainer of the freerdp rpm where the
Fedora EPEL CC list was not being updated because the only EPEL branch
still active in PDC was the el6 branch. Thus the script was never
matching Fedora EPEL as being still active and as a result it was not
updating it.

By adjusting the regex, we solve this issue.

Fixes https://pagure.io/fedora-infrastructure/issue/9122

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-07-09 21:45:00 +02:00
Pierre-Yves Chibon
3f1611f6c3 Add the possibility to ignore some users
These users, who should only ever be CC'ed to a project, will not
be synced to bugzilla.
In other words, they are allowed to not have a bugzilla account
and that should not impact the syncing of the default assignee and
CC list from dist-git to bugzilla.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-06-14 17:48:44 +02:00
Pierre-Yves Chibon
392627ecab Run black over the entire project
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-04-29 11:41:28 +02:00
Pierre-Yves Chibon
d37f60b474 Fix a couple of issues with the patch reading overrides from pagure_poc.json
The patch contained a full-bloom syntax error.
It also did not record the POC for every product but Fedora EPEL.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-04-28 17:39:07 +02:00
Karsten Hopp
56c6472266 Read EPEL POC from pagure_poc.json instead of fedora-scm-requests
Signed-off-by: Karsten Hopp <karsten@redhat.com>
2020-04-28 08:37:06 +00:00
Pierre-Yves Chibon
abf7b7f747 Disable in bugzilla components that are retired in Fedora
This way components that are retired in Fedora will not get any new bug
report.

Fixes https://pagure.io/fedora-infrastructure/issue/7639

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-04-22 15:06:42 +02:00
Pierre-Yves Chibon
3ed514eaa1 Store the email in lower case and do the comparison in lower case as well
While keeping a recording of the case-sensitivity set by the user.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-01-13 15:05:24 +01:00
Pierre-Yves Chibon
2e58bc1f96 Store the email in lower case and do the comparison in lower case as well
Otherwise we end up trying to update a component just because the case
is different while the account on the bugzilla is the same.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2020-01-12 21:22:20 +01:00
Pierre-Yves Chibon
ef002f091e Fix sending the email in non-dry-run mode
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-18 18:25:40 +01:00
Pierre-Yves Chibon
fe47eba0a0 Ignore the xmlrpc error 1200 as well
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-18 17:24:46 +01:00
Nils Philippsen
46ce635179 flake8: wrap overly long lines
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-12-18 15:38:20 +01:00
Nils Philippsen
fcbb4eea2c flake8: fix import order, xml is a system package
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-12-18 15:34:46 +01:00
Pierre-Yves Chibon
87cbf38a29 Treat xmlrpc error 504 differently
The error message for the error 504 reads:
<Fault 504: 'The name XXX is not a valid username. Either you misspelled
it, or the person has not registered for a ... Bugzilla ... account.'>
In other words, the request succeeded but the user does not exist. So
in those situation there are no reasons to keep on trying, it won't work
at the next attempt either.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-18 15:27:38 +01:00
Pierre-Yves Chibon
ad98b9e294 Be more resilient to transient bugzilla error
ie: retry a few time (up to 5 times) with a 20 seconds pause between
each attempt before raising an exception.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-18 09:37:37 +01:00
Pierre-Yves Chibon
7b1f707efc Be more resilient when querying bugzilla for open bugs
Sometime we fail to retrieve the list of bugs for a component because of
some hick ups with bugzilla.
With this commit, we'll try up to 5 times and wait 20 seconds before
each attempts.
If that still fails, then too bad.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-10 10:39:07 +01:00
Pierre-Yves Chibon
f17f2ae9df Change the output in verbose mode
This new formatting makes it easier to grep the output

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-10 10:35:09 +01:00
Pierre-Yves Chibon
aa0e93f8f8 Specify that the HOME is /tmp in the container
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-06 16:33:19 +01:00
Pierre-Yves Chibon
b6124b370c Create the .cache folder for bugzilla to store its info
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-06 16:33:19 +01:00
Nils Philippsen
c2e99dbdfa Ship default configuration files
Specify data files to ship explicitly and set include_package_data to
False so it doesn't pick up random cruft that happens to be in the work
tree.

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-12-06 16:32:55 +01:00
Pierre-Yves Chibon
7e5e5cf5aa Add a Dockerfile to the source so we can use s2i in openshift
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-12-06 16:30:28 +01:00
Nils Philippsen
9c018ff12e use a more sensible prefix for system config files
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-12-05 17:32:20 +01:00
Pierre-Yves Chibon
84d87ecb98 When updating bugs do not print email address if using --print-fas-names
For public display we do not want to share our user's email address more
than that. So we have an --print-fas-names action mapping back the email
to an username.
This commit makes the logic that updates open bugs when the default
assignee changes honor this flag.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-11-28 16:12:49 +01:00
Pierre-Yves Chibon
2fd1d0115d If we fail to call bugzilla, retry a few times before raising the exception
This allows for temporary network glitches to be ignored.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-11-28 15:51:03 +01:00
Nils Philippsen
3f985627a1 initialize self.errors in run()
Initializing it to a (default)dict could cause problems if several
instances are used. We don't do that at the moment, but it's bad
practice to initialize class members to mutable data types which aren't
supposed to be shared between instances.

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-26 09:42:26 +01:00
Nils Philippsen
2da92f250a don't print EDITCOMP messages for every package
Setting data['is_active'] before checking if it's empty makes subsequent
code always think things have changed.

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-26 09:42:26 +01:00
Nils Philippsen
f01960d719 allow lazy expansion of log format strings
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-26 09:42:26 +01:00
Nils Philippsen
6e574a5067 straighten out finding primary.xml file
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-26 09:42:26 +01:00
Nils Philippsen
399bb28420 use list and set comprehensions where appropriate
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-25 15:44:14 +01:00
Nils Philippsen
247ede734b consistently use dictionary literals
Aside from not using two different idioms for the same thing, it
performs better (not noticeably in our case, but hey).

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-25 15:44:14 +01:00
Nils Philippsen
743b3aaca3 fix accessing product info from configuration
Previously, the `products` dict mapped product names in Fedora to their
Bugzilla counter parts. Now that all information pertaining products is
in this dictionary, the Bugzilla product name (if differing) is in the
bz_product_name sub-key.

Rename some variables to make their purpose a little more obvious, and
not use `product` for two different things (names and the informational
dictionary stored in the product cache).

fixes: #32

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-25 15:44:03 +01:00
Pierre-Yves Chibon
9283999992 Keep the errors as we are seeing them and print or send a report at the end
While the script runs, we're keeping in memory a list of all the errors
we have encountered and at the end of the run we send to the admins a
report with all of them, categorized in a way that will hopefully make
it easier to fix for them.

We're also adding an option to preserve the function to send the report
to the admins but disable sending the notifications to the
users/packagers.
This would be useful to start get an idea of the number of people who
would have issues with the script.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-11-25 15:27:45 +01:00
Pierre-Yves Chibon
9b3b02b4ac Drop giving the run time while it is running
We give an overview of the time for the different steps at the end, so
no need to give it in the middle

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-11-25 14:39:50 +01:00
Nils Philippsen
b3f348c94e mention why a package isn't added to Bugzilla
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-25 14:38:50 +01:00
Nils Philippsen
34c580db0d fix leaking product info when building cache
When building the product cache, the information of which products a
package/component is part of could be leaked from one item to the next
because it's only every reset once per call.

This was introduced when we moved the functionality of the ProductCache
class into BugzillaProxy.build_product_cache().

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-25 14:33:56 +01:00
Nils Philippsen
a287c60ce5 don't add retired components to Bugzilla
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-25 14:31:50 +01:00
Pierre-Yves Chibon
e7ddb4f8ac Support de-activating retired packages
When a package is retired, we want to de-active it in bugzilla which
makes it no longer visible in the list of packages against which one
can fill a bug.

Fixes https://pagure.io/fedora-infrastructure/issue/7690

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-11-25 10:54:21 +01:00
Nils Philippsen
f2bea59f37 allow configuring products for branches by regex
This is in order not to have to hard code EPEL. In the course,
reorganize how products and their correspondent versions and component
namespaces are configured.

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-25 10:42:04 +01:00
Nils Philippsen
12b90b22dd honor configuration when sending emails
- Move the send_email() function into DistgitBugzillaSync as a method in
  order to access the configuration environment easily.
- Make whether or not emails are sent use the email.send_mails
  configuration option rather than the name of the configuration
  environment.
- Don't hard code the SMTP host.

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-22 19:02:21 +01:00
Nils Philippsen
2b7712f826 make default QA contact email address configurable
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-22 19:02:21 +01:00
Nils Philippsen
78434ffbfd use email namespace in configuration
This is for all configuration related to sending emails, not for e.g.
the default QA contact. By chance, it fixes a problem in the default
configuration where the mail templates ended up in the pdc_types
subtree.

Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-22 19:02:21 +01:00
Nils Philippsen
7821f08e2e fix unknown variable used
Signed-off-by: Nils Philippsen <nils@redhat.com>
2019-11-22 19:02:21 +01:00
Pierre-Yves Chibon
b1bb0c02a4 Update the open bugs when the corresponding package changes maintainer
Fixes https://pagure.io/fedora-infrastructure/issue/6940

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
2019-11-22 17:52:19 +01:00