RFC-167: enforce campaigns
Created by: flying-robot
This introduces a checkLicense
function into the existing campaignsEnabled
flow. We are relying on an environment variable to determine whether or not tiering should be enforced, and if set we advance to actually checking whether the current license supports the feature.
The existing permissions test cases are user-specific (e.g. is the user an admin, etc.) so the tiering tests wrap around them.
Here's how the UI renders when enforcement is on and the license check fails:
Here's how the UI renders when enforcement is off and the OSS build is in use (unchanged from main
):
Here's what the src
client returns when trying to send changeset specs up to the server:
GraphQL errors: 1 error occurred:
{
"message": "The feature \"campaigns\" is not activated in your Sourcegraph license. Upgrade your Sourcegraph subscription to use this feature.",
"path": [
"createChangesetSpec"
]
}
That output
☝ ️ happens fairly late in the flow, so maybe there's an opportunity to wire something into the client earlier before any wall-clock expensive work happens.
Here's what the src
client returns as above but on the OSS build (unchanged from main
):
GraphQL errors: 1 error occurred:
{
"message": "campaigns and changesets are only available in enterprise",
"path": [
"createChangesetSpec"
]
}
fixes https://github.com/sourcegraph/sourcegraph/issues/14029