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

Move brain modules into subdirs #871

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/brain/apis/README.md → src/brain/github/apis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Shows the current ownership and publishing status of REST APIs within `sentry`

## Command: `apis`
## Command: `apis`

## Arguments: `team_name`
## Arguments: `team_name`
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jest.mock('google-auth-library');

import { GoogleAuth as MockedGoogleAuth } from 'google-auth-library';

import { MockedGithubOrg } from '../../../test/utils/testTypes';
import { MockedGithubOrg } from '../../../../test/utils/testTypes';

import { issueLabelHandler } from '.';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MockedGitHubAPI } from '@test/utils/testTypes';
import {
DB_TABLE_MATERIALS,
DB_TABLE_STAGES,
} from '@/brain/saveGoCDStageEvents';
} from '@/brain/gocd/saveGoCDStageEvents';
import { buildServer } from '@/buildServer';
import {
GETSENTRY_ORG,
Expand All @@ -23,8 +23,8 @@ import { bolt as originalBolt } from '@api/slack';
import { db } from '@utils/db';
import { getLastGetSentryGoCDDeploy } from '@utils/db/getLatestDeploy';

import { MockedBolt } from '../../../test/utils/testTypes';
import { FINAL_STAGE_NAMES } from '../../utils/gocd/gocdHelpers';
import { MockedBolt } from '../../../../test/utils/testTypes';
import { FINAL_STAGE_NAMES } from '../../../utils/gocd/gocdHelpers';

import * as actions from './actionViewUndeployedCommits';
import { pleaseDeployNotifier } from '.';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GETSENTRY_ORG } from '@/config';

import { MockedGitHubAPI } from '../../../test/utils/testTypes';
import { MockedGitHubAPI } from '../../../../test/utils/testTypes';

import { getAnnotations } from './getAnnotations';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import oldPayload from '@test/payloads/gocd/gocd-stage-building.json';
import { MockedBolt } from '@test/utils/testTypes';

import * as slackblocks from '@/blocks/slackBlocks';
import { DB_TABLE_STAGES } from '@/brain/saveGoCDStageEvents';
import { DB_TABLE_STAGES } from '@/brain/gocd/saveGoCDStageEvents';
import { buildServer } from '@/buildServer';
import {
DISCUSS_FRONTEND_CHANNEL_ID,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import payloadRaw from '@test/payloads/gocd/gocd-stage-building.json';
import { MockedBolt } from '@test/utils/testTypes';

import * as slackblocks from '@/blocks/slackBlocks';
import { DB_TABLE_STAGES } from '@/brain/saveGoCDStageEvents';
import { DB_TABLE_STAGES } from '@/brain/gocd/saveGoCDStageEvents';
import { buildServer } from '@/buildServer';
import {
FEED_DEV_INFRA_CHANNEL_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { GoCDPipeline, GoCDResponse } from '@/types/gocd';
import { bolt as originalBolt } from '@api/slack';
import { db } from '@utils/db';

import { MockedGitHubAPI } from '../../../test/utils/testTypes';
import { MockedGitHubAPI } from '../../../../test/utils/testTypes';

import { DeployFeed } from './deployFeed';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { FINAL_STAGE_NAMES, INPROGRESS_MSG } from '@/utils/gocd/gocdHelpers';
import { bolt } from '@api/slack';
import { db } from '@utils/db';

import { pleaseDeployNotifier } from '../pleaseDeployNotifier';
import { pleaseDeployNotifier } from '../../github/pleaseDeployNotifier';

import { handler, notifyOnGoCDStageEvent } from '.';

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createSlackAppMention } from '@test/utils/createSlackAppMention';
import { buildServer } from '@/buildServer';
import * as slackScoresFunctions from '@/webhooks/pubsub/slackScores';

import { TEAM_OSPO_CHANNEL_ID } from '../../config';
import { TEAM_OSPO_CHANNEL_ID } from '../../../config';

import { triggerPubSub } from '.';

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/db/getLatestDeploy.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DB_TABLE_STAGES } from '@/brain/saveGoCDStageEvents';
import { DB_TABLE_STAGES } from '@/brain/gocd/saveGoCDStageEvents';
import { db } from '@utils/db';

import { FINAL_STAGE_NAMES } from '../gocd/gocdHelpers';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/db/getLatestDeploy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DB_TABLE_STAGES } from '@/brain/saveGoCDStageEvents';
import { DB_TABLE_STAGES } from '@/brain/gocd/saveGoCDStageEvents';
import { DBGoCDDeployment } from '@/types/gocd';

import { FINAL_STAGE_NAMES } from '../gocd/gocdHelpers';
Expand Down
40 changes: 20 additions & 20 deletions src/utils/loadBrain.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { apis } from '@/brain/apis';
import { appHome } from '@/brain/appHome';
import { ghaCancel } from '@/brain/ghaCancel';
import { githubMetrics } from '@/brain/githubMetrics';
import { gocdConsecutiveUnsuccessfulAlert } from '@/brain/gocdConsecutiveUnsuccessfulAlert';
import { gocdDataDog } from '@/brain/gocdDataDog';
import { gocdNoDeploysAlert } from '@/brain/gocdNoDeploysAlert';
import { gocdSlackFeeds } from '@/brain/gocdSlackFeeds';
import { issueLabelHandler } from '@/brain/issueLabelHandler';
import { issueNotifier } from '@/brain/issueNotifier';
import { notificationPreferences } from '@/brain/notificationPreferences';
import { notifyOnGoCDStageEvent } from '@/brain/notifyOnGoCDStageEvent';
import { pleaseDeployNotifier } from '@/brain/pleaseDeployNotifier';
import { projectsHandler } from '@/brain/projectsHandler';
import { requiredChecks } from '@/brain/requiredChecks';
import { saveGoCDStageEvents } from '@/brain/saveGoCDStageEvents';
import { syncSlackUsers } from '@/brain/syncSlackUsers';
import { syncUserProfileChange } from '@/brain/syncUserProfileChange';
import { triggerPubSub } from '@/brain/triggerPubSub';
import { typescript } from '@/brain/typescript';
import { apis } from '@/brain/github/apis';
import { ghaCancel } from '@/brain/github/ghaCancel';
import { githubMetrics } from '@/brain/github/githubMetrics';
import { issueLabelHandler } from '@/brain/github/issueLabelHandler';
import { issueNotifier } from '@/brain/github/issueNotifier';
import { pleaseDeployNotifier } from '@/brain/github/pleaseDeployNotifier';
import { projectsHandler } from '@/brain/github/projectsHandler';
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit of a weird one since it fits into both github and gocd, though I do think it fits better in the former as you have it. Any thoughts?

import { requiredChecks } from '@/brain/github/requiredChecks';
import { gocdConsecutiveUnsuccessfulAlert } from '@/brain/gocd/gocdConsecutiveUnsuccessfulAlert';
import { gocdDataDog } from '@/brain/gocd/gocdDataDog';
import { gocdNoDeploysAlert } from '@/brain/gocd/gocdNoDeploysAlert';
import { gocdSlackFeeds } from '@/brain/gocd/gocdSlackFeeds';
import { notifyOnGoCDStageEvent } from '@/brain/gocd/notifyOnGoCDStageEvent';
import { saveGoCDStageEvents } from '@/brain/gocd/saveGoCDStageEvents';
import { appHome } from '@/brain/slack/appHome';
import { notificationPreferences } from '@/brain/slack/notificationPreferences';
import { syncSlackUsers } from '@/brain/slack/syncSlackUsers';
import { syncUserProfileChange } from '@/brain/slack/syncUserProfileChange';
import { triggerPubSub } from '@/brain/slack/triggerPubSub';
import { typescript } from '@/brain/slack/typescript';

/**
* Loads all functions in `@/brain`
Expand Down
2 changes: 1 addition & 1 deletion src/webhooks/pubsub/slackScores.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GETSENTRY_ORG, GH_ORGS } from '@/config';
import * as scoresUtils from '@/utils/db/scores';
import { bolt } from '@api/slack';

import * as getAPIsStatsMessage from '../../brain/apis/getStatsMessage';
import * as getAPIsStatsMessage from '../../brain/github/apis/getStatsMessage';
import {
DISCUSS_PRODUCT_CHANNEL_ID,
TEAM_OSPO_CHANNEL_ID,
Expand Down
4 changes: 2 additions & 2 deletions src/webhooks/pubsub/slackScores.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import moment from 'moment-timezone';

import { getMessageBlocks } from '@/brain/apis';
import { getStatsMessage } from '@/brain/apis/getStatsMessage';
import { getMessageBlocks } from '@/brain/github/apis';
import { getStatsMessage } from '@/brain/github/apis/getStatsMessage';
import {
DISCUSS_PRODUCT_CHANNEL_ID,
FEED_ENGINEERING_CHANNEL_ID,
Expand Down
Loading