Add forge instance entity#800
Open
gabriel-samfira wants to merge 8 commits into
Open
Conversation
This was referenced Jun 30, 2026
Closed
Add webhook management (create, list, get, delete) and runner operations (list, remove, registration token) at the Gitea instance level. These use the Gitea admin API endpoints (/admin/hooks, /admin/actions/runners). Also add SupportsInstancePools() method on EndpointType and the MetricsLabelInstanceScope constant for metrics recording.
Add the ForgeInstance and ForgeInstanceEvent models with UUID primary key and a unique index on endpoint_name. Add full CRUD operations modeled after enterprises, with endpoint name cross-validation against credentials. Add database migration 0003_forge_instances to create the new tables and add forge_instance_id columns to pools and workflow_jobs. Wire ForgeInstance into all entity type switches in pools, jobs, util (hasGithubEntity, GetForgeEntity, AddEntityEvent, SetEntityPoolManagerStatus, updateEntityCredentials).
Add ForgeInstance params type with GetEntity(), CreateForgeInstanceParams with forge type validation, and ForgeInstancePoolManager interface. Implement pool manager lifecycle (create, start, stop, retry) with WebSocket event subscriptions and cache worker integration. Add runner CRUD: create, list, get, update, delete forge instances, plus pool and instance management. Wire webhook dispatch for system hooks and add ForgeInstance to all entity type switches in pool manager, watcher filters, metadata service name, and job association. Remove unused FetchTools method from basePoolManager.
Add REST API endpoints for forge instance CRUD, pool management,
instance listing, and webhook install/uninstall/info under
/forge-instances/{forgeInstanceID}/...
Add garm-cli forge-instance command (add, list, show, update, delete)
with endpoint name or UUID resolution, --random-webhook-secret, and
--install-webhook support.
Add --forge-instance/-f flag to pool list and pool add commands.
Regenerate swagger spec and OpenAPI client.
Add Forge Instances section to sidebar navigation with list and detail pages. The list page shows endpoint name with forge type icon, credentials, pool balancing type, status, and CRUD actions. The detail page shows entity information, pools, instances, and events with real-time WebSocket updates. Add CreateForgeInstanceModal with endpoint selector (Gitea only), credentials selector, pool balancer type, agent mode, and webhook secret auto-generation. Update all entity type unions across components to include forge_instance. Wire ForgeInstance into eager cache, WebSocket subscriptions, pool entity resolution (getEntityName, getEntityType, getEntityUrl), CreatePoolModal entity level selector, UpdatePoolModal agent mode lookup, and EndpointCell clickable links.
Preload the entity's Endpoint relation in listEntityPools so that pools listed via entity-specific endpoints include endpoint info. Update the hardcoded SQL query in TestListAllPoolsDBFetchErr to include the new forge_instance_id column. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
3a98410 to
c87fc58
Compare
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
Contributor
|
I've set up a test instance to try this out, but I'm unsure whether I set it up properly. Here are the steps I followed:
Does this look right? I'm seeing the test environment receive webhook notifications from gitea, but rejecting them. Logs: |
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
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.
This change adds a new forge entity type along side
Repository{},Organization{}andEnterprise{}calledForgeInstance{}. This new entity type is available currently only onGiteaand possibly onForgejoif we ever get around to adding it.The new
ForgeInstance{}entity requires gitea credentials that haverwaccess to theadminapi. This feels a bit too much to allow GARM to have, but if instance level pools are required, it cannot be helped.The API is similar to the other entity types. WebUI has been updated to accomodate the new
ForgeInstancetype, as has the CLI.