-
Notifications
You must be signed in to change notification settings - Fork 17
Draft: Generic bot configuration System #359
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
Open
lykimq
wants to merge
52
commits into
master
Choose a base branch
from
quyen@bot_generic
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…them directly to use in bot
…ations, prepare for removal later
…nstallation.id and without it
…AT, remove GITHUB_ACCESS_TOKEN
…fig, fallback to the original hardcoded for backward compability
…s and improve performance
error handling. - make timeout configurable with bot_info, default is 5.0 if not set
…ith correct priority
becomes generic functions instead of rocq-specific ones
… more generic and not bot-specific
…cotest.fix, optimize comments
…rences, add api_timeout, fix run_bench calls
48a79b9 to
f4b44f3
Compare
afdb5f9 to
c6805c8
Compare
c6805c8 to
2bd6e76
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on #357. This PR is a bit big but it can be review per commit.
This PR removes all the hardcoded logic (fallback compatibility from the previous PR #357) and makes the bot fully generic.
What changed
Removed all hardcoded repo checks
3-Tier configuration
How bot is generic
Before (hardcoded):
Now (generic):
Feature checks
All features are optional and disabled if not configured:
github_project_number: enable backportgitlab_domain: enable GitLab mirrorminimizer_url: enable minimizationjobs.custom_job_status: enable custom job status CIjobs.bench: enable bench detectionConfiguration Priority
Explicit TOML > API auto-detection > Generic defaults
Tier 1: Explicit TOML (highest priority)
coqbot-config.tomlTier 2: API Auto-Detection (medium priority)
bot.api_timeout(TOML in[bot]section) orAPI_TIMEOUTenv var (default: 5.0 seconds)org_namefrom GitHub APITier 3: Generic Defaults (lowest priority)
team_name = "maintainers"Key components
1.
src/configrepo_config.ml: Parses TOML repo configsdefault.ml: Provides generic defaults for any repoauto_detection.ml: API-based auto-detection with cachingconfig_resolver.ml: Merges explicit/auto/default with prioritycache.ml: 1-hour TTL cache for auto-detection results (hardcoded)2.
src/webhooks/github.mlandgitlab.mlnow userepo_config_table(no hardcoded checks)3.
src/actions/backport.ml: Enabled viaconfig.github_project_numberjob.ml: Usesconfig.jobs.benchandconfig.jobs.custom_job_statuspr_sync.ml: Usesconfig.org_name,config.team_name,config.ci_config4.
bot-componentsinit_git_bare_repositoryfromsrc/utils/helpers.ml(removed) toGit_utils.mlGitHub_queries.ml(used for auto-detection):get_repository_info: Get repository info (owner, default branch)get_organization_teams: Get all teams for an organizationget_all_labels: Get all labels for a repositorybot_info.api_timeout)GitHub_GraphQL:GetRepositoryInfo: GraphQL query for repo info (owner, default branch)GetOrganizationTeams: for organization teamGetRepositoryLabels: for repo labelsGitLab_queries.ml:search_projects: Search for projects matching a term - detect GitLab domain/owner/repoget_ci_config_file: Get CI config file contentbot_info.api_timeout)GitLab_GraphQL:SearchProjects: query to search for GitLab projectsGetCIConfigFile: query to get CI config file content (.gitlab-ci.yml or .gitlab-ci.yaml)Configuration priority examples
minimizer_url: TOML[repositories.*] minimizer_url> Env varBOT_MINIMIZER_URL> Noneapi_timeout: TOML[bot] api_timeout> Env varAPI_TIMEOUT> Default 5.0Example to set up the bot
Minimal setup
What happens:
github = "my-org/my-repo"gitlab_domain = "gitlab.com"org_name = "my-org"team_name = "maintainers"Full-featured setup (like Rocq) - see
coqbot-config.tomlWhat this enables:
github_project_numbergitlab_domainminimizer_urljobs.benchjobs.custom_job_statusTest Coverage
config_resolver_test: 3-tier priority systemauto_detection_test,cache_test: API-based detection with cachingdefault_config_test: Generic defaults for any repointegration_test,repo_config_integration_test: End-to-end workflowsconfig_timeout_test: TOML and env var prioritygeneric_bot_demo_test: Demonstration tests showing how the bot config system works