34 Commits

Author SHA1 Message Date
James Page
2c5223cf2d HTTP check existing repositories
Instead of using git to check whether an existing opendev.org
repository exists when and upstream source is specified, just
use a simple HTTP check using urllib.

This avoids any authentication style guesses git clients may
make when a repo is not visible.

Change-Id: Ibee29eee84ae3890a9017edf287de1415d658c39
2022-07-18 21:45:15 +01:00
Clark Boylan
81e58b7893 Allow default-branch in our projects.yaml checking
Some projects may not be created with a master branch and choose to use
a different default-branch value. There is support for this in jeepyb
and our gitea git repo management role but we don't allow it in linting.
Update our linting to accomodate projects making this change.

Change-Id: I57ef2c10d2c29142801ba134c8183bb0393771a8
2022-02-03 11:12:36 -08:00
James E. Blair
3bc3b18f4d Add REST api auth rules
This allows locally generated (by infra-root) tokens to be used
for admin commands.

Change-Id: I452fc7863985c0d94a98440823fd0aa1d454ec31
2021-12-02 15:54:43 -08:00
Jeremy Stanley
ef03e7fa36 Drop use of track-upstream
When upgrading from Gerrit 2.13 to 3.2 we stopped relying on a local
fork of its source and have been building from (more recently
completely unmolested) upstream source. This fork was the only place
we were relying on jeepyb's track-upstream feature, so we can stop
looking for it in our checks and normalization as well.

Remove the check_gerrit_projects_changed scripts as well, as they
only existed to run things where track-upstream was enabled.

Change-Id: I597c1a577c53e2db61413d9ec531378667691d2a
2021-07-06 16:45:22 +00:00
Clark Boylan
180cc6aeda Be more explicit about using python3 to run tools/
We have python scripts in the tools/ dir the vast majority of which we
run regularly with python3 via our python3 default basepython in tox.
However, most of these use a `python` shebang line which can be
confusing as to whether or not these scripts run under python3 or not.

To make this more clear set them to python3. I've confirmed the scripts
running under tox are happy with these changes. For the ones that don't
run under tox I've done a quick review and they look happy too.

Change-Id: I983d23c33f7780e5708aa728c829c3262fc99ea0
2020-06-08 16:40:44 -07:00
Clark Boylan
4a94d0debf Fix the zuul main.yaml config checks
It is possible to have two different types of dict listings for zuul
tenant project lists. The first (which we handled fine) is a dict per
project where we list which items we include from that project. The
other is a dict with global settings and a list of projects. Handle this
second case.

Change-Id: I03969da4595f4c66db36cab35ef96a33c6766002
2019-09-17 15:40:03 -07:00
Andreas Jaeger
10de11d7a9 Check zuul/main.yaml projects
Check that projects in zuul/main.yaml exist in gerrit.
This would have avoided https://review.opendev.org/659697.

Use yaml.safe_load in one case.

Depends-On: https://review.opendev.org/659735
Change-Id: I6fb3d90c18b57c004caf02dd6e5d5c34b1ce1ff9
2019-05-17 11:12:45 +02:00
Andreas Jaeger
945a586f65 Check groups entry in gerrit/projects
Following Icbef648e9948e0fa636dd0d15039b6fc229541ca, check that groups
are a list if defined.

Change-Id: I3a647c6b2debc7bb0a3a06b3f3407c4ea7e3f3e5
2019-05-03 09:22:02 +02:00
Monty Taylor
72b6395c6b Update links for opendev
Change-Id: I35c8c64abfed31daf2be3698be13e72e38cd321b
2019-04-21 14:01:51 +00:00
James E. Blair
6da7b5e6ad Alias zuul git repos to git.zuul-ci.org
This adds support for the cgit-alias directive added in
https://review.openstack.org/555105.  It's safe to land this change
before or after the implementation.

It also aliases the zuul project repos to git.zuul-ci.org.

Change-Id: I05a7156e092faad1457973b88537ec73012a5c96
2018-03-23 13:39:00 -07:00
Andreas Jaeger
189fcf55cb Fix typo in tools/check_valid_gerrit_projects.py
Check for both zuul.yaml and .zuul.yaml.

Change-Id: I947e1a9602695efc17cabedb6209fe54129f0219
2018-02-22 14:56:30 +01:00
Andreas Jaeger
5c074b977b Avoid import of zuul files
Check that new upstream projects do not have any zuul files in there and
fail if so.

We add this check to not import a zuul config file that is broken. We
only accept zuul config files that have been gone through review.

Change-Id: Ie33d91637e812a17f3b2a2b2c75cbbadcde176ad
2018-02-21 21:16:24 +01:00
Andreas Jaeger
a32a65d4a8 Merge project-config linter jobs (2/2)
Now that the job is changed, we can merge the tox environments.

Fix problems flake8 found.

Change-Id: Ia74b3b4a8c92831e8f34776d580dadb321e22d6c
Needed-By: I96c7aa13f5350327a96a9cd551427e60254cc1a4
2017-11-02 17:39:04 +01:00
Andreas Jaeger
4adbecad99 Fix flake8
fix a "bug" in that the flake8 configuration in tox.ini was exclusively
selecting H231 as the only error it would report, so it was missing the
errors in the python modules (such as submit_log_processor_jobs). Due to
this being the case for a long time (since 2004) limit the more thorough
linting to the roles/ and playbooks/ directories where we'll be adding
ansible plugins/modules/etc. Also, lint in jenkins/script and nodepool.

Fix problems found.

We can lint everything with pep8 once the zuul v2 scripts are removed,
not worth patching them right now.

Change-Id: I479f010643cf3b67c183d763510f07a33400d38b
Co-Authored-By: Jesse Keating <omgjlk@us.ibm.com>
2017-10-21 18:37:10 +02:00
Ian Wienand
3647a2f1cb Check for newlines in project descriptions
As we found out with I88751ed6df7d5f9dad735171e19f82dea745b4da and the
resulting downtime, cgit does not like multi-line description values.
The cgit(5) man page is conspicuously quiet on quoting or multi-line
values; let's just ensure we don't do this again.  This does detect
the newlines in the original change.

Change-Id: I87bcff409d4632c70bff5e4606b4572c38c74e59
2017-06-26 11:19:40 +10:00
Jeremy Stanley
931234be2e Don't error about default project group for SB
While having a groups entry with the same name as the repository
makes no sense for Launchpad integration, it's entirely reasonable
for projects using StoryBoard to put a project in a group which has
the same name. Stop erroring about a "default groups entry" when
use-storyboard is true.

Change-Id: I95e3a9e830361563776997f2b90d0a48ea66be01
2017-04-07 17:55:51 +00:00
Jenkins
5dd4dd54ab Merge "Improve gerrit checks messages" 2016-09-14 07:23:00 +00:00
Andreas Jaeger
5e7ad13490 Improve gerrit checks messages
For tools/check_valid_gerrit_projects.py:
* Improve one error message to mention the project as well.

For tools/check_valid_gerrit_config.sh:
* Remove output for each ACL we check, we output the entry if it's
  wrong. But with 800+ ACL lines, we should not output 800+ lines of
  progress and thus make it hard to find the one failing line.

Change-Id: I4434c0f0bf65a1eb69889a2362c1abae7119fdd7
2016-09-13 13:57:48 +02:00
Andreas Jaeger
e76d3c36dd Cleanup gerrit/projects.yaml
Remove redundant group entries and add a check so that they cannot get
in again.

Remove some unneeded quotation signs in descriptions.

This is just a cleanup, it should not have any functional differences in
projects.yaml itself.

Change-Id: I49ff9438ab43612704ab61ff84d16c4432f0bc2a
2016-09-10 09:49:29 +02:00
Andreas Jaeger
4a0a4bb766 Give better error description in check_valid_gerrit_projects.py
This error message was confusing, make it clearer.

Change-Id: Ia930483a8b36f75610a5de711b22b553410d5ff8
2016-09-07 14:40:42 +02:00
Andreas Jaeger
3968468468 Consistent ERROR messages
Capitalize ERROR for all project-config specific tests, so
that errors can found easily.

Add missing ERROR marks.

Change-Id: I1d7e1077de62945647e0329462016a34eaabd83e
2016-06-30 13:16:10 +02:00
Paul Belanger
536cec4fec
Skip upstream check if we have already imported upstream
Update our testing to only check upstream if we haven't imported the
repo into openstack.  This will address test failues when users
deleted the upstream repo before removing it from
gerrit/projects.yaml.

Change-Id: I6bd9fe9841dee8be352ed17af44b4cf9cea397fd
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-06-08 11:26:20 -04:00
Andreas Jaeger
2a6bf90fbc Block stable/feature branch for new project imports
When importing projects, check that they do not contain a simple
"stable" branch as that will block creation of "stable/RELEASE" branches
like "stable/mitaka".
Similar for "feature".

Change-Id: Ia190fdbddf9029149b54e686aa0e82fe040b6733
2016-04-21 17:00:39 +02:00
Andreas Jaeger
6ef07db860 Add checks for gerrit ACLs
Check the following common problems with gerrit ACL lines:
* Wrong path
* Non-existence of a referenced file
* Redundant setting of acl-config with default value

Remove redundant entries that the script found.
Add acl-config for freezer-specs since no ACL existed.
Add acl-config for vinz-webclient since no ACL existed,
this was in original change I1706332f911ad9c8887d1e40613b06cbeb5e1143.

Change-Id: I6b9fc6d2ff1cd5a1f871975608947d6fe763b500
2016-04-11 16:52:26 +02:00
Andreas Jaeger
03d0680e41 Check for astra misspelling
Add common missspellings, fix also the one issue it caught.

Change-Id: Iaa6a94e3f1e3bff5f4d2986c4926078bd9090b42
2016-02-11 16:51:14 +01:00
Andreas Jaeger
2304cb56b3 Validate options in gerrit/projects
Check that only known options are used in gerrit/projects.yaml.

Change-Id: I4ba62547e71b21d8c32297ba06b4aa937f9b637e
2015-12-13 16:49:12 +01:00
Andreas Jaeger
10b18599e3 Remove global vars from check_valid_gerrit_projects.py
Replace global var with local variable usage.

Change-Id: I44640a274947f9be84232fb172f8247c15dbaee5
2015-10-22 11:00:02 +02:00
Andreas Jaeger
106f6b80e2 Check for valid upstream git projects
This checks out the upstream git projects (unless we use track-upstream)
and prints some information about it.

Note this checks for all upstream repositories but since those are
cleaned up regularly, this should be fine.

It fails if the there is no remote master branch.

Reindent the original code as main function.

Change-Id: Ie469905f48e4bc1a408fb9e731f95b2b735a6a02
2015-10-21 20:34:45 +02:00
Ian Wienand
1942b394d6 Add a simple description check for gerrit/projects.yaml
Add a very simple check for some common typos that might appear in the
descriptions.

Correct existing typos as found by the check

Change-Id: I6edd833de8544e44750c3a3fb49a065f99a18499
2015-08-27 12:38:52 +10:00
K Jonathan Harker
344bdf1faf Fix logic error in gate-project-config-projects-yaml
Previously labels were only being checked for validity if an upstream
was given due to a premature 'continue' if no upstream is given before
checking labels.

Change-Id: I7dd564d59a30ca14bbad4044a985ba08fbe55ca5
2015-06-19 13:37:03 -07:00
Victor Stinner
ceee9c0f1a Fix Python 3 issues
* Fix print syntax in check_valid_gerrit_projects.py
* tox.ini: jenkins-project env works also on Python 3, no need to force
  Python 2.7

Change-Id: I3c643470c6b5db666aeab208c615382719f8768d
2015-04-10 01:29:25 +02:00
Steve Kowalik
c1bfa625fa Add a lot of missing descriptions
There are a lot of missing descriptions in Gerrit's project list. Add
a bunch of them, which are hopefully correct. *-attic has been ignored
because 'meh'. Fix check_valid_gerrit_projects to also enforce
descriptions for more groups.

Drive-by some description changes.

Change-Id: Ib77dc40842b948c86a6bb0e8b52358e3c94cd0ce
2015-02-21 06:32:04 +11:00
Andreas Jaeger
dad4dd9a2e Check that descriptions exists in gerrit/projects.yaml
Make descriptions mandatory for stackforge and
openstack-dev projects - and add
missing descriptions for all projects in these namespaces
so that the check passes.

This check can be enhanced iteratively for further namespaces.

Change-Id: I263a58484f6399c74328e870ec1a77c041afa7cb
2014-12-03 21:37:06 +01:00
Andreas Jaeger
6ee2f2234f Check for valid entries in gerrit/projects.yaml
Rename check_upstream_url_scheme.py to check_valid_gerrit_projects.py
and extend the check so that:
* It shows all errors, not only the first one
* It checks that the keywords are valid

This was triggered by seen twice in a week the keyword "description"
misspelled.

Script now outputs in error case:
Error: Upstream URLs should use a scheme in ['https://', 'http://', 'git://'],
 found git@://github.com/emonty/cookiecutter-openstack.git in
 openstack-dev/cookiecutter
Error: Unknown keyword 'decription' in project stackforge/ec2-driver
Found 2 error(s) in /tmp/projects.yaml

Also add the usual license header.

Change-Id: I334dcadc6fd4472fb28d379aec317c1a16dee2e2
2014-12-03 15:40:40 +01:00