45 Commits

Author SHA1 Message Date
Jay Faulkner
dd6c0bcd91 Proposed new Ironic core structure
Ironic is considering a two-tier structure, separating permission to
approve/workflow patches from the ability to core-review vote.

The final state is intended to be:
- All existing active ironic-cores go into ironic-approvers
- ironic-approvers goes into ironic-reviewers
- anyone approved later can get added to ironic-reviewers

In terms of permissions, the desired state is:
- ironic-approvers are the only team that can approve patches for
  landing
- ironic-reviewers are allowed to core review and do most other core
  activities except the final workflow to land code

As a transition, I'm leaving the ironic-core group in the ACLs. Once
the new group is created, populated, and working, we can rename the
old one to reflect its disuse.

I've also, as a result of auditing the core groups for other Ironic
projects and seeing some of them out of date, am unifying more
ironic-related projects into the same ACL configuration. The now
disused old core groups for those projects will also be renamed to
reflect their disuse when completed.

Change-Id: I7fea059274ffd8635e426e82882a3076527464eb
2024-10-15 15:16:32 -07:00
Brian Rosmaita
154f0b2c3a Address TODO in acl normalization script
Minor refactoring to simplify the code.

Change-Id: I9467865bdf1950c1f35c5c3bd0361c6ae8466397
2023-11-30 11:43:50 -05:00
Brian Rosmaita
60de765fa0 Implement openstack-unmaintained-core group
Create a gerrit group to handle branches in Unmaintained status
across all projects, as described in TC resolution 2023-11-14,
which is commit 90982cd in the governance repository.

Also adjust the acl file normalization tool so that it will guarantee
that the Release Managers group has 'abandon' permission on
Unmaintained branches if any project chooses to override the global
openstack-unmaintained-core group with a project-specific unmaintained
core team (as is allowed by TC resolution 2023-11-14).  This entails
a change in that script to require the acl file's namespace be passed
in so that the check doesn't affect non-OpenStack OpenInfra projects.

Change-Id: Ife8e5f175cb8a7d396dfe2a5d52fd6d524ae0b43
2023-11-29 21:48:10 -05:00
Jeremy Stanley
ebd6f60bb7 Catch missing "group" keywords in Gerrit ACL files
A recent change slipped through without the necessary "group"
keyword in some new ACL entries, resulting in a deployment failure
when Gerrit refused the push from manage-projects. Add a list of
options which need the "group" keyword so we catch this during
review in the future.

Change-Id: Ibf07cd63c3eea939728df4bd518681843f51bd37
2023-07-13 16:41:12 +00:00
Jeremy Stanley
7820745ba2 Make option indenting a selectable transformation
A previous change added indentation of Gerrit ACL options hard-coded
into the normalization script. Make that rule selectable instead,
like the prior transformations.

Change-Id: I57d33e2d3f55712f9ed46d740480a4ab6476d8bc
2023-05-02 15:49:00 +00:00
Jeremy Stanley
f913313781 Add an "apply" transformation which applies all
The Gerrit ACL normalization script has an "all" transformation
which reports all transformation results to the screen. Add a
similar "apply" shortcut to directly transform the file being
operated on in a non dry run fashion.

Change-Id: I73a07a3542ca26ddfcf01eab1d7be11cec70da85
2023-05-02 15:48:44 +00:00
Ian Wienand
ac1ef44843
tools/normalize_acl.py: Add some human readable output
Currently if your ACL fails the normalization pass you get a diff, but
no explaination of what that diff represents.

This is an attempt to make the situation better without having to
undertake some sort of major rewrite of the transformer.  We move the
current in-code comments into human-actionable strings, and add a
"-help" argument that prints this out.  If we have normalization
failures, we add a step to the driver script to print this string out.
This will appear in the job output and hopefully be easily seen when
scrolling the logs.

Change-Id: Ib07a10a25f35875afad21f77f545dc1cc207cecd
2023-04-27 16:52:57 +10:00
Jeremy Stanley
464f4f586a
Indent Gerrit ACL options
Gerrit very much wants its ACLs to indent option lines (but not
section headings) by a single hard tab.

The recent migration to schema 185 with Gerrit 3.7 has updated
copyConditions flags and re-written most of the ACL files to look like
this (c.f. I1f11c07e3786bd1a68b43d908d939fde42ddb99c).

This updates the normalize tool to format like this, and modifies all
our ACL's to the new format.

This is intended to be a no-op with no functional change.  For future
upgrades, this will reduce the diffs of any updates Gerrit might make.

Change-Id: I3a0c0da1eb32f8afb31ffa0c24ea45aaca8da8cc
2023-04-26 05:19:02 +10:00
Clark Boylan
5fc22f27cf Require function = NoBlock to be set on Gerrit labels
A recent change to the openstack/releases ACLs pointed out that we don't
require function to be set on Gerrit label definitions. This would
result in the Gerrit default of MaxWithBlock which will interfere with
submit requirements.

Enforce that function is set and that the value is NoBlock via our
normalize script. This will add function = NoBlock entries to the file
if not set which results in a diff causing the test to fail.

In order to do this I refactored the submit-requirements and function
checking of the normalize script a bit. We now check the label section
independently of all other sections which allows us to reduce repetition
when dealing with label sections.

Change-Id: I9e83c1cde3fe20ea2c34cdf86cd2fd3006bfe62a
2023-04-03 10:07:07 -07:00
Ian Wienand
b0963776f1
gerrit/acl : check for capital booleans in normalize
We got caught out with this in All-Projects; let's just make sure we
keep capital booleans everywhere for consistency.

Change-Id: I7a1e528c620c07ecbb2def3d743ab4bba46a20df
2023-03-21 10:49:23 +11:00
Ian Wienand
a172d416d9
gerrit/acl : check for function/s-r in normalize
This ensures that labels only use "function = NoBlock" and that every
label has a corresponding submit-requirement section.

We don't really have unit tests for this, but the first check actually
found some missed functions in
I557f3615d15eca899a262b0989986fb2754ac870.  I manually tested the
second by removing some submit-requirements, and it correctly failed.

Change-Id: I971f626bd7dbee012dc93a5807145d206b645cfd
2023-03-21 10:49:19 +11:00
Ian Wienand
f73a678945
gerrit/acl : handle key / values with multiple =
For things like submit-requirements, we have fields like submittableIf
which take a query string that may have "=" on the LHS.  Change the
key/value split so that it only takes the key up to the first "=".

Change-Id: Iada801bd1c38dd1e0502bebefd6a1421c746c90a
2023-03-08 10:12:23 +11:00
Ian Wienand
f346b72eb6
gerrit/acl : handle submit requirements in normalise tool
This adds the keys "applicableIf" and "submittableIf" that are used by
submit-requirements [1].

[1] https://gerrit-review.googlesource.com/Documentation/config-submit-requirements.html
Change-Id: Ic4dc5877d9326897839bbe62c02c0986c6e53e25
2023-03-08 09:21:12 +11:00
Ian Wienand
6349f18d40
gerrit/acl : remove deprecated copy conditions
The copy conditions here have been replaced by the "copyCondition"
query tag.  This updates the deprecated values to a new query which
does the same thing -- i.e. this should be a noop.

Mostly these are setup to have votes on labels that should be copied
on a no code change/trivial rebase, and if they're -2/+2 (i.e. max
votes are sticky).  To be exact the group of

 copyallScoresIfNoCodeChange = true
 copyAllScoresOnTrivialRebase = true
 copyMaxScore = true
 copyMinScore = true

becomes

 changekind:NO_CODE_CHANGE or changekind:TRIVIAL_REBASE \
  or is:MAX or is:MIN

Note all but ocatvia.conf, octavia-dashboard, octavia-lib, and
python-octaviaclient are copying -2/+2 votes; I feel like this is
probably a bug but I have modified these 4 projects to maintain the
same behaviour of not copying the votes.

A small number of projects copy any vote; glance.config,
kayobe.config, kolla.config, nova-specs.config, nova.config,
os-vif.config, placement.config, python-novaclient.config -- they are
replaced with is:ANY.

The old conditions have been deprecated since gerrit 3.5 [1].
Although the old conditions have not been removed yet, this will help
as we think about also changing these to submission requirements for
Gerrit 3.7.

[1] https://gerrit.googlesource.com/gerrit/+/c429ff33d944272b1f4da9f84f904f6403919ea3

Change-Id: Id13fdf588d07c1fec73978e7a69f1d9097989696
2022-12-16 16:33:09 +11:00
Artem Goncharov
ef92cc7695 Add Allow-Post-Review flag to OpenStackSDK project
In order to implement post-check pipeline for dealing with secrets in
the check pipeline it is required to add additional flag to gerrit that
will be set as a prerequisite to start jobs.

Change-Id: I3f0d7fe7e0014c28465aaab060e74e39a527b745
2022-10-10 09:46:45 +02:00
Jeremy Stanley
0d066f954d Remove unsigned tagging permission from projects
Now that we have a fix in place for Gerrit's tag signature detection
regression, remove the unsafe permission for pushing unsigned tags
to return everything to the state we had prior to the 3.4 upgrade.

Change-Id: Ia9afb5fb4be311cca59d3e1cf3b7bc611184fe15
2022-01-25 17:41:19 +00:00
Jeremy Stanley
83ca7a97f9 Work around signed tag regression from Gerrit 3.4
Upon upgrading from Gerrit 3.3 to 3.4, a regression was observed in
which jgit no longer returns signatures in its tag messages, causing
Gerrit to misidentify signed tags as unsigned (annotated) tags.
Because our ACLs only allow signed tags to be pushed, this
regression prevents Gerrit from accepting them now.

Temporarily grant permission to push unsigned tags to anyone who
has permission to push signed ones. We will revert that as soon as a
fixed Gerrit is in place, but in the meantime users will be warned
to take care when pushing tags so that they don't accidentally push
actually unsigned tags to Gerrit.

Also, the pushSignedTag keyword was deprecated in favor of the new
createSignedTag name, so go ahead and update to that while we're
doing this so that we can limit the amount of churn across all these
ACLs. Documentation will be corrected to recommend the new format in
a separate change, but update the ACL linter now to prevent the old
syntax from being used in new projects.

This workaround was already tested on opendev/bindep in the parent
Iad8c1f83e247c9a8bcf5b4f530f7b83663e1f793 change, and confirmed to
function as intended.

Change-Id: Ia426ea36b4e6877fdce5725ff1e00ae02c62e3f4
2022-01-25 17:40:31 +00:00
Jeremy Stanley
645ec7b07f Grant Create Annotated Tag perms on bindep
We're testing a potential workaround for a suspected regression in
Gerrit 3.4, where signed tags are rejected with the error "You need
'Create Tag' rights to push a normal tag." Temporarily grant this
for the opendev/bindep project, so we can see if it works around the
problem while we coordinate a fix with Gerrit upstream.

Change-Id: Iad8c1f83e247c9a8bcf5b4f530f7b83663e1f793
2022-01-25 15:57:35 +00:00
Jeremy Stanley
7e5aaec792 Update bindep ACL to use new createSignedTag perm
The pushSignedTag permission is deprecated, and has a new name:
createSignedTag. Update the opendev/bindep ACL accordingly, as we're
seeing a regression with the old name and would like to rule out
whether the new name has the same problem.

Change-Id: Ia95919bcfe71ce488096584c784fe7376f66f34a
2022-01-25 15:15:52 +00:00
Sean Mooney
d41dfcd16f Add review priority label to nova deliverables
This change adds a Review Priority label to all nova deliverables
currently under acl control in the project config repo.

The ability set the new label is granted only to the core
and stable core teams for the updated repos.

Change-Id: I2fd7a6387d2f50eeeb8cef513df19b5696cce55b
2021-08-27 17:02:16 +01:00
Jeremy Stanley
e3e3ef6789 Allow inheritFrom in Gerrit configs
In order to utilize Gerrit's project configuration inheritance
mechanism, we need to support the inheritFrom option. Allow it in
the whitelist for our ACL normalization script.

Change-Id: Id23b348bf42d322d5c97903ad82101ac1dc01c27
2021-04-16 16:04:19 +00:00
Jeremy Stanley
4286aa0276 Allow delete permissions in Gerrit ACLs
We now have the option to assign delete permissions to groups in
Gerrit, which would grant them the ability to delete branches
through the WebUI or API. Since this is a new setting, it was not
previously recognized by our linter. Extend it so that we won't
raise an error if this appears in an ACL.

Change-Id: I2b182d31e3ca5809a53aec851015341f2e67825d
2021-04-13 18:30:24 +00:00
Riccardo Pittau
0a3e98f7b8 Add key editHashtags to normalize_acl script
The editHashtags key should be accepted as acl entry key as it's
required to define permissions to edit hashtags in the gerrit ui.

Change-Id: I2294d72ee36e33ea5d137eb4e0faeac69ea86625
2021-01-27 19:16:37 +01:00
Sorin Sbarnea
97cacc26cc Enable tripleo core members to change WIP flag
This change enables people that already had permission to abandon
other changes to also toggle the WIP flag on them.

Change-Id: I894df2e26c6927eac25dbfe596a93f4209ff92ee
Reference: https://gerrit-review.googlesource.com/c/gerrit/+/212571/3/java/com/google/gerrit/common/data/Permission.java#49
2020-12-07 15:59:25 +00:00
Mohammed Naser
c15058c0bf gerrit: change retired.config acls
This patch updates the retired.config ACL to allow for the technical
commitee to be able to push changes into the repositories which are
retired.

The ACLs allows tech-committee group members to set all labels onto
changes as well as allowing them exclusive rights to push (therefore not
allowing any other members) and giving them access to submit changes (in
order to skip our gating).

The goal is to evenutally replace this group by another one once the
ACLs are verified to be working.

Change-Id: Ia6d516621ec405b02f3f97340d96d9938b605d8f
2020-06-24 09:58:10 -04: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
Thierry Carrez
7e896b57eb Add release-approval pipeline
Define a release-approval pipeline to run the check-release-approval
job on every comment added to a release request, and set a
PTL-Approved label accordingly.

This may be considered a bit resource-intensive, however the
check-release-approval job is a fast python script that runs on
the executor, and only release requests shall go in this pipeline.
If this generates too much load, we could configure it to only run
when the comment posted contains a magic "signoff" keyword.

Another concern is that jobs other than check-release-approval would
be added to this pipeline. There does not seem to be a way in Zuul to
limit a pipeline to a specific job name or project.

Change-Id: Ieab04a4d6c02b216a59c12ec8599e7d91f4fffb1
2020-02-05 16:46:24 +01:00
Ian Wienand
4f6629021e Update hacking, fix errors/warnings
This version of hacking doesn't understand f-strings as usable in
Python 3.  Update to the latest and fix current issues, which are all
just formatting fixes.

Change-Id: I0a7d6f93f07477b6dd29ab143130dd9064c250be
2020-01-14 09:40:45 +11:00
Michael Johnson
c49fb365ff Create 'Backport-Candidate' for Octavia repos
The Octavia team would like to enabled passive voting on patches
for backport candidates. This means that backport candidate votes
will not block a patch from merging, but will allow the team to
better track patches that should be backported.

Change-Id: Ib75714649848538e9fed171abd0b11f6fbc55503
2019-05-07 11:16:21 -07:00
Graham Hayes
fdb962758c Create 'Review-Priority' for designate repos
This allows anyone in the group "designate-release-manager"
to set the priority of patches, and block non freeze patches
during RC.

This allows for more precise dashboard than relying
on stars from PTLs, and allows the team to distingush
between a procedural -2 and a release freeze -2.

Change-Id: Id7b4c6b219899fa7ed86554257264af7efe20408
2018-03-28 18:37:08 +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
jeckxie
218eb38da9 Add Apache 2.0 license to source file
As per OpenStack licensing guide lines [1]:
[H102 H103] Newly contributed Source Code should be licensed under
the Apache 2.0 license.
[H104] Files with no code shouldn't contain any license header nor
comments, and must be left completely empty.

[1] http://docs.openstack.org/developer/hacking/#openstack-licensing

Change-Id: Iabfc781800f080b8235a2d812d16bdb3ee57067a
2017-02-16 10:46:54 +00:00
Andreas Jaeger
4e9f7cf97e Gerrit ACLs: Check for valid keys
Add check for valid keys to find obvious typos in keys.

Fix the one error found in openstack.config.

Change-Id: I6a2af22db0b9425372e66dca93498a33a07275e9
2016-07-07 19:16:47 +00:00
Jeremy Stanley
f62e441f24 Unshadow All-Projects in exclusiveGroupPermissions
Whenever a project-specific ACL declares exclusiveGroupPermissions
on some permission, it can block other valid uses of that permission
which would otherwise be inherited from the All-Projects pseudoACL.
Make sure that Project Bootstrappers retains access to abandon,
-2..+2 on label-Code-Review and -1..+1 on label-Workflow. Also make
sure Change Owners can still abandon and add -1..0 on
label-Workflow, and that Registered Users can always -1..+1 on
label-Code-Review.

This change corrects existing ACLs to meet the above criteria, and
also introduces a normalization rule to prevent regression.

Change-Id: I2eecb7028bcab7d5d82ad4155a775a9b2daa441f
2016-02-17 22:39:03 +00:00
Jeremy Stanley
cb63263510 Keep Gerrit ACL lines deduplicated
Gerrit ACLs can have multiple duplicate option keys in a section,
but completely duplicate lines (key and value together) have no use
so make sure they're collapsed into at most 1 copy.

Change-Id: I6bf43e860dcc8c3d7b2846d4e058b6c8ac7243eb
2016-02-17 22:31:54 +00:00
Jeremy Stanley
639ec1d17e There is no Project Bootstrappers-core...
...only Project Bootstrappers.

Correct the ACL normalization script oversight which led to this
unfortunate mistake, and clean up the resulting mess.

Change-Id: I391ead734d0cd28277581d54f254718c3e36d4b0
2015-04-24 01:08:11 +00:00
Jeremy Stanley
480330a116 Allow ACL sections to use .*-release group names
These are what the old .*-ptl groups were renamed to last year, for
better clarity.

Change-Id: I4764f6ab7c74adfbdcaba0a12d81a062beb9dc40
2015-04-21 21:22:35 +00:00
Jenkins
5b47a53e6e Merge "Make the unrecognized exception more verbose" 2015-04-03 14:06:34 +00:00
K Jonathan Harker
ca12f2f79d Remove unneeded 'create' from all tags sections
Look for all keys that begin with 'refs/tags' rather than just the
string literal 'refs/tags/*' when removing unneeded create permissions
from tag access sections.

Change-Id: I6dc226065166038700ffd324d354e617596888cb
2015-04-01 10:40:26 -07:00
K Jonathan Harker
c7b2df83ba Make the unrecognized exception more verbose
If the gerrit config normalizer comes across an unrecognized line, add
the bad line to the exception message for debugging.

Change-Id: I60e77a0b50718fb331bad0836ca769f685e6ce93
2015-03-31 14:15:26 -07:00
armando-migliaccio
a3034dfcbe Add openstack-infra to the list of namespaces to check.
Change-Id: I8ff59dccc06df7ab23d13eca6990418f3a547d34
2014-12-19 11:44:03 -08:00
armando-migliaccio
af09d7ca4b Extend ACL checks to OpenStack namespace.
Change-Id: I0ac6ee99391f218fa467b58bf39934c6c68d1808
2014-12-17 14:03:31 -08:00
Andreas Jaeger
d8416301e8 Check that Gerrit ACL files are normalized
Enhance Gerrit ACL check to check that the files are properly
normalized.

Co-Authored-By: Armando Migliaccio <armamig@gmail.com>

Change-Id: I9cdee60e77dab9c6943626d5fa1eda0402840277
2014-12-15 23:04:12 -08:00
Jeremy Stanley
fac5624859 Combine infra/ci core/admin gerrit groups
This is the result of running:

    find modules/openstack_project/files/gerrit/acls/ -type f \
        -name "*.config" -exec ./tools/normalize_acl.py {} 6 \;

Change-Id: I7aa27b859529b2bc8a990d6272334222996cbbc4
2014-06-30 17:30:45 +00:00
Jeremy Stanley
cc06421fb4 Add a script to normalize Gerrit ACLs
* tools/normalize_acl.py: Script which can perform one or more of a
list of normalizing transformations to an ACL file.

Change-Id: I063ab91b6e786eccaee61c669f0e840c7af6be14
2014-06-30 17:22:40 +00:00