Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

gating: Add individual switches for disabling tools features#63686

Merged
stefanhengl merged 8 commits into
mainfrom
es/07-08-gatingaddindividualswitchesfordisablingtoolsfeatures
Jul 16, 2024
Merged

gating: Add individual switches for disabling tools features#63686
stefanhengl merged 8 commits into
mainfrom
es/07-08-gatingaddindividualswitchesfordisablingtoolsfeatures

Conversation

@eseliger

@eseliger eseliger commented Jul 8, 2024

Copy link
Copy Markdown
Member

This PR adds better gating for disabling the code monitors, notebooks, search jobs and own features.

Test plan

Ran locally and verified the features are gone when the env var is set. Ran again without those and they worked.

@cla-bot cla-bot Bot added the cla-signed label Jul 8, 2024

eseliger commented Jul 8, 2024

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @eseliger and the rest of your teammates on Graphite Graphite

@github-actions github-actions Bot added team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all labels Jul 8, 2024
This PR adds better gating for disabling the code monitors, notebooks, search jobs and own features.

Test plan:

Ran locally and verified the features are gone when the env var is set. Ran again without those and they worked.
@stefanhengl stefanhengl force-pushed the es/07-08-gatingaddindividualswitchesfordisablingtoolsfeatures branch from d75376f to 48b3917 Compare July 15, 2024 15:45
@stefanhengl stefanhengl marked this pull request as ready for review July 16, 2024 08:22
@stefanhengl stefanhengl self-requested a review July 16, 2024 08:22
Comment on lines 80 to 83
const showSearchContext = searchContextsEnabled && !isSourcegraphDotCom
const showSearchJobs = isSearchJobsEnabled()
const showSearchJobs = searchJobsEnabled && !isSourcegraphDotCom
const showSearchNotebook = notebooksEnabled && !isSourcegraphDotCom
const showCodeMonitoring = codeMonitoringEnabled && !isSourcegraphDotCom

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wonder if we can remove all these !isSourcegraphDotCom here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Notebooks doesn't have dot-com check in the backend. I will add it there and remove the checks in the client.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we could also make it more explicit by setting all these env vars before the rollout, then we don't need the dotcom checks at all

Comment on lines +25 to +27
if !codemonitors.IsEnabled() {
return nil
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I now realize that I overlooked one thing here:

Since this thing also checks if the current license allows the feature, the path from: set up instance -> log in first time -> paste license key -> start using features will now break and require a restart of all the services (basically every time the license terms change).

That's probably not ideal :/

Ideally, we would be able to interactively start and stop the subsystems we initialize here, but that's not a thing today.

Should we initially go with only env vars and follow-up with license key checks?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed

- adds DISABLE_BATCH_CHANGES, DISABLE_SEARCH_CONTEXTS
- removes license checks from code monitors and own
Branding: conf.Branding(),

BatchChangesEnabled: enterprise.BatchChangesEnabledForUser(ctx, db) == nil,
BatchChangesEnabled: batches.IsEnabled() && enterprise.BatchChangesEnabledForUser(ctx, db) == nil,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now batch changes also has an ENV we can check against.

@stefanhengl stefanhengl self-requested a review July 16, 2024 13:14
@stefanhengl stefanhengl merged commit a0a18a6 into main Jul 16, 2024
@stefanhengl stefanhengl deleted the es/07-08-gatingaddindividualswitchesfordisablingtoolsfeatures branch July 16, 2024 13:45
stefanhengl referenced this pull request Jul 16, 2024
Relates to https://github.com/sourcegraph/sourcegraph/pull/63686

We check the ENVs added in
https://github.com/sourcegraph/sourcegraph/pull/63686 and disable the
corresponding worker jobs if necessary.

Test plan:
TBD
stefanhengl referenced this pull request Jul 16, 2024
Relates to https://github.com/sourcegraph/sourcegraph/pull/63686

We check the ENVs added in
https://github.com/sourcegraph/sourcegraph/pull/63686 and disable the
corresponding worker jobs if necessary.

## Test plan
New unit tests
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants