Skip to content

Commit

Permalink
Update Griffin web UI to use "MAIN" instead of "PRODUCTION". (#1169)
Browse files Browse the repository at this point in the history
  • Loading branch information
goodov authored Aug 9, 2024
1 parent a2aeaf1 commit 4ff61e2
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 14 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ A continuous integration server (CI) serializes and signs the updated seed file

## Git flow

1. Work in feature branch and when done create a PR to `main` branch (which will be picked up by CI for staging).
2. Verify that everything works as intended via the staging endpoint `--variations-server-url=https://variations.bravesoftware.com/seed`.
3. Cherry-pick the commit to production by creating another PR to `production` branch (which will be picked up by CI again).
1. Work in feature branch and when done create a PR to `main` branch.
2. Verify that everything works as intended via PR instructions (use `--variations-pr` flag).

## Key Generation and Exchange

Expand Down
4 changes: 2 additions & 2 deletions src/core/base_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// You can obtain one at https://mozilla.org/MPL/2.0/.

export enum SeedType {
PRODUCTION, // production Brave seed (brave-variations@production)
STAGING, // staging Brave seed (brave-variations@main)
MAIN, // main Brave seed (brave-variations@main)
STAGING, // staging Brave seed (brave-variations@staging)
UPSTREAM, // Chrome seed (Finch)
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/url_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { SeedType } from './base_types';

export const variationsProductionUrl = 'https://variations.brave.com/seed';
export const variationsMainUrl = 'https://variations.brave.com/seed';
export const variationsStagingUrl = 'https://variations.bravesoftware.com/seed';
export const variationsUpstreamUrl =
'https://griffin.brave.com/finch-data-private/seed.bin';
Expand Down Expand Up @@ -50,7 +50,7 @@ export function getStudyRawConfigUrl(
const BRAVE_VARIATIONS_REPO_PATTERN = '^github\\.com/brave/brave-variations$';
if (seedType === SeedType.UPSTREAM)
return `${getGitHubStorageUrl()}/blob/main/study/all-by-name/${study}`;
const branch = seedType === SeedType.PRODUCTION ? 'production' : 'main';
const branch = seedType === SeedType.MAIN ? 'main' : 'staging';
return makeSourceGraphUrl(
`"name": "${study}"`,
`${BRAVE_VARIATIONS_REPO_PATTERN}@${branch}`,
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function main(options: Options) {
process.exit(1);
}
if (options.base === undefined && !options.staged) {
options.base = getBaseBranch(['origin/main', 'origin/production']);
options.base = getBaseBranch(['origin/main']);
console.log(`Base branch: ${options.base}`);
}
const passed: boolean = await lintStaged({
Expand Down
2 changes: 1 addition & 1 deletion src/web/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ export function App() {
</a>
<nav className="nav nav-pills">
<NavItem
type={SeedType.PRODUCTION}
type={SeedType.MAIN}
searchParamManager={searchParamManager}
/>
<NavItem
Expand Down
3 changes: 1 addition & 2 deletions src/web/app/search_param_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ export class SearchParamManager {
const filter = new StudyFilter();
filter.search = searchParams.get('search') ?? undefined;
this.currentSeed =
stringToSeedType(searchParams.get('seed') ?? 'PRODUCTION') ??
SeedType.PRODUCTION;
stringToSeedType(searchParams.get('seed') ?? 'MAIN') ?? SeedType.MAIN;
filter.minPriority =
this.currentSeed === SeedType.UPSTREAM
? StudyPriority.STABLE_MIN
Expand Down
4 changes: 2 additions & 2 deletions src/web/app/seed_loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ async function loadSeedFromUrl(url: string, type: SeedType) {
export function loadSeedDataAsync(
cb: (type: SeedType, studyList: StudyListModel) => void,
) {
loadSeedFromUrl(url_utils.variationsProductionUrl, SeedType.PRODUCTION)
.then(cb.bind(cb, SeedType.PRODUCTION))
loadSeedFromUrl(url_utils.variationsMainUrl, SeedType.MAIN)
.then(cb.bind(cb, SeedType.MAIN))
.catch(console.error);
loadSeedFromUrl(url_utils.variationsStagingUrl, SeedType.STAGING)
.then(cb.bind(cb, SeedType.STAGING))
Expand Down
2 changes: 1 addition & 1 deletion src/web/app/study_model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function makeStudyModel(properties: proto.IStudy) {
isBraveSeed: true,
});
const randomID = Math.floor(Math.random() * 1000000);
return new StudyModel(processed, SeedType.PRODUCTION, randomID);
return new StudyModel(processed, SeedType.MAIN, randomID);
}

describe('models', () => {
Expand Down

0 comments on commit 4ff61e2

Please sign in to comment.