Documentation ¶
Index ¶
- Constants
- func AutoImportProfile(log *logrus.Entry, ctx *Ctx, db *gorm.DB, dataSource *gorm.DB, ...)
- func EnsureStructure(log *logrus.Entry, db *gorm.DB)
- func OutputGitHubUserToJSON(log *logrus.Entry, ctx *Ctx, db *gorm.DB)
- type Ctx
- type EmployeeManager
- type EnrollmentWithOrg
- type GitHubClient
- func (c *GitHubClient) GetRepository(owner, repo string) (*github.Repository, *github.Response, error)
- func (c *GitHubClient) GetUserByID(id int64) (*github.User, *github.Response, error)
- func (c *GitHubClient) GetUserByLogin(login string) (*github.User, *github.Response, error)
- func (c *GitHubClient) Init(ctx *Ctx, log *logrus.Entry, cache *cache.Cache) error
- type GitHubGetRepositoryResult
- type GitHubGetUserResult
- type GitHubUserFromJSON
- type LocationCacheEntry
- type LocationClient
- type OrgConfig
- type OrgMapping
Constants ¶
View Source
const GitHubNoReplyEmailSuffix = "@users.noreply.github.com"
View Source
const GithubLoginAttrID string = "C-6934211695879389211"
View Source
const LarkCompany = "PingCAP"
View Source
const LarkContactGitHubLoginsCacheKey = "lark-contact-github-logins"
Variables ¶
This section is empty.
Functions ¶
func AutoImportProfile ¶
func AutoImportProfile( log *logrus.Entry, ctx *Ctx, db *gorm.DB, dataSource *gorm.DB, gc *GitHubClient, locationClient *LocationClient, employeeManager *EmployeeManager, memCache *cache.Cache, )
AutoImportProfile - Import GitHub user info from devstats and fetch their public profile information.
func EnsureStructure ¶
EnsureStructure is used to ensure the table structure existed in the database.
Types ¶
type Ctx ¶
type Ctx struct { IDDbDialect string // From ID_DB_DIALECT, default "mysql" IDDbHost string // From ID_DB_HOST, default "localhost" IDDbPort int // From ID_DB_PORT, default "3306" IDDbName string // From ID_DB_NAME, default "sortinghat" IDDbUser string // From ID_DB_USER, default "root" IDDbPass string // From ID_DB_PASS, default "password" IDDbSSL string // From ID_DB_SSL, default "disable" SkipBots bool // From SKIP_BOTS, default false SkipAutoImportProfile bool // From SKIP_AUTO_IMPORT_PROFILE, default false. SkipOutputGitHubUserJSON bool // From SKIP_OUTPUT_GITHUB_USER_JSON, default false. GitHubUsersJSONSourcePath string // From ID_GITHUB_USERS_JSON_SOURCE_PATH GitHubUsersJSONOutputPath string // From ID_GITHUB_USERS_JSON_OUTPUT_PATH CountryCodesFilePath string // From ID_COUNTRY_CODES_FILE_PATH, default "configs/shared/countries.csv" CacheFilePath string // From ID_CACHE_FILE_PATH, default "~/dump.out" OrganizationsFilePath string // From ID_ORGANIZATION_CONFIG_YAML, default "configs/shared/organizations.yaml" GoogleMapAPIKey string // From GOOGLE_MAP_API_KEY LarkAPIBaseURL string // From LARK_API_BASE_URL LarkAppID string // From LARK_APP_ID LarkAppSecret string // From LARK_APP_SECRET S3UploadGitHubUsersJSON bool // From S3_UPLOAD_GITHUB_USERS_JSON S3GitHubUsersJSONBucket string // From S3_GITHUB_USERS_JSON_BUCKET S3GitHubUsersJSONBucketKey string // From S3_GITHUB_USERS_JSON_BUCKET_KEY AwsAccessKeyID string // From AWS_ACCESS_KEY_ID AwsSecretAccessKey string // From AWS_SECRET_ACCESS_KEY AwsDefaultRegion string // From AWS_DEFAULT_REGION DevstatsAPIBaseURL string // From DEVSTATS_API_BASE_URL lib.Ctx }
type EmployeeManager ¶
type EmployeeManager struct {
// contains filtered or unexported fields
}
func (*EmployeeManager) Init ¶
func (m *EmployeeManager) Init(ctx Ctx, log *logrus.Entry, memCache *cache.Cache) error
func (*EmployeeManager) IsEmployeeLogin ¶
func (m *EmployeeManager) IsEmployeeLogin(githubLogin string) bool
IsEmployeeLogin used to determine whether the given GitHub login is the employee's login
func (*EmployeeManager) PrepareGitHubLogins ¶
func (m *EmployeeManager) PrepareGitHubLogins() error
PrepareGitHubLogins - Get GitHub login from Lark contact.
type EnrollmentWithOrg ¶
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
func (*GitHubClient) GetRepository ¶
func (c *GitHubClient) GetRepository(owner, repo string) (*github.Repository, *github.Response, error)
func (*GitHubClient) GetUserByID ¶
func (*GitHubClient) GetUserByLogin ¶
type GitHubGetRepositoryResult ¶
type GitHubGetRepositoryResult struct { Repository github.Repository Err string }
type GitHubGetUserResult ¶
type GitHubUserFromJSON ¶
type GitHubUserFromJSON struct { Login string `json:"login"` // Email use ! instead of @ for email encoding. Email string `json:"email"` // Affiliation format: "YouTube < 2016-10-01, Google", Affiliation string `json:"affiliation,omitempty"` // Source valid values: "notfound": -20, "domain": -10, "": 0, "config": 10, "manual": 20, "user_manual": 30, "user": 40 Source string `json:"source"` Name string `json:"name"` CountryID *string `json:"country_id,omitempty"` Sex *string `json:"sex,omitempty"` SexProb *float64 `json:"sex_prob,omitempty"` Tz *string `json:"tz,omitempty"` Age *int `json:"age,omitempty"` }
GitHubUserFromJSON - single GitHub user entry from cncf/gitdm `github_users.json` JSON.
type LocationCacheEntry ¶
type LocationClient ¶
type LocationClient struct {
// contains filtered or unexported fields
}
LocationClient - used to get formatted location address and country code.
func (*LocationClient) FormattedLocation ¶
type OrgConfig ¶
type OrgConfig struct {
OrgMappings []OrgMapping `yaml:"organizations"`
}
OrgConfig is the data structure of organizations.yaml file.
type OrgMapping ¶
Click to show internal directories.
Click to hide internal directories.