[cloud][CLOUD-79] Put some graphql routes behind organization related feature flag
Created by: kopancek
Description
This change puts all newly added graphql routes for organizations code host connections and repositories behind a feature flag
This way we can control which organizations have access to the feature. This is needed for easier support of Early Access customers
Related issue
https://sourcegraph.atlassian.net/browse/CLOUD-79
Screenshots
Testing locally
To test locally, you need to follow these steps:
- start sourcegraph with
EXTSVC_CONFIG_ALLOW_EDITS=true sg start dotcom
- Create a user, and modify the user tags in postgres:
UPDATE users SET tags = '{OrgsCode}' WHERE id = 1;
- Add an organization and yourself as a member of it
- You should be able to see the organization codehost connections and repository views. But the graphql call to add a codehost connection should fail.
- Go to API console and add a feature flag called
org-code
, with a default value offalse
by running the following mutation:
mutation CreateFeatureFlag{
createFeatureFlag(
name: "org-code",
value: false,
){
__typename
}
}
- The behavior should still be the same as before
- Create a feature flag override, with an override for organization you created and a value of
true
. The value for namespace is base64 encoded, e.g. 'Org: 1' if ID of your organization is 1:
mutation CreateFeatureFlagOverride{
createFeatureFlagOverride(
namespace: "T3JnOjE=",
flagName: "org-code",
value: true,
){
__typename
}
}
- The graphql call to add a codehost connection should work now, same for the organization repositories.
Follow-up work
This is not completely finished. We need to do a similar check on the UI side of things, not to show the screens if the feature flag is false