Rename GitHub specific types

This change renames a lot of variables, types and functions to be more
generic. The goal is to allow GARM to add more forges in the future.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-05-12 21:47:13 +00:00
parent 4890eb4732
commit 40e6581a75
72 changed files with 896 additions and 700 deletions

View file

@ -299,7 +299,7 @@ func (s *sqlDatabase) migrateCredentialsToDB() (err error) {
CACertBundle: certBundle,
}
var endpoint params.GithubEndpoint
var endpoint params.ForgeEndpoint
endpoint, err = s.GetGithubEndpoint(adminCtx, hostname)
if err != nil {
if !errors.Is(err, runnerErrors.ErrNotFound) {
@ -315,10 +315,10 @@ func (s *sqlDatabase) migrateCredentialsToDB() (err error) {
Name: cred.Name,
Description: cred.Description,
Endpoint: endpoint.Name,
AuthType: params.GithubAuthType(cred.GetAuthType()),
AuthType: params.ForgeAuthType(cred.GetAuthType()),
}
switch credParams.AuthType {
case params.GithubAuthTypeApp:
case params.ForgeAuthTypeApp:
keyBytes, err := cred.App.PrivateKeyBytes()
if err != nil {
return errors.Wrap(err, "getting private key bytes")
@ -332,7 +332,7 @@ func (s *sqlDatabase) migrateCredentialsToDB() (err error) {
if err := credParams.App.Validate(); err != nil {
return errors.Wrap(err, "validating app credentials")
}
case params.GithubAuthTypePAT:
case params.ForgeAuthTypePAT:
token := cred.PAT.OAuth2Token
if token == "" {
token = cred.OAuth2Token