Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[installer] Make blocked repositories configurable #9867

Merged
merged 3 commits into from
May 10, 2022

Conversation

andrew-farries
Copy link
Contributor

Description

One of the Webapp team's epics for Q2 is to use the Gitpod installer to deploy to Gitpod SaaS. In order to do that we will need to add additional configuration to the installer to make the output suitable for a SaaS deployment as opposed to a self-hosted deployment.

This PR makes it possible to configure blocked repositories for the server component:

Related Issue(s)

Part of #9097

How to test

Create an installer config file containing this experimental section:

experimental:
  webapp:
    server:
      blockedRepositories:
      - urlRegExp: "https://github.com/some-user/some-bad-repo"
        blockUser: true
      - urlRegExp: "https://github.com/some-other-user/another-bad-repo"
        blockUser: false

Get a versions.yaml for use with the installer:

docker run -it --rm "eu.gcr.io/gitpod-core-dev/build/versions:${version}" cat versions.yaml > versions.yaml

Then invoke the installer as:

go run . render --debug-version-file versions.yaml --config /path/to/config --use-experimental-config

The blockedRepositories field in the server config map will reflect the value set in the installer config.

Release Notes

Add `disableWorkspaceGarbageCollection` experimental installer config flag

Documentation

None.

@andrew-farries andrew-farries requested review from a team May 9, 2022 12:19
@github-actions github-actions bot added team: delivery Issue belongs to the self-hosted team team: webapp Issue belongs to the WebApp team labels May 9, 2022
Copy link
Member

@easyCZ easyCZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, added a couple of questions. Feel free to land without addressing them but wanted to raise them in this context.
/hold

EnableLocalApp *bool `json:"enableLocalApp"`
RunDbDeleter *bool `json:"runDbDeleter"`
DefaultBaseImageRegistryWhiteList []string `json:"defaultBaseImageRegistryWhitelist"`
BlockedRepositories []BlockedRepository `json:"blockedRepositories,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Would it make sense to comment the usage of a particular field? I know it's slightly increasing the scope of the PR here but I believe it would make onboarding new people to the team easier if they could read something like:

Suggested change
BlockedRepositories []BlockedRepository `json:"blockedRepositories,omitempty"`
// BlockedRepositories define repositories (by regex) which can be blocked.
// Repositories are often blocked due to abuse or ...
// To block a repository foo/bar, specify:
// { UrlRegExp: "https://github.com/foo/bar", BlockUser: false }
// ...
BlockedRepositories []BlockedRepository `json:"blockedRepositories,omitempty"`

This could also act as a good basis for documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least in this case, this documentation already exists in the server config:

/**
* List of repositories not allowed to be used for workspace starts.
* `blockUser` attribute to control handling of the user's account.
*/
blockedRepositories?: { urlRegExp: string; blockUser: boolean }[];

and there is a pretty close mapping between fields in this struct and those config fields.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up, There's #8441 to generate config documentation from the struct itself! Could be done together!

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@geropl
Copy link
Member

geropl commented May 10, 2022

/unhold

Because comments have been adressed above

Copy link
Contributor

@Pothulapati Pothulapati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Andrew Farries added 3 commits May 10, 2022 08:24
* Add new config under the `experimental.webapp.server` section.
* Add the new field to the configmap struct.
@andrew-farries andrew-farries force-pushed the af/installer-configure-blocked-repositories branch from d70c671 to f434d0f Compare May 10, 2022 08:28
@roboquat roboquat merged commit 539414d into main May 10, 2022
@roboquat roboquat deleted the af/installer-configure-blocked-repositories branch May 10, 2022 08:37
@roboquat roboquat added the deployed: webapp Meta team change is running in production label May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production release-note size/L team: delivery Issue belongs to the self-hosted team team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants