Feature team_permission, EnvironmentVariable, EnvironmentSecret, and Team extended by team-sync and external-groups#585
Conversation
…ssions and environment variables and secrets (#1) * Feature development: team with team-sync, external groups, team-permissions and environment variables and secrets * chore: update ruff and mypy (eclipse-csi#582) * chore: update ruff * chore: ruff auto fix * chore: ruff manual fixes * chore: update mypy and fix code * chore: fix ruff autofixes by updating odmantic See art049/odmantic#501 * chore: ruff format * chore: fix non formatting block * chore: remove fixme * Merge remote-tracking branch 'upstream/main' into feature/teampermission * fix: status added in _run_page_query as it is now used * chore: fixed by ruff * feat: add team sync variables to team --------- Co-authored-by: Alexander Lanin <Alexander.Lanin@etas.com>
|
Hi @WolfgangFischerEtas, thanks for this PR. |
|
Hi @kairoaraujo thanks a lot. I've also corrected the otterdog-defaults.json. I removed the double definition of newTeam. It should now work. |
|
Hi @kairoaraujo I merged the lastest commit on my branch and corrected the last mypy issues. |
|
@kairoaraujo could you provide some feedback here, as this PR is stuck? Any advice what we can do to support you here? |
|
thanks for the contribution, I will review the latest by EOB today, got busy with other stuff. |
| def validate(self, context: ValidationContext, parent_object: Any, grandparent_object: Any) -> None: | ||
| if is_set_and_valid(self.permission): | ||
| if self.permission not in { | ||
| "pull", |
There was a problem hiding this comment.
the permission values are mixed case here. Is this what the GH API expects / supports?
There was a problem hiding this comment.
That comes from the fact that I read in the permissions from GraphQL, REST API would consume too many requests, and there the names are READ, WRITE, MAINTAIN, TRIAGE and ADMIN (in uppercase letters), but you cannot update permissions via GraphQL, and in REST API you have to you the lower case equivalents. It's a bit ugly and inconsistent, but I think accepting all these values and map then to the ones REST API accepts is consistent.
If you insist, I can also adapt the description in the context.add_failure call where I just mention the REST API values.
There was a problem hiding this comment.
so what we ususally did is to transform data to a canonical form used in the model to avoid confusion or multiple ways to express the same thing. In this case I would transform the data replied by the GraphQL query to the way the Rest API understands it and this I would also use when modelling the configuration via a jsonnet file.
| @@ -0,0 +1,46 @@ | |||
| Definition of an `Environment` on repository level, the following properties are supported: | |||
There was a problem hiding this comment.
this moves the existing file environment.md from the repository to a new directory which makes sense, but the existing file should be removed afaict.
| | _reviewers_ | list\[[Actor](../actor.md)\] | Users or Teams that may approve workflow runs that access this environment | | | ||
| | _deployment_branch_policy_ | string | Limit which branches can deploy to this environment based on rules or naming patterns | `all`, `protected` or `selected` | | ||
| | _branch_policies_ | list\[[BranchOrTag](../branch-or-tag.md)\] | List of branch or tag patterns which can deploy to this environment | only applicable if `deployment_branch_policy` is set to `selected` | | ||
|
|
There was a problem hiding this comment.
the settings for secrets and variables are missing afaict.
|
I tested the environment functionality added as part of the PR and it works fine in general. A couple of things that I noticed:
I would expect that also the environment to which this secret belongs shows up in the header like
this is not a fault of the PR, that is already an existing problem, but maybe you can add a validation to secret and variable to make sure the name is all upper case. |
|
The PR is pretty big and includes various new features, the environment stuff alone would have been enough for a single PR. The team permission changes could also be in a separate PR and finally the team sync stuff. That would make it easier to review and merge the changes, as now its a lot of changes together. But in general the PR LGTM and follows the existing conventions in the repo as much as possible. |
|
regarding the modelling of the team permissions: it feels a bit heavy to assign permissions like that: I would have preferred something like we did for custom_properties: see our default config here: https://github.com/EclipseFdn/otterdog-defaults/blob/main/otterdog-defaults.libsonnet#L480-L482 the validation should check if the teams exists afaict. There would be no separate TeamPermission object but that is acceptable imho. |
|
Thanks a lot for the review. I will have a look into it next week. |
|
if you could split up this PR in actually 3 separate ones as I outlined above, it will be much easier to merge that afaict. |
|
I will do it the following way: 1 for the team, for the team permission according to your proposal, but I will keep this intact. Once the other PRs are merged then this PR gets smaller und clearer. I will rename it then to feat:environment variables and secrets. |
Overview of new features:
If you think the patch is too big I can split it into smaller pieces. Please make a suggestion