Commit f53ce047 authored by Martin Lowe's avatar Martin Lowe 🇨🇦
Browse files

Update README for updated GL logic

parent 23f2da05
......@@ -12,9 +12,14 @@ The Eclipse Foundation toolkit for maintaining permissions across multiple versi
- [Gitlab Permissions mapping](#gitlab-permissions-mapping)
- [Usage](#usage)
- [Manual run parameters](#manual-run-parameters)
- [Github](#github)
- [Gitlab](#gitlab)
- [Github params](#github-params)
- [Gitlab params](#gitlab-params)
- [Running the toolset for development](#running-the-toolset-for-development)
- [Running for Github](#running-for-github)
- [Running for Gitlab](#running-for-gitlab)
- [Gitlab Secrets](#gitlab-secrets)
- [Gitlab script run command](#gitlab-script-run-command)
- [Creating a tagged release](#creating-a-tagged-release)
- [Maintainers](#maintainers)
- [Trademarks](#trademarks)
- [Copyright and license](#copyright-and-license)
......@@ -22,7 +27,7 @@ The Eclipse Foundation toolkit for maintaining permissions across multiple versi
## Gaining Access to a project
To be granted access to a repository through the Eclipse Sync scripts (Gitlab or Github), a user must first either be nominated as a committer or a project lead within the [PMI(projects management infrastructure)](https://wiki.eclipse.org/Project_Management_Infrastructure), or be added as a contributor by an active committer or project lead. Depending on the role granted within the PMI, different access rights will be granted through the sync scripts. Should a user be promoted or retired within a project, the new permission sets should be active within a few hours of finalization.
To be granted access to a repository through the Eclipse Sync scripts (Gitlab or Github), a user must first either be nominated as a committer or a project lead within the [PMI(projects management infrastructure)](https://wiki.eclipse.org/Project_Management_Infrastructure) or be added as a contributor by an active committer or project lead. Depending on the role granted within the PMI, different access rights will be granted through the sync scripts. Should a user be promoted or retired within a project, the new permission sets should be active within a few hours of finalization.
Bot access within repositories is possible, but managed by a manual process and tracked by a [publicly available API](https://api.eclipse.org/bots) rather than through the sync script. How these bot permissions are typically interpreted varies by platform, and more info for each is available in the Github and Gitlab Sync sections within this readme.
......@@ -32,9 +37,9 @@ _[^ Back to top](#eclipsefdn-github-sync)_
## Github Sync
Within Github, there is a mixed strategy for management of projects within the space. Projects that are started while under the Eclipse umbrella or from a project that was incepted within the Eclipse ecosystem are by default created under the central Eclipse organization. On request, projects can be migrated to a separate organization that is still managed by the EclipseWebmaster account. Repositories or projects born from organizations or groups that have joined Eclipse Foundation post inception are usually managed under organizations managed by the EclipseWebmaster. While there are cases where projects can cross organizational bounds, it is uncommon (and covered by the sync script).
Within Github, there is a mixed strategy for the management of projects within the space. Projects that are started while under the Eclipse umbrella or from a project that was incepted within the Eclipse ecosystem are by default created under the central Eclipse organization. On request, projects can be migrated to a separate organization that is still managed by the EclipseWebmaster account. Repositories or projects born from organizations or groups that have joined Eclipse Foundation post inception are usually managed under organizations managed by the EclipseWebmaster. While there are cases where projects can cross organizational bounds, it is uncommon (and covered by the sync script).
Permissions to projects are managed through hidden teams that are then granted access to each repository for the given project within the current organization. For each organization that a project has repositories in, a set of contributor, committer, and project-lead teams will be created to give access to those repositories. Each of these teams will have the same set of users as defined within the project management interface on projects.eclipse.org. For users to be properly added by this mechanism, they must set their Github Handle within their Eclipse Account on accounts.eclipse.org.
Permissions to projects are managed through hidden teams that are then granted access to each repository for the given project within the current organization. For each organization that a project has repositories in, a set of the contributor, committer, and project-lead teams will be created to give access to those repositories. Each of these teams will have the same set of users as defined within the project management interface on projects.eclipse.org. For users to be properly added by this mechanism, they must set their Github Handle within their Eclipse Account on accounts.eclipse.org.
In regards to bot access, this is typically granted at the repository level, but can also be added at the team level if more broad access is needed. These permissions, while not removed by the script are currently managed manually by the Eclipse Foundation. If there are issues regarding bot access, new or existing, an issue should be created within our [bug-tracking system](https://bugs.eclipse.org) rather than within this project.
......@@ -67,7 +72,12 @@ Information on Github permissions is available in the [documentation for organiz
_[^ Back to top](#eclipsefdn-github-sync)_
## Gitlab Sync
In Gitlab, a nested group strategy was chosen to manage access to both groups and projects. This gives greater control over inherited permissions without having to manage teams across multiple base groups. For each Open Source group with repositories managed by the Eclipse Foundation (such as Eclipse Foundation and the OpenHWGroup), a base group will exist to encapsulate all projects for that group. Within each of these groups, each active project will have a subgroup (such as Eclipse Dash and Eclipse Marketplace Client) that will manage permissions for all repositories active within the Gitlab instance.
In Gitlab, a nested group strategy was chosen to manage access to both groups and projects. This gives greater control over inherited permissions without having to manage teams across multiple base groups. For each Open Source group with repositories managed by the Eclipse Foundation (such as Eclipse Foundation and the OpenHWGroup), a base group will exist to encapsulate all projects for that group. Within each of these groups, projects will have the option of choosing between 2 options when migrating over to their targeted projects' namespace:
1. Using the short project ID as the path of their group (i.e asciidoc-lang, dash). While the path of the project is determined programmatically, a display name may be chosen by the Project Leads of the project and a request made through the Eclipse Foundation Gitlab Helpdesk or requested at the time of the creation of the group.
2. Nesting the group mentioned in the first option within a group for the TLP (top-level project) of the given project. (i.e. asciidoc/asciidoc-lang, technology/dash). The name of the TLP group is determined by the Project Leads of the TLP, and similarly to the first option, a request may be made via the Eclipse Foundation Gitlab Helpdesk.
Within the namespace of your project, Project Leads may create further groups to better encapsulate their projects. This provides much better management of the subsequent projects through tools such as shared issue queues, kanban boards, milestones, and custom labels. Adding additional members outside of bot users to these subgroups is disallowed and will be cleaned regularly to ensure proper permissions are maintained.
In regards to bot access, this can be granted at either the subgroup or project (repository) level depending on the needs of the project. These permissions, while not removed by the script are currently managed manually by the Eclipse Foundation. If there are issues regarding bot access, new or existing, an issue should be created within our [bug-tracking system](https://bugs.eclipse.org) rather than within this project.
......@@ -104,7 +114,7 @@ _[^ Back to top](#eclipsefdn-github-sync)_
The following parameters can be used when running the sync scripts manually.
#### Github
#### Github params
| Parameter name | Required | Accepts | Default | Description |
|----------------|:--------:|---------|---------|-------------|
......@@ -117,7 +127,7 @@ The following parameters can be used when running the sync scripts manually.
|-h, --help | x | N/A (flag) | N/A | Prints the help text for the script parameters. |
|-V, --verbose | x | boolean flag | `false` | Sets the script to run in verbose mode (ranges from 1-4 for more verbose logging). |
#### Gitlab
#### Gitlab params
| Parameter name | Required | Accepts | Default | Description |
|----------------|:--------:|---------|---------|-------------|
......@@ -129,20 +139,16 @@ The following parameters can be used when running the sync scripts manually.
|-h, --help | x | N/A (flag) | N/A | Prints the help text for the script parameters. |
|-p, --provider | x | string | `oauth2_generic` | The OAuth provider name set in GitLab for the Eclipse Accounts binding. |
|-P, --project | x |string | N/A | The project ID (e.g. technology.dash) of the project that should be updated (at the exclusion of all other projects) |
|-r, --rootGroup | x |string | `eclipse` | The path of the root project to use when syncing PMI permissions. This is used to help in scoping retrievals and caching. |
|-V, --verbose | x | boolean flag | `false` | Sets the script to run in verbose mode (ranges from 1-4 for more verbose logging). |
### Running the toolset for development (Github)
By default, the script is run in docker containers to emulate the production environment (Openshift). This sync tool can be run in standard and verbose mode. The difference between the modes is that in verbose all log messages are printed to the STDOUT of the container.
Before running, an `api-token` file should be created that contains the GitHub API key to be used for connectivity. This should be created in a `secret` folder in the root of the project (this has been excluded from Git commits so there is less danger of pushing live keys to a public repository).
### Running the toolset for development
Additionally, an eclipse-oauth-config should be created when running the GitLab sync script. This file will define how connections to the Eclipse OAuth server should be handled. If this is missing, the GitLab sync script will fail. The file should be in JSON format, with the following being an example of format:
#### Running for Github
```
{"oauth":{"timeout":3600, "client_id":"<client id>","client_secret":"<client secret>","endpoint":"https://accounts.eclipse.org","scope":"eclipsefdn_view_all_profiles","redirect":"http://localhost"}}
```
By default, the script is run in docker containers to emulate the production environment (Openshift). This sync tool can be run in standard and verbose mode. The difference between the modes is that in verbose all log messages are printed to the STDOUT of the container.
Before running, an `api-token` file should be created that contains the GitHub API key to be used for connectivity. This should be created in a `secret` folder at the root of the project (this has been excluded from Git commits so there is less danger of pushing live keys to a public repository).
```
docker build -f Dockerfile -t ef/gh-test .
......@@ -151,20 +157,20 @@ docker run -i --rm -v <fullpath to current project folder>/secrets:/run/secrets
_[^ Back to top](#eclipsefdn-github-sync)_
### Running the toolset in development (Gitlab)
#### Running for Gitlab
The default state for the script is to run against production Gitlab, which isn't feasible for development/testing. To better enable testing, a local instance of Gitlab should be started. This can be started using docker-compose: `docker-compose up -d gitlab`. This starts and binds a Gitlab instance to ports 22, 80, and 443 to best emulate a real instance of Gitlab. This can be changed in the docker-compose if needed.
Once a local instance is started, retrieve the password set for the root admin user using the following command: `sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password`. This will print the root user password as plain text to the console for use. Once retrieved, you can log in and update the password to something more memorable or easy to remember or set the password into a password manager.
When you are logged in, you will need to create a base group to test the sync on. Using `eclipse` requires no additional config and is recommended. Once this group is created,
When you are logged in, you will need to create a base group to test the sync on. Using `eclipse` requires no additional config and is recommended. Once this group is created, any groups needed for projects should be added as they are currently not created if missing. For devMode, this group will be the group `spider.pig` under the `eclipse` group.
#### Secrets
##### Gitlab Secrets
This step assumes the previous Gitlab setup to completed, or you have access to the admin account running on the target instance. Open the [user preferences](http://localhost/-/profile/preferences) page and navigate to the `Access tokens` section. Once here, create an access token with the `api` permission set. This is needed to update or remove user permissions from groups and projects within the instance. Save this under your secrets directory within the file `access-token`.
This step assumes the previous Gitlab setup to be completed, or you have access to the admin account running on the target instance. Open the [user preferences](http://localhost/-/profile/preferences) page and navigate to the `Access tokens` section. Once here, create an access token with the `api` permission set. This is needed to update or remove user permissions from groups and projects within the instance. Save this under your secrets directory within the file `access-token`.
Additionally, an `eclipse-oauth-config` should be created when running the GitLab sync script. This file will define how connections to the Eclipse OAuth server should be handled. If this is missing, the GitLab sync script will fail. The file should be in JSON format, with the following being an example of format:
Additionally, an `eclipse-oauth-config` should be created when running the GitLab sync script. This file will define how connections to the Eclipse OAuth server should be handled. If this is missing, the GitLab sync script will fail. The file should be in JSON format, with the following being an example of the format:
```
{"oauth":{"timeout":3600, "client_id":"<client id>","client_secret":"<client secret>","endpoint":"https://accounts.eclipse.org","scope":"eclipsefdn_view_all_profiles","redirect":"http://localhost"}}
......@@ -172,7 +178,7 @@ Additionally, an `eclipse-oauth-config` should be created when running the GitLa
Should you not have access to these values and you are on the EF Webdev team, reach out on slack and they will be provided. Otherwise, these credentials are internal and not distributed to the general public.
#### Script run command
##### Gitlab script run command
Included below is an example command that can be used within Unix environments given the default setup instructions are followed:
......@@ -184,7 +190,7 @@ npm run lab-sync -- --devMode --verbose --secretLocation=$PWD/secrets -H "http:/
_[^ Back to top](#eclipsefdn-github-sync)_
## Creating a tagged release
Once a release candidate has been identified for production, tests should be run locally using the master branch to ensure that the integration of patches are stable as the pull requests that had been validated. Additionally, `npm ci && npm run test` should be run to ensure that the current package lock file is stable, passes tests, and contains no live vulnerabilities from upstream packages. If there is issues with this, patches should be created to address these issues before the release goes live.
Once a release candidate has been identified for production, tests should be run locally using the master branch to ensure that the integration of patches are stable as the pull requests that had been validated. Additionally, `npm ci && npm run test` should be run to ensure that the current package lock file is stable, passes tests, and contains no live vulnerabilities from upstream packages. If there are issues with this, patches should be created to address these issues before the release goes live.
When determining the version bump [semantic versioning spec](https://semver.org/) should be used, which also forms the base of how [NPM versioning works](https://docs.npmjs.com/about-semantic-versioning). The new version should be applied through a PR on the master branch. Once this is done a new tag can be created on the master branch with the format `v#.#.#`, where the numbers should match the version stated in the package.json file. While there is no anticipated need to create an NPM package release, it is good practice and can help keep code clean.
......
......@@ -51,6 +51,12 @@ let args = yargs(process.argv)
description: 'The short project ID of the target for the current sync run',
string: true,
})
.option('r', {
alias: 'rootGroup',
description: 'The root group to be used when syncing groups over (e.g. eclipse, openhwgroup)',
string: true,
default: 'eclipse',
})
.option('s', {
alias: 'secretLocation',
description: 'The location of the access-token file containing an API access token',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment