Make the default github.com endpoint mutable
The k8s operator seems to want to define its own endpoint. This change allows the removal of the default gh endpoint if no credentials are tied to it. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
1e0cb72aa3
commit
750446acec
92 changed files with 2568 additions and 1159 deletions
|
|
@ -212,9 +212,18 @@ func (s *sqlDatabase) ensureGithubEndpoint() error {
|
|||
UploadBaseURL: appdefaults.GithubDefaultUploadBaseURL,
|
||||
}
|
||||
|
||||
if _, err := s.CreateGithubEndpoint(context.Background(), createEndpointParams); err != nil {
|
||||
if !errors.Is(err, runnerErrors.ErrDuplicateEntity) {
|
||||
return errors.Wrap(err, "creating default github endpoint")
|
||||
var epCount int64
|
||||
if err := s.conn.Model(&GithubEndpoint{}).Count(&epCount).Error; err != nil {
|
||||
if !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return errors.Wrap(err, "counting github endpoints")
|
||||
}
|
||||
}
|
||||
|
||||
if epCount == 0 {
|
||||
if _, err := s.CreateGithubEndpoint(context.Background(), createEndpointParams); err != nil {
|
||||
if !errors.Is(err, runnerErrors.ErrDuplicateEntity) {
|
||||
return errors.Wrap(err, "creating default github endpoint")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue