diff --git a/apiserver/controllers/instances.go b/apiserver/controllers/instances.go index b5504f76..962264f9 100644 --- a/apiserver/controllers/instances.go +++ b/apiserver/controllers/instances.go @@ -128,8 +128,15 @@ func (a *APIController) GetInstanceHandler(w http.ResponseWriter, r *http.Reques // in: query // required: false // -// Responses: -// default: APIErrorResponse +// + name: bypassGHUnauthorized +// description: If true GARM will ignore unauthorized errors returned by GitHub when removing a runner. This is useful if you want to clean up runners and your credentials have expired. +// type: boolean +// in: query +// required: false +// +// Responses: +// +// default: APIErrorResponse func (a *APIController) DeleteInstanceHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() vars := mux.Vars(r) @@ -146,7 +153,8 @@ func (a *APIController) DeleteInstanceHandler(w http.ResponseWriter, r *http.Req } forceRemove, _ := strconv.ParseBool(r.URL.Query().Get("forceRemove")) - if err := a.r.DeleteRunner(ctx, instanceName, forceRemove); err != nil { + bypassGHUnauthorized, _ := strconv.ParseBool(r.URL.Query().Get("bypassGHUnauthorized")) + if err := a.r.DeleteRunner(ctx, instanceName, forceRemove, bypassGHUnauthorized); err != nil { slog.With(slog.Any("error", err)).ErrorContext(ctx, "removing runner") handleError(ctx, w, err) return diff --git a/apiserver/swagger.yaml b/apiserver/swagger.yaml index 2d269391..8c15758c 100644 --- a/apiserver/swagger.yaml +++ b/apiserver/swagger.yaml @@ -601,6 +601,10 @@ paths: in: query name: forceRemove type: boolean + - description: If true GARM will ignore unauthorized errors returned by GitHub when removing a runner. This is useful if you want to clean up runners and your credentials have expired. + in: query + name: bypassGHUnauthorized + type: boolean responses: default: description: APIErrorResponse diff --git a/client/instances/delete_instance_parameters.go b/client/instances/delete_instance_parameters.go index d4f9695c..4a88ea5b 100644 --- a/client/instances/delete_instance_parameters.go +++ b/client/instances/delete_instance_parameters.go @@ -62,6 +62,12 @@ DeleteInstanceParams contains all the parameters to send to the API endpoint */ type DeleteInstanceParams struct { + /* BypassGHUnauthorized. + + If true GARM will ignore unauthorized errors returned by GitHub when removing a runner. This is useful if you want to clean up runners and your credentials have expired. + */ + BypassGHUnauthorized *bool + /* ForceRemove. If true GARM will ignore any provider error when removing the runner and will continue to remove the runner from github and the GARM database. @@ -127,6 +133,17 @@ func (o *DeleteInstanceParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } +// WithBypassGHUnauthorized adds the bypassGHUnauthorized to the delete instance params +func (o *DeleteInstanceParams) WithBypassGHUnauthorized(bypassGHUnauthorized *bool) *DeleteInstanceParams { + o.SetBypassGHUnauthorized(bypassGHUnauthorized) + return o +} + +// SetBypassGHUnauthorized adds the bypassGHUnauthorized to the delete instance params +func (o *DeleteInstanceParams) SetBypassGHUnauthorized(bypassGHUnauthorized *bool) { + o.BypassGHUnauthorized = bypassGHUnauthorized +} + // WithForceRemove adds the forceRemove to the delete instance params func (o *DeleteInstanceParams) WithForceRemove(forceRemove *bool) *DeleteInstanceParams { o.SetForceRemove(forceRemove) @@ -157,6 +174,23 @@ func (o *DeleteInstanceParams) WriteToRequest(r runtime.ClientRequest, reg strfm } var res []error + if o.BypassGHUnauthorized != nil { + + // query param bypassGHUnauthorized + var qrBypassGHUnauthorized bool + + if o.BypassGHUnauthorized != nil { + qrBypassGHUnauthorized = *o.BypassGHUnauthorized + } + qBypassGHUnauthorized := swag.FormatBool(qrBypassGHUnauthorized) + if qBypassGHUnauthorized != "" { + + if err := r.SetQueryParam("bypassGHUnauthorized", qBypassGHUnauthorized); err != nil { + return err + } + } + } + if o.ForceRemove != nil { // query param forceRemove diff --git a/cmd/garm-cli/cmd/runner.go b/cmd/garm-cli/cmd/runner.go index b3c00ae8..248f3fc3 100644 --- a/cmd/garm-cli/cmd/runner.go +++ b/cmd/garm-cli/cmd/runner.go @@ -29,11 +29,12 @@ import ( ) var ( - runnerRepository string - runnerOrganization string - runnerEnterprise string - runnerAll bool - forceRemove bool + runnerRepository string + runnerOrganization string + runnerEnterprise string + runnerAll bool + forceRemove bool + bypassGHUnauthorized bool ) // runnerCmd represents the runner command @@ -190,6 +191,7 @@ to either cancel the workflow or wait for it to finish. deleteInstanceReq := apiClientInstances.NewDeleteInstanceParams() deleteInstanceReq.InstanceName = args[0] deleteInstanceReq.ForceRemove = &forceRemove + deleteInstanceReq.BypassGHUnauthorized = &bypassGHUnauthorized if err := apiCli.Instances.DeleteInstance(deleteInstanceReq, authToken); err != nil { return err } @@ -205,6 +207,7 @@ func init() { runnerListCmd.MarkFlagsMutuallyExclusive("repo", "org", "enterprise", "all") runnerDeleteCmd.Flags().BoolVarP(&forceRemove, "force-remove-runner", "f", false, "Forcefully remove a runner. If set to true, GARM will ignore provider errors when removing the runner.") + runnerDeleteCmd.Flags().BoolVarP(&bypassGHUnauthorized, "bypass-github-unauthorized", "b", false, "Ignore Unauthorized errors from GitHub and proceed with removing runner from provider and DB. This is useful when credentials are no longer valid and you want to remove your runners. Warning, this has the potential to leave orphaned runners in GitHub. You will need to update your credentials to properly consolidate.") runnerDeleteCmd.MarkFlagsMutuallyExclusive("force-remove-runner") runnerCmd.AddCommand( diff --git a/database/common/mocks/Store.go b/database/common/mocks/Store.go index 7d9f58fa..e709d770 100644 --- a/database/common/mocks/Store.go +++ b/database/common/mocks/Store.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.1. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type Store struct { func (_m *Store) AddInstanceEvent(ctx context.Context, instanceID string, event params.EventType, eventLevel params.EventLevel, eventMessage string) error { ret := _m.Called(ctx, instanceID, event, eventLevel, eventMessage) + if len(ret) == 0 { + panic("no return value specified for AddInstanceEvent") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, params.EventType, params.EventLevel, string) error); ok { r0 = rf(ctx, instanceID, event, eventLevel, eventMessage) @@ -32,6 +36,10 @@ func (_m *Store) AddInstanceEvent(ctx context.Context, instanceID string, event func (_m *Store) BreakLockJobIsQueued(ctx context.Context, jobID int64) error { ret := _m.Called(ctx, jobID) + if len(ret) == 0 { + panic("no return value specified for BreakLockJobIsQueued") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok { r0 = rf(ctx, jobID) @@ -46,6 +54,10 @@ func (_m *Store) BreakLockJobIsQueued(ctx context.Context, jobID int64) error { func (_m *Store) ControllerInfo() (params.ControllerInfo, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ControllerInfo") + } + var r0 params.ControllerInfo var r1 error if rf, ok := ret.Get(0).(func() (params.ControllerInfo, error)); ok { @@ -70,6 +82,10 @@ func (_m *Store) ControllerInfo() (params.ControllerInfo, error) { func (_m *Store) CreateEnterprise(ctx context.Context, name string, credentialsName string, webhookSecret string) (params.Enterprise, error) { ret := _m.Called(ctx, name, credentialsName, webhookSecret) + if len(ret) == 0 { + panic("no return value specified for CreateEnterprise") + } + var r0 params.Enterprise var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, string) (params.Enterprise, error)); ok { @@ -94,6 +110,10 @@ func (_m *Store) CreateEnterprise(ctx context.Context, name string, credentialsN func (_m *Store) CreateEnterprisePool(ctx context.Context, enterpriseID string, param params.CreatePoolParams) (params.Pool, error) { ret := _m.Called(ctx, enterpriseID, param) + if len(ret) == 0 { + panic("no return value specified for CreateEnterprisePool") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.CreatePoolParams) (params.Pool, error)); ok { @@ -118,6 +138,10 @@ func (_m *Store) CreateEnterprisePool(ctx context.Context, enterpriseID string, func (_m *Store) CreateInstance(ctx context.Context, poolID string, param params.CreateInstanceParams) (params.Instance, error) { ret := _m.Called(ctx, poolID, param) + if len(ret) == 0 { + panic("no return value specified for CreateInstance") + } + var r0 params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.CreateInstanceParams) (params.Instance, error)); ok { @@ -142,6 +166,10 @@ func (_m *Store) CreateInstance(ctx context.Context, poolID string, param params func (_m *Store) CreateOrUpdateJob(ctx context.Context, job params.Job) (params.Job, error) { ret := _m.Called(ctx, job) + if len(ret) == 0 { + panic("no return value specified for CreateOrUpdateJob") + } + var r0 params.Job var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.Job) (params.Job, error)); ok { @@ -166,6 +194,10 @@ func (_m *Store) CreateOrUpdateJob(ctx context.Context, job params.Job) (params. func (_m *Store) CreateOrganization(ctx context.Context, name string, credentialsName string, webhookSecret string) (params.Organization, error) { ret := _m.Called(ctx, name, credentialsName, webhookSecret) + if len(ret) == 0 { + panic("no return value specified for CreateOrganization") + } + var r0 params.Organization var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, string) (params.Organization, error)); ok { @@ -186,23 +218,27 @@ func (_m *Store) CreateOrganization(ctx context.Context, name string, credential return r0, r1 } -// CreateOrganizationPool provides a mock function with given fields: ctx, orgId, param -func (_m *Store) CreateOrganizationPool(ctx context.Context, orgId string, param params.CreatePoolParams) (params.Pool, error) { - ret := _m.Called(ctx, orgId, param) +// CreateOrganizationPool provides a mock function with given fields: ctx, orgID, param +func (_m *Store) CreateOrganizationPool(ctx context.Context, orgID string, param params.CreatePoolParams) (params.Pool, error) { + ret := _m.Called(ctx, orgID, param) + + if len(ret) == 0 { + panic("no return value specified for CreateOrganizationPool") + } var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.CreatePoolParams) (params.Pool, error)); ok { - return rf(ctx, orgId, param) + return rf(ctx, orgID, param) } if rf, ok := ret.Get(0).(func(context.Context, string, params.CreatePoolParams) params.Pool); ok { - r0 = rf(ctx, orgId, param) + r0 = rf(ctx, orgID, param) } else { r0 = ret.Get(0).(params.Pool) } if rf, ok := ret.Get(1).(func(context.Context, string, params.CreatePoolParams) error); ok { - r1 = rf(ctx, orgId, param) + r1 = rf(ctx, orgID, param) } else { r1 = ret.Error(1) } @@ -214,6 +250,10 @@ func (_m *Store) CreateOrganizationPool(ctx context.Context, orgId string, param func (_m *Store) CreateRepository(ctx context.Context, owner string, name string, credentialsName string, webhookSecret string) (params.Repository, error) { ret := _m.Called(ctx, owner, name, credentialsName, webhookSecret) + if len(ret) == 0 { + panic("no return value specified for CreateRepository") + } + var r0 params.Repository var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) (params.Repository, error)); ok { @@ -234,23 +274,27 @@ func (_m *Store) CreateRepository(ctx context.Context, owner string, name string return r0, r1 } -// CreateRepositoryPool provides a mock function with given fields: ctx, repoId, param -func (_m *Store) CreateRepositoryPool(ctx context.Context, repoId string, param params.CreatePoolParams) (params.Pool, error) { - ret := _m.Called(ctx, repoId, param) +// CreateRepositoryPool provides a mock function with given fields: ctx, repoID, param +func (_m *Store) CreateRepositoryPool(ctx context.Context, repoID string, param params.CreatePoolParams) (params.Pool, error) { + ret := _m.Called(ctx, repoID, param) + + if len(ret) == 0 { + panic("no return value specified for CreateRepositoryPool") + } var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.CreatePoolParams) (params.Pool, error)); ok { - return rf(ctx, repoId, param) + return rf(ctx, repoID, param) } if rf, ok := ret.Get(0).(func(context.Context, string, params.CreatePoolParams) params.Pool); ok { - r0 = rf(ctx, repoId, param) + r0 = rf(ctx, repoID, param) } else { r0 = ret.Get(0).(params.Pool) } if rf, ok := ret.Get(1).(func(context.Context, string, params.CreatePoolParams) error); ok { - r1 = rf(ctx, repoId, param) + r1 = rf(ctx, repoID, param) } else { r1 = ret.Error(1) } @@ -262,6 +306,10 @@ func (_m *Store) CreateRepositoryPool(ctx context.Context, repoId string, param func (_m *Store) CreateUser(ctx context.Context, user params.NewUserParams) (params.User, error) { ret := _m.Called(ctx, user) + if len(ret) == 0 { + panic("no return value specified for CreateUser") + } + var r0 params.User var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.NewUserParams) (params.User, error)); ok { @@ -286,6 +334,10 @@ func (_m *Store) CreateUser(ctx context.Context, user params.NewUserParams) (par func (_m *Store) DeleteCompletedJobs(ctx context.Context) error { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for DeleteCompletedJobs") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context) error); ok { r0 = rf(ctx) @@ -300,6 +352,10 @@ func (_m *Store) DeleteCompletedJobs(ctx context.Context) error { func (_m *Store) DeleteEnterprise(ctx context.Context, enterpriseID string) error { ret := _m.Called(ctx, enterpriseID) + if len(ret) == 0 { + panic("no return value specified for DeleteEnterprise") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, enterpriseID) @@ -314,6 +370,10 @@ func (_m *Store) DeleteEnterprise(ctx context.Context, enterpriseID string) erro func (_m *Store) DeleteEnterprisePool(ctx context.Context, enterpriseID string, poolID string) error { ret := _m.Called(ctx, enterpriseID, poolID) + if len(ret) == 0 { + panic("no return value specified for DeleteEnterprisePool") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, enterpriseID, poolID) @@ -328,6 +388,10 @@ func (_m *Store) DeleteEnterprisePool(ctx context.Context, enterpriseID string, func (_m *Store) DeleteInstance(ctx context.Context, poolID string, instanceName string) error { ret := _m.Called(ctx, poolID, instanceName) + if len(ret) == 0 { + panic("no return value specified for DeleteInstance") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, poolID, instanceName) @@ -342,6 +406,10 @@ func (_m *Store) DeleteInstance(ctx context.Context, poolID string, instanceName func (_m *Store) DeleteJob(ctx context.Context, jobID int64) error { ret := _m.Called(ctx, jobID) + if len(ret) == 0 { + panic("no return value specified for DeleteJob") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok { r0 = rf(ctx, jobID) @@ -356,6 +424,10 @@ func (_m *Store) DeleteJob(ctx context.Context, jobID int64) error { func (_m *Store) DeleteOrganization(ctx context.Context, orgID string) error { ret := _m.Called(ctx, orgID) + if len(ret) == 0 { + panic("no return value specified for DeleteOrganization") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, orgID) @@ -370,6 +442,10 @@ func (_m *Store) DeleteOrganization(ctx context.Context, orgID string) error { func (_m *Store) DeleteOrganizationPool(ctx context.Context, orgID string, poolID string) error { ret := _m.Called(ctx, orgID, poolID) + if len(ret) == 0 { + panic("no return value specified for DeleteOrganizationPool") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, orgID, poolID) @@ -384,6 +460,10 @@ func (_m *Store) DeleteOrganizationPool(ctx context.Context, orgID string, poolI func (_m *Store) DeletePoolByID(ctx context.Context, poolID string) error { ret := _m.Called(ctx, poolID) + if len(ret) == 0 { + panic("no return value specified for DeletePoolByID") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, poolID) @@ -398,6 +478,10 @@ func (_m *Store) DeletePoolByID(ctx context.Context, poolID string) error { func (_m *Store) DeleteRepository(ctx context.Context, repoID string) error { ret := _m.Called(ctx, repoID) + if len(ret) == 0 { + panic("no return value specified for DeleteRepository") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, repoID) @@ -412,6 +496,10 @@ func (_m *Store) DeleteRepository(ctx context.Context, repoID string) error { func (_m *Store) DeleteRepositoryPool(ctx context.Context, repoID string, poolID string) error { ret := _m.Called(ctx, repoID, poolID) + if len(ret) == 0 { + panic("no return value specified for DeleteRepositoryPool") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok { r0 = rf(ctx, repoID, poolID) @@ -426,6 +514,10 @@ func (_m *Store) DeleteRepositoryPool(ctx context.Context, repoID string, poolID func (_m *Store) FindEnterprisePoolByTags(ctx context.Context, enterpriseID string, tags []string) (params.Pool, error) { ret := _m.Called(ctx, enterpriseID, tags) + if len(ret) == 0 { + panic("no return value specified for FindEnterprisePoolByTags") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, []string) (params.Pool, error)); ok { @@ -450,6 +542,10 @@ func (_m *Store) FindEnterprisePoolByTags(ctx context.Context, enterpriseID stri func (_m *Store) FindOrganizationPoolByTags(ctx context.Context, orgID string, tags []string) (params.Pool, error) { ret := _m.Called(ctx, orgID, tags) + if len(ret) == 0 { + panic("no return value specified for FindOrganizationPoolByTags") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, []string) (params.Pool, error)); ok { @@ -474,6 +570,10 @@ func (_m *Store) FindOrganizationPoolByTags(ctx context.Context, orgID string, t func (_m *Store) FindPoolsMatchingAllTags(ctx context.Context, entityType params.PoolType, entityID string, tags []string) ([]params.Pool, error) { ret := _m.Called(ctx, entityType, entityID, tags) + if len(ret) == 0 { + panic("no return value specified for FindPoolsMatchingAllTags") + } + var r0 []params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.PoolType, string, []string) ([]params.Pool, error)); ok { @@ -500,6 +600,10 @@ func (_m *Store) FindPoolsMatchingAllTags(ctx context.Context, entityType params func (_m *Store) FindRepositoryPoolByTags(ctx context.Context, repoID string, tags []string) (params.Pool, error) { ret := _m.Called(ctx, repoID, tags) + if len(ret) == 0 { + panic("no return value specified for FindRepositoryPoolByTags") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, []string) (params.Pool, error)); ok { @@ -524,6 +628,10 @@ func (_m *Store) FindRepositoryPoolByTags(ctx context.Context, repoID string, ta func (_m *Store) GetEnterprise(ctx context.Context, name string) (params.Enterprise, error) { ret := _m.Called(ctx, name) + if len(ret) == 0 { + panic("no return value specified for GetEnterprise") + } + var r0 params.Enterprise var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.Enterprise, error)); ok { @@ -548,6 +656,10 @@ func (_m *Store) GetEnterprise(ctx context.Context, name string) (params.Enterpr func (_m *Store) GetEnterpriseByID(ctx context.Context, enterpriseID string) (params.Enterprise, error) { ret := _m.Called(ctx, enterpriseID) + if len(ret) == 0 { + panic("no return value specified for GetEnterpriseByID") + } + var r0 params.Enterprise var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.Enterprise, error)); ok { @@ -572,6 +684,10 @@ func (_m *Store) GetEnterpriseByID(ctx context.Context, enterpriseID string) (pa func (_m *Store) GetEnterprisePool(ctx context.Context, enterpriseID string, poolID string) (params.Pool, error) { ret := _m.Called(ctx, enterpriseID, poolID) + if len(ret) == 0 { + panic("no return value specified for GetEnterprisePool") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string) (params.Pool, error)); ok { @@ -596,6 +712,10 @@ func (_m *Store) GetEnterprisePool(ctx context.Context, enterpriseID string, poo func (_m *Store) GetInstanceByName(ctx context.Context, instanceName string) (params.Instance, error) { ret := _m.Called(ctx, instanceName) + if len(ret) == 0 { + panic("no return value specified for GetInstanceByName") + } + var r0 params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.Instance, error)); ok { @@ -620,6 +740,10 @@ func (_m *Store) GetInstanceByName(ctx context.Context, instanceName string) (pa func (_m *Store) GetJobByID(ctx context.Context, jobID int64) (params.Job, error) { ret := _m.Called(ctx, jobID) + if len(ret) == 0 { + panic("no return value specified for GetJobByID") + } + var r0 params.Job var r1 error if rf, ok := ret.Get(0).(func(context.Context, int64) (params.Job, error)); ok { @@ -644,6 +768,10 @@ func (_m *Store) GetJobByID(ctx context.Context, jobID int64) (params.Job, error func (_m *Store) GetOrganization(ctx context.Context, name string) (params.Organization, error) { ret := _m.Called(ctx, name) + if len(ret) == 0 { + panic("no return value specified for GetOrganization") + } + var r0 params.Organization var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.Organization, error)); ok { @@ -668,6 +796,10 @@ func (_m *Store) GetOrganization(ctx context.Context, name string) (params.Organ func (_m *Store) GetOrganizationByID(ctx context.Context, orgID string) (params.Organization, error) { ret := _m.Called(ctx, orgID) + if len(ret) == 0 { + panic("no return value specified for GetOrganizationByID") + } + var r0 params.Organization var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.Organization, error)); ok { @@ -692,6 +824,10 @@ func (_m *Store) GetOrganizationByID(ctx context.Context, orgID string) (params. func (_m *Store) GetOrganizationPool(ctx context.Context, orgID string, poolID string) (params.Pool, error) { ret := _m.Called(ctx, orgID, poolID) + if len(ret) == 0 { + panic("no return value specified for GetOrganizationPool") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string) (params.Pool, error)); ok { @@ -716,6 +852,10 @@ func (_m *Store) GetOrganizationPool(ctx context.Context, orgID string, poolID s func (_m *Store) GetPoolByID(ctx context.Context, poolID string) (params.Pool, error) { ret := _m.Called(ctx, poolID) + if len(ret) == 0 { + panic("no return value specified for GetPoolByID") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.Pool, error)); ok { @@ -740,6 +880,10 @@ func (_m *Store) GetPoolByID(ctx context.Context, poolID string) (params.Pool, e func (_m *Store) GetPoolInstanceByName(ctx context.Context, poolID string, instanceName string) (params.Instance, error) { ret := _m.Called(ctx, poolID, instanceName) + if len(ret) == 0 { + panic("no return value specified for GetPoolInstanceByName") + } + var r0 params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string) (params.Instance, error)); ok { @@ -764,6 +908,10 @@ func (_m *Store) GetPoolInstanceByName(ctx context.Context, poolID string, insta func (_m *Store) GetRepository(ctx context.Context, owner string, name string) (params.Repository, error) { ret := _m.Called(ctx, owner, name) + if len(ret) == 0 { + panic("no return value specified for GetRepository") + } + var r0 params.Repository var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string) (params.Repository, error)); ok { @@ -788,6 +936,10 @@ func (_m *Store) GetRepository(ctx context.Context, owner string, name string) ( func (_m *Store) GetRepositoryByID(ctx context.Context, repoID string) (params.Repository, error) { ret := _m.Called(ctx, repoID) + if len(ret) == 0 { + panic("no return value specified for GetRepositoryByID") + } + var r0 params.Repository var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.Repository, error)); ok { @@ -812,6 +964,10 @@ func (_m *Store) GetRepositoryByID(ctx context.Context, repoID string) (params.R func (_m *Store) GetRepositoryPool(ctx context.Context, repoID string, poolID string) (params.Pool, error) { ret := _m.Called(ctx, repoID, poolID) + if len(ret) == 0 { + panic("no return value specified for GetRepositoryPool") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string) (params.Pool, error)); ok { @@ -836,6 +992,10 @@ func (_m *Store) GetRepositoryPool(ctx context.Context, repoID string, poolID st func (_m *Store) GetUser(ctx context.Context, user string) (params.User, error) { ret := _m.Called(ctx, user) + if len(ret) == 0 { + panic("no return value specified for GetUser") + } + var r0 params.User var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.User, error)); ok { @@ -860,6 +1020,10 @@ func (_m *Store) GetUser(ctx context.Context, user string) (params.User, error) func (_m *Store) GetUserByID(ctx context.Context, userID string) (params.User, error) { ret := _m.Called(ctx, userID) + if len(ret) == 0 { + panic("no return value specified for GetUserByID") + } + var r0 params.User var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (params.User, error)); ok { @@ -884,6 +1048,10 @@ func (_m *Store) GetUserByID(ctx context.Context, userID string) (params.User, e func (_m *Store) HasAdminUser(ctx context.Context) bool { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for HasAdminUser") + } + var r0 bool if rf, ok := ret.Get(0).(func(context.Context) bool); ok { r0 = rf(ctx) @@ -898,6 +1066,10 @@ func (_m *Store) HasAdminUser(ctx context.Context) bool { func (_m *Store) InitController() (params.ControllerInfo, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InitController") + } + var r0 params.ControllerInfo var r1 error if rf, ok := ret.Get(0).(func() (params.ControllerInfo, error)); ok { @@ -922,6 +1094,10 @@ func (_m *Store) InitController() (params.ControllerInfo, error) { func (_m *Store) ListAllInstances(ctx context.Context) ([]params.Instance, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ListAllInstances") + } + var r0 []params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]params.Instance, error)); ok { @@ -948,6 +1124,10 @@ func (_m *Store) ListAllInstances(ctx context.Context) ([]params.Instance, error func (_m *Store) ListAllJobs(ctx context.Context) ([]params.Job, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ListAllJobs") + } + var r0 []params.Job var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]params.Job, error)); ok { @@ -974,6 +1154,10 @@ func (_m *Store) ListAllJobs(ctx context.Context) ([]params.Job, error) { func (_m *Store) ListAllPools(ctx context.Context) ([]params.Pool, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ListAllPools") + } + var r0 []params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]params.Pool, error)); ok { @@ -1000,6 +1184,10 @@ func (_m *Store) ListAllPools(ctx context.Context) ([]params.Pool, error) { func (_m *Store) ListEnterpriseInstances(ctx context.Context, enterpriseID string) ([]params.Instance, error) { ret := _m.Called(ctx, enterpriseID) + if len(ret) == 0 { + panic("no return value specified for ListEnterpriseInstances") + } + var r0 []params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]params.Instance, error)); ok { @@ -1026,6 +1214,10 @@ func (_m *Store) ListEnterpriseInstances(ctx context.Context, enterpriseID strin func (_m *Store) ListEnterprisePools(ctx context.Context, enterpriseID string) ([]params.Pool, error) { ret := _m.Called(ctx, enterpriseID) + if len(ret) == 0 { + panic("no return value specified for ListEnterprisePools") + } + var r0 []params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]params.Pool, error)); ok { @@ -1052,6 +1244,10 @@ func (_m *Store) ListEnterprisePools(ctx context.Context, enterpriseID string) ( func (_m *Store) ListEnterprises(ctx context.Context) ([]params.Enterprise, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ListEnterprises") + } + var r0 []params.Enterprise var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]params.Enterprise, error)); ok { @@ -1078,6 +1274,10 @@ func (_m *Store) ListEnterprises(ctx context.Context) ([]params.Enterprise, erro func (_m *Store) ListEntityJobsByStatus(ctx context.Context, entityType params.PoolType, entityID string, status params.JobStatus) ([]params.Job, error) { ret := _m.Called(ctx, entityType, entityID, status) + if len(ret) == 0 { + panic("no return value specified for ListEntityJobsByStatus") + } + var r0 []params.Job var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.PoolType, string, params.JobStatus) ([]params.Job, error)); ok { @@ -1104,6 +1304,10 @@ func (_m *Store) ListEntityJobsByStatus(ctx context.Context, entityType params.P func (_m *Store) ListInstanceEvents(ctx context.Context, instanceID string, eventType params.EventType, eventLevel params.EventLevel) ([]params.StatusMessage, error) { ret := _m.Called(ctx, instanceID, eventType, eventLevel) + if len(ret) == 0 { + panic("no return value specified for ListInstanceEvents") + } + var r0 []params.StatusMessage var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.EventType, params.EventLevel) ([]params.StatusMessage, error)); ok { @@ -1130,6 +1334,10 @@ func (_m *Store) ListInstanceEvents(ctx context.Context, instanceID string, even func (_m *Store) ListJobsByStatus(ctx context.Context, status params.JobStatus) ([]params.Job, error) { ret := _m.Called(ctx, status) + if len(ret) == 0 { + panic("no return value specified for ListJobsByStatus") + } + var r0 []params.Job var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.JobStatus) ([]params.Job, error)); ok { @@ -1156,6 +1364,10 @@ func (_m *Store) ListJobsByStatus(ctx context.Context, status params.JobStatus) func (_m *Store) ListOrgInstances(ctx context.Context, orgID string) ([]params.Instance, error) { ret := _m.Called(ctx, orgID) + if len(ret) == 0 { + panic("no return value specified for ListOrgInstances") + } + var r0 []params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]params.Instance, error)); ok { @@ -1182,6 +1394,10 @@ func (_m *Store) ListOrgInstances(ctx context.Context, orgID string) ([]params.I func (_m *Store) ListOrgPools(ctx context.Context, orgID string) ([]params.Pool, error) { ret := _m.Called(ctx, orgID) + if len(ret) == 0 { + panic("no return value specified for ListOrgPools") + } + var r0 []params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]params.Pool, error)); ok { @@ -1208,6 +1424,10 @@ func (_m *Store) ListOrgPools(ctx context.Context, orgID string) ([]params.Pool, func (_m *Store) ListOrganizations(ctx context.Context) ([]params.Organization, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ListOrganizations") + } + var r0 []params.Organization var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]params.Organization, error)); ok { @@ -1234,6 +1454,10 @@ func (_m *Store) ListOrganizations(ctx context.Context) ([]params.Organization, func (_m *Store) ListPoolInstances(ctx context.Context, poolID string) ([]params.Instance, error) { ret := _m.Called(ctx, poolID) + if len(ret) == 0 { + panic("no return value specified for ListPoolInstances") + } + var r0 []params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]params.Instance, error)); ok { @@ -1260,6 +1484,10 @@ func (_m *Store) ListPoolInstances(ctx context.Context, poolID string) ([]params func (_m *Store) ListRepoInstances(ctx context.Context, repoID string) ([]params.Instance, error) { ret := _m.Called(ctx, repoID) + if len(ret) == 0 { + panic("no return value specified for ListRepoInstances") + } + var r0 []params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]params.Instance, error)); ok { @@ -1286,6 +1514,10 @@ func (_m *Store) ListRepoInstances(ctx context.Context, repoID string) ([]params func (_m *Store) ListRepoPools(ctx context.Context, repoID string) ([]params.Pool, error) { ret := _m.Called(ctx, repoID) + if len(ret) == 0 { + panic("no return value specified for ListRepoPools") + } + var r0 []params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]params.Pool, error)); ok { @@ -1312,6 +1544,10 @@ func (_m *Store) ListRepoPools(ctx context.Context, repoID string) ([]params.Poo func (_m *Store) ListRepositories(ctx context.Context) ([]params.Repository, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ListRepositories") + } + var r0 []params.Repository var r1 error if rf, ok := ret.Get(0).(func(context.Context) ([]params.Repository, error)); ok { @@ -1338,6 +1574,10 @@ func (_m *Store) ListRepositories(ctx context.Context) ([]params.Repository, err func (_m *Store) LockJob(ctx context.Context, jobID int64, entityID string) error { ret := _m.Called(ctx, jobID, entityID) + if len(ret) == 0 { + panic("no return value specified for LockJob") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok { r0 = rf(ctx, jobID, entityID) @@ -1352,6 +1592,10 @@ func (_m *Store) LockJob(ctx context.Context, jobID int64, entityID string) erro func (_m *Store) PoolInstanceCount(ctx context.Context, poolID string) (int64, error) { ret := _m.Called(ctx, poolID) + if len(ret) == 0 { + panic("no return value specified for PoolInstanceCount") + } + var r0 int64 var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (int64, error)); ok { @@ -1376,6 +1620,10 @@ func (_m *Store) PoolInstanceCount(ctx context.Context, poolID string) (int64, e func (_m *Store) UnlockJob(ctx context.Context, jobID int64, entityID string) error { ret := _m.Called(ctx, jobID, entityID) + if len(ret) == 0 { + panic("no return value specified for UnlockJob") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok { r0 = rf(ctx, jobID, entityID) @@ -1390,6 +1638,10 @@ func (_m *Store) UnlockJob(ctx context.Context, jobID int64, entityID string) er func (_m *Store) UpdateEnterprise(ctx context.Context, enterpriseID string, param params.UpdateEntityParams) (params.Enterprise, error) { ret := _m.Called(ctx, enterpriseID, param) + if len(ret) == 0 { + panic("no return value specified for UpdateEnterprise") + } + var r0 params.Enterprise var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.UpdateEntityParams) (params.Enterprise, error)); ok { @@ -1414,6 +1666,10 @@ func (_m *Store) UpdateEnterprise(ctx context.Context, enterpriseID string, para func (_m *Store) UpdateEnterprisePool(ctx context.Context, enterpriseID string, poolID string, param params.UpdatePoolParams) (params.Pool, error) { ret := _m.Called(ctx, enterpriseID, poolID, param) + if len(ret) == 0 { + panic("no return value specified for UpdateEnterprisePool") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, params.UpdatePoolParams) (params.Pool, error)); ok { @@ -1438,6 +1694,10 @@ func (_m *Store) UpdateEnterprisePool(ctx context.Context, enterpriseID string, func (_m *Store) UpdateInstance(ctx context.Context, instanceID string, param params.UpdateInstanceParams) (params.Instance, error) { ret := _m.Called(ctx, instanceID, param) + if len(ret) == 0 { + panic("no return value specified for UpdateInstance") + } + var r0 params.Instance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.UpdateInstanceParams) (params.Instance, error)); ok { @@ -1462,6 +1722,10 @@ func (_m *Store) UpdateInstance(ctx context.Context, instanceID string, param pa func (_m *Store) UpdateOrganization(ctx context.Context, orgID string, param params.UpdateEntityParams) (params.Organization, error) { ret := _m.Called(ctx, orgID, param) + if len(ret) == 0 { + panic("no return value specified for UpdateOrganization") + } + var r0 params.Organization var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.UpdateEntityParams) (params.Organization, error)); ok { @@ -1486,6 +1750,10 @@ func (_m *Store) UpdateOrganization(ctx context.Context, orgID string, param par func (_m *Store) UpdateOrganizationPool(ctx context.Context, orgID string, poolID string, param params.UpdatePoolParams) (params.Pool, error) { ret := _m.Called(ctx, orgID, poolID, param) + if len(ret) == 0 { + panic("no return value specified for UpdateOrganizationPool") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, params.UpdatePoolParams) (params.Pool, error)); ok { @@ -1510,6 +1778,10 @@ func (_m *Store) UpdateOrganizationPool(ctx context.Context, orgID string, poolI func (_m *Store) UpdateRepository(ctx context.Context, repoID string, param params.UpdateEntityParams) (params.Repository, error) { ret := _m.Called(ctx, repoID, param) + if len(ret) == 0 { + panic("no return value specified for UpdateRepository") + } + var r0 params.Repository var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.UpdateEntityParams) (params.Repository, error)); ok { @@ -1534,6 +1806,10 @@ func (_m *Store) UpdateRepository(ctx context.Context, repoID string, param para func (_m *Store) UpdateRepositoryPool(ctx context.Context, repoID string, poolID string, param params.UpdatePoolParams) (params.Pool, error) { ret := _m.Called(ctx, repoID, poolID, param) + if len(ret) == 0 { + panic("no return value specified for UpdateRepositoryPool") + } + var r0 params.Pool var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, params.UpdatePoolParams) (params.Pool, error)); ok { @@ -1558,6 +1834,10 @@ func (_m *Store) UpdateRepositoryPool(ctx context.Context, repoID string, poolID func (_m *Store) UpdateUser(ctx context.Context, user string, param params.UpdateUserParams) (params.User, error) { ret := _m.Called(ctx, user, param) + if len(ret) == 0 { + panic("no return value specified for UpdateUser") + } + var r0 params.User var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, params.UpdateUserParams) (params.User, error)); ok { @@ -1578,13 +1858,12 @@ func (_m *Store) UpdateUser(ctx context.Context, user string, param params.Updat return r0, r1 } -type mockConstructorTestingTNewStore interface { +// NewStore creates a new instance of Store. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewStore(t interface { mock.TestingT Cleanup(func()) -} - -// NewStore creates a new instance of Store. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewStore(t mockConstructorTestingTNewStore) *Store { +}) *Store { mock := &Store{} mock.Mock.Test(t) diff --git a/runner/common/mocks/GithubClient.go b/runner/common/mocks/GithubClient.go index 49b37a47..4ba2c2fa 100644 --- a/runner/common/mocks/GithubClient.go +++ b/runner/common/mocks/GithubClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.1. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type GithubClient struct { func (_m *GithubClient) CreateOrgHook(ctx context.Context, org string, hook *github.Hook) (*github.Hook, *github.Response, error) { ret := _m.Called(ctx, org, hook) + if len(ret) == 0 { + panic("no return value specified for CreateOrgHook") + } + var r0 *github.Hook var r1 *github.Response var r2 error @@ -53,6 +57,10 @@ func (_m *GithubClient) CreateOrgHook(ctx context.Context, org string, hook *git func (_m *GithubClient) CreateOrganizationRegistrationToken(ctx context.Context, owner string) (*github.RegistrationToken, *github.Response, error) { ret := _m.Called(ctx, owner) + if len(ret) == 0 { + panic("no return value specified for CreateOrganizationRegistrationToken") + } + var r0 *github.RegistrationToken var r1 *github.Response var r2 error @@ -88,6 +96,10 @@ func (_m *GithubClient) CreateOrganizationRegistrationToken(ctx context.Context, func (_m *GithubClient) CreateRegistrationToken(ctx context.Context, owner string, repo string) (*github.RegistrationToken, *github.Response, error) { ret := _m.Called(ctx, owner, repo) + if len(ret) == 0 { + panic("no return value specified for CreateRegistrationToken") + } + var r0 *github.RegistrationToken var r1 *github.Response var r2 error @@ -123,6 +135,10 @@ func (_m *GithubClient) CreateRegistrationToken(ctx context.Context, owner strin func (_m *GithubClient) CreateRepoHook(ctx context.Context, owner string, repo string, hook *github.Hook) (*github.Hook, *github.Response, error) { ret := _m.Called(ctx, owner, repo, hook) + if len(ret) == 0 { + panic("no return value specified for CreateRepoHook") + } + var r0 *github.Hook var r1 *github.Response var r2 error @@ -158,6 +174,10 @@ func (_m *GithubClient) CreateRepoHook(ctx context.Context, owner string, repo s func (_m *GithubClient) DeleteOrgHook(ctx context.Context, org string, id int64) (*github.Response, error) { ret := _m.Called(ctx, org, id) + if len(ret) == 0 { + panic("no return value specified for DeleteOrgHook") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, int64) (*github.Response, error)); ok { @@ -184,6 +204,10 @@ func (_m *GithubClient) DeleteOrgHook(ctx context.Context, org string, id int64) func (_m *GithubClient) DeleteRepoHook(ctx context.Context, owner string, repo string, id int64) (*github.Response, error) { ret := _m.Called(ctx, owner, repo, id) + if len(ret) == 0 { + panic("no return value specified for DeleteRepoHook") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) (*github.Response, error)); ok { @@ -210,6 +234,10 @@ func (_m *GithubClient) DeleteRepoHook(ctx context.Context, owner string, repo s func (_m *GithubClient) GenerateOrgJITConfig(ctx context.Context, owner string, request *github.GenerateJITConfigRequest) (*github.JITRunnerConfig, *github.Response, error) { ret := _m.Called(ctx, owner, request) + if len(ret) == 0 { + panic("no return value specified for GenerateOrgJITConfig") + } + var r0 *github.JITRunnerConfig var r1 *github.Response var r2 error @@ -245,6 +273,10 @@ func (_m *GithubClient) GenerateOrgJITConfig(ctx context.Context, owner string, func (_m *GithubClient) GenerateRepoJITConfig(ctx context.Context, owner string, repo string, request *github.GenerateJITConfigRequest) (*github.JITRunnerConfig, *github.Response, error) { ret := _m.Called(ctx, owner, repo, request) + if len(ret) == 0 { + panic("no return value specified for GenerateRepoJITConfig") + } + var r0 *github.JITRunnerConfig var r1 *github.Response var r2 error @@ -280,6 +312,10 @@ func (_m *GithubClient) GenerateRepoJITConfig(ctx context.Context, owner string, func (_m *GithubClient) GetOrgHook(ctx context.Context, org string, id int64) (*github.Hook, *github.Response, error) { ret := _m.Called(ctx, org, id) + if len(ret) == 0 { + panic("no return value specified for GetOrgHook") + } + var r0 *github.Hook var r1 *github.Response var r2 error @@ -315,6 +351,10 @@ func (_m *GithubClient) GetOrgHook(ctx context.Context, org string, id int64) (* func (_m *GithubClient) GetRepoHook(ctx context.Context, owner string, repo string, id int64) (*github.Hook, *github.Response, error) { ret := _m.Called(ctx, owner, repo, id) + if len(ret) == 0 { + panic("no return value specified for GetRepoHook") + } + var r0 *github.Hook var r1 *github.Response var r2 error @@ -350,6 +390,10 @@ func (_m *GithubClient) GetRepoHook(ctx context.Context, owner string, repo stri func (_m *GithubClient) GetWorkflowJobByID(ctx context.Context, owner string, repo string, jobID int64) (*github.WorkflowJob, *github.Response, error) { ret := _m.Called(ctx, owner, repo, jobID) + if len(ret) == 0 { + panic("no return value specified for GetWorkflowJobByID") + } + var r0 *github.WorkflowJob var r1 *github.Response var r2 error @@ -385,6 +429,10 @@ func (_m *GithubClient) GetWorkflowJobByID(ctx context.Context, owner string, re func (_m *GithubClient) ListOrgHooks(ctx context.Context, org string, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { ret := _m.Called(ctx, org, opts) + if len(ret) == 0 { + panic("no return value specified for ListOrgHooks") + } + var r0 []*github.Hook var r1 *github.Response var r2 error @@ -420,6 +468,10 @@ func (_m *GithubClient) ListOrgHooks(ctx context.Context, org string, opts *gith func (_m *GithubClient) ListOrganizationRunnerApplicationDownloads(ctx context.Context, owner string) ([]*github.RunnerApplicationDownload, *github.Response, error) { ret := _m.Called(ctx, owner) + if len(ret) == 0 { + panic("no return value specified for ListOrganizationRunnerApplicationDownloads") + } + var r0 []*github.RunnerApplicationDownload var r1 *github.Response var r2 error @@ -455,6 +507,10 @@ func (_m *GithubClient) ListOrganizationRunnerApplicationDownloads(ctx context.C func (_m *GithubClient) ListOrganizationRunnerGroups(ctx context.Context, org string, opts *github.ListOrgRunnerGroupOptions) (*github.RunnerGroups, *github.Response, error) { ret := _m.Called(ctx, org, opts) + if len(ret) == 0 { + panic("no return value specified for ListOrganizationRunnerGroups") + } + var r0 *github.RunnerGroups var r1 *github.Response var r2 error @@ -490,6 +546,10 @@ func (_m *GithubClient) ListOrganizationRunnerGroups(ctx context.Context, org st func (_m *GithubClient) ListOrganizationRunners(ctx context.Context, owner string, opts *github.ListOptions) (*github.Runners, *github.Response, error) { ret := _m.Called(ctx, owner, opts) + if len(ret) == 0 { + panic("no return value specified for ListOrganizationRunners") + } + var r0 *github.Runners var r1 *github.Response var r2 error @@ -525,6 +585,10 @@ func (_m *GithubClient) ListOrganizationRunners(ctx context.Context, owner strin func (_m *GithubClient) ListRepoHooks(ctx context.Context, owner string, repo string, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { ret := _m.Called(ctx, owner, repo, opts) + if len(ret) == 0 { + panic("no return value specified for ListRepoHooks") + } + var r0 []*github.Hook var r1 *github.Response var r2 error @@ -560,6 +624,10 @@ func (_m *GithubClient) ListRepoHooks(ctx context.Context, owner string, repo st func (_m *GithubClient) ListRunnerApplicationDownloads(ctx context.Context, owner string, repo string) ([]*github.RunnerApplicationDownload, *github.Response, error) { ret := _m.Called(ctx, owner, repo) + if len(ret) == 0 { + panic("no return value specified for ListRunnerApplicationDownloads") + } + var r0 []*github.RunnerApplicationDownload var r1 *github.Response var r2 error @@ -595,6 +663,10 @@ func (_m *GithubClient) ListRunnerApplicationDownloads(ctx context.Context, owne func (_m *GithubClient) ListRunners(ctx context.Context, owner string, repo string, opts *github.ListOptions) (*github.Runners, *github.Response, error) { ret := _m.Called(ctx, owner, repo, opts) + if len(ret) == 0 { + panic("no return value specified for ListRunners") + } + var r0 *github.Runners var r1 *github.Response var r2 error @@ -630,6 +702,10 @@ func (_m *GithubClient) ListRunners(ctx context.Context, owner string, repo stri func (_m *GithubClient) PingOrgHook(ctx context.Context, org string, id int64) (*github.Response, error) { ret := _m.Called(ctx, org, id) + if len(ret) == 0 { + panic("no return value specified for PingOrgHook") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, int64) (*github.Response, error)); ok { @@ -656,6 +732,10 @@ func (_m *GithubClient) PingOrgHook(ctx context.Context, org string, id int64) ( func (_m *GithubClient) PingRepoHook(ctx context.Context, owner string, repo string, id int64) (*github.Response, error) { ret := _m.Called(ctx, owner, repo, id) + if len(ret) == 0 { + panic("no return value specified for PingRepoHook") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) (*github.Response, error)); ok { @@ -682,6 +762,10 @@ func (_m *GithubClient) PingRepoHook(ctx context.Context, owner string, repo str func (_m *GithubClient) RemoveOrganizationRunner(ctx context.Context, owner string, runnerID int64) (*github.Response, error) { ret := _m.Called(ctx, owner, runnerID) + if len(ret) == 0 { + panic("no return value specified for RemoveOrganizationRunner") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, int64) (*github.Response, error)); ok { @@ -708,6 +792,10 @@ func (_m *GithubClient) RemoveOrganizationRunner(ctx context.Context, owner stri func (_m *GithubClient) RemoveRunner(ctx context.Context, owner string, repo string, runnerID int64) (*github.Response, error) { ret := _m.Called(ctx, owner, repo, runnerID) + if len(ret) == 0 { + panic("no return value specified for RemoveRunner") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) (*github.Response, error)); ok { @@ -730,13 +818,12 @@ func (_m *GithubClient) RemoveRunner(ctx context.Context, owner string, repo str return r0, r1 } -type mockConstructorTestingTNewGithubClient interface { +// NewGithubClient creates a new instance of GithubClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewGithubClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewGithubClient creates a new instance of GithubClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewGithubClient(t mockConstructorTestingTNewGithubClient) *GithubClient { +}) *GithubClient { mock := &GithubClient{} mock.Mock.Test(t) diff --git a/runner/common/mocks/GithubEnterpriseClient.go b/runner/common/mocks/GithubEnterpriseClient.go index f42a10da..36b6517d 100644 --- a/runner/common/mocks/GithubEnterpriseClient.go +++ b/runner/common/mocks/GithubEnterpriseClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.1. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type GithubEnterpriseClient struct { func (_m *GithubEnterpriseClient) CreateRegistrationToken(ctx context.Context, enterprise string) (*github.RegistrationToken, *github.Response, error) { ret := _m.Called(ctx, enterprise) + if len(ret) == 0 { + panic("no return value specified for CreateRegistrationToken") + } + var r0 *github.RegistrationToken var r1 *github.Response var r2 error @@ -53,6 +57,10 @@ func (_m *GithubEnterpriseClient) CreateRegistrationToken(ctx context.Context, e func (_m *GithubEnterpriseClient) GenerateEnterpriseJITConfig(ctx context.Context, enterprise string, request *github.GenerateJITConfigRequest) (*github.JITRunnerConfig, *github.Response, error) { ret := _m.Called(ctx, enterprise, request) + if len(ret) == 0 { + panic("no return value specified for GenerateEnterpriseJITConfig") + } + var r0 *github.JITRunnerConfig var r1 *github.Response var r2 error @@ -88,6 +96,10 @@ func (_m *GithubEnterpriseClient) GenerateEnterpriseJITConfig(ctx context.Contex func (_m *GithubEnterpriseClient) ListRunnerApplicationDownloads(ctx context.Context, enterprise string) ([]*github.RunnerApplicationDownload, *github.Response, error) { ret := _m.Called(ctx, enterprise) + if len(ret) == 0 { + panic("no return value specified for ListRunnerApplicationDownloads") + } + var r0 []*github.RunnerApplicationDownload var r1 *github.Response var r2 error @@ -123,6 +135,10 @@ func (_m *GithubEnterpriseClient) ListRunnerApplicationDownloads(ctx context.Con func (_m *GithubEnterpriseClient) ListRunnerGroups(ctx context.Context, enterprise string, opts *github.ListEnterpriseRunnerGroupOptions) (*github.EnterpriseRunnerGroups, *github.Response, error) { ret := _m.Called(ctx, enterprise, opts) + if len(ret) == 0 { + panic("no return value specified for ListRunnerGroups") + } + var r0 *github.EnterpriseRunnerGroups var r1 *github.Response var r2 error @@ -158,6 +174,10 @@ func (_m *GithubEnterpriseClient) ListRunnerGroups(ctx context.Context, enterpri func (_m *GithubEnterpriseClient) ListRunners(ctx context.Context, enterprise string, opts *github.ListOptions) (*github.Runners, *github.Response, error) { ret := _m.Called(ctx, enterprise, opts) + if len(ret) == 0 { + panic("no return value specified for ListRunners") + } + var r0 *github.Runners var r1 *github.Response var r2 error @@ -193,6 +213,10 @@ func (_m *GithubEnterpriseClient) ListRunners(ctx context.Context, enterprise st func (_m *GithubEnterpriseClient) RemoveRunner(ctx context.Context, enterprise string, runnerID int64) (*github.Response, error) { ret := _m.Called(ctx, enterprise, runnerID) + if len(ret) == 0 { + panic("no return value specified for RemoveRunner") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, int64) (*github.Response, error)); ok { @@ -215,13 +239,12 @@ func (_m *GithubEnterpriseClient) RemoveRunner(ctx context.Context, enterprise s return r0, r1 } -type mockConstructorTestingTNewGithubEnterpriseClient interface { +// NewGithubEnterpriseClient creates a new instance of GithubEnterpriseClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewGithubEnterpriseClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewGithubEnterpriseClient creates a new instance of GithubEnterpriseClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewGithubEnterpriseClient(t mockConstructorTestingTNewGithubEnterpriseClient) *GithubEnterpriseClient { +}) *GithubEnterpriseClient { mock := &GithubEnterpriseClient{} mock.Mock.Test(t) diff --git a/runner/common/mocks/OrganizationHooks.go b/runner/common/mocks/OrganizationHooks.go index 362e06ff..67d17a30 100644 --- a/runner/common/mocks/OrganizationHooks.go +++ b/runner/common/mocks/OrganizationHooks.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.1. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type OrganizationHooks struct { func (_m *OrganizationHooks) CreateOrgHook(ctx context.Context, org string, hook *github.Hook) (*github.Hook, *github.Response, error) { ret := _m.Called(ctx, org, hook) + if len(ret) == 0 { + panic("no return value specified for CreateOrgHook") + } + var r0 *github.Hook var r1 *github.Response var r2 error @@ -53,6 +57,10 @@ func (_m *OrganizationHooks) CreateOrgHook(ctx context.Context, org string, hook func (_m *OrganizationHooks) DeleteOrgHook(ctx context.Context, org string, id int64) (*github.Response, error) { ret := _m.Called(ctx, org, id) + if len(ret) == 0 { + panic("no return value specified for DeleteOrgHook") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, int64) (*github.Response, error)); ok { @@ -79,6 +87,10 @@ func (_m *OrganizationHooks) DeleteOrgHook(ctx context.Context, org string, id i func (_m *OrganizationHooks) GetOrgHook(ctx context.Context, org string, id int64) (*github.Hook, *github.Response, error) { ret := _m.Called(ctx, org, id) + if len(ret) == 0 { + panic("no return value specified for GetOrgHook") + } + var r0 *github.Hook var r1 *github.Response var r2 error @@ -114,6 +126,10 @@ func (_m *OrganizationHooks) GetOrgHook(ctx context.Context, org string, id int6 func (_m *OrganizationHooks) ListOrgHooks(ctx context.Context, org string, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { ret := _m.Called(ctx, org, opts) + if len(ret) == 0 { + panic("no return value specified for ListOrgHooks") + } + var r0 []*github.Hook var r1 *github.Response var r2 error @@ -149,6 +165,10 @@ func (_m *OrganizationHooks) ListOrgHooks(ctx context.Context, org string, opts func (_m *OrganizationHooks) PingOrgHook(ctx context.Context, org string, id int64) (*github.Response, error) { ret := _m.Called(ctx, org, id) + if len(ret) == 0 { + panic("no return value specified for PingOrgHook") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, int64) (*github.Response, error)); ok { @@ -171,13 +191,12 @@ func (_m *OrganizationHooks) PingOrgHook(ctx context.Context, org string, id int return r0, r1 } -type mockConstructorTestingTNewOrganizationHooks interface { +// NewOrganizationHooks creates a new instance of OrganizationHooks. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewOrganizationHooks(t interface { mock.TestingT Cleanup(func()) -} - -// NewOrganizationHooks creates a new instance of OrganizationHooks. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewOrganizationHooks(t mockConstructorTestingTNewOrganizationHooks) *OrganizationHooks { +}) *OrganizationHooks { mock := &OrganizationHooks{} mock.Mock.Test(t) diff --git a/runner/common/mocks/PoolManager.go b/runner/common/mocks/PoolManager.go index 9ff34758..57f65861 100644 --- a/runner/common/mocks/PoolManager.go +++ b/runner/common/mocks/PoolManager.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.1. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -14,27 +14,17 @@ type PoolManager struct { mock.Mock } -// DeleteRunner provides a mock function with given fields: runner, forceRemove -func (_m *PoolManager) DeleteRunner(runner params.Instance, forceRemove bool) error { - ret := _m.Called(runner, forceRemove) +// DeleteRunner provides a mock function with given fields: runner, forceRemove, bypassGHUnauthorizedError +func (_m *PoolManager) DeleteRunner(runner params.Instance, forceRemove bool, bypassGHUnauthorizedError bool) error { + ret := _m.Called(runner, forceRemove, bypassGHUnauthorizedError) - var r0 error - if rf, ok := ret.Get(0).(func(params.Instance, bool) error); ok { - r0 = rf(runner, forceRemove) - } else { - r0 = ret.Error(0) + if len(ret) == 0 { + panic("no return value specified for DeleteRunner") } - return r0 -} - -// ForceDeleteRunner provides a mock function with given fields: runner -func (_m *PoolManager) ForceDeleteRunner(runner params.Instance) error { - ret := _m.Called(runner) - var r0 error - if rf, ok := ret.Get(0).(func(params.Instance) error); ok { - r0 = rf(runner) + if rf, ok := ret.Get(0).(func(params.Instance, bool, bool) error); ok { + r0 = rf(runner, forceRemove, bypassGHUnauthorizedError) } else { r0 = ret.Error(0) } @@ -46,6 +36,10 @@ func (_m *PoolManager) ForceDeleteRunner(runner params.Instance) error { func (_m *PoolManager) GetWebhookInfo(ctx context.Context) (params.HookInfo, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetWebhookInfo") + } + var r0 params.HookInfo var r1 error if rf, ok := ret.Get(0).(func(context.Context) (params.HookInfo, error)); ok { @@ -70,6 +64,10 @@ func (_m *PoolManager) GetWebhookInfo(ctx context.Context) (params.HookInfo, err func (_m *PoolManager) GithubRunnerRegistrationToken() (string, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GithubRunnerRegistrationToken") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func() (string, error)); ok { @@ -94,6 +92,10 @@ func (_m *PoolManager) GithubRunnerRegistrationToken() (string, error) { func (_m *PoolManager) HandleWorkflowJob(job params.WorkflowJob) error { ret := _m.Called(job) + if len(ret) == 0 { + panic("no return value specified for HandleWorkflowJob") + } + var r0 error if rf, ok := ret.Get(0).(func(params.WorkflowJob) error); ok { r0 = rf(job) @@ -108,6 +110,10 @@ func (_m *PoolManager) HandleWorkflowJob(job params.WorkflowJob) error { func (_m *PoolManager) ID() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ID") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -122,6 +128,10 @@ func (_m *PoolManager) ID() string { func (_m *PoolManager) InstallWebhook(ctx context.Context, param params.InstallWebhookParams) (params.HookInfo, error) { ret := _m.Called(ctx, param) + if len(ret) == 0 { + panic("no return value specified for InstallWebhook") + } + var r0 params.HookInfo var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.InstallWebhookParams) (params.HookInfo, error)); ok { @@ -146,6 +156,10 @@ func (_m *PoolManager) InstallWebhook(ctx context.Context, param params.InstallW func (_m *PoolManager) RefreshState(param params.UpdatePoolStateParams) error { ret := _m.Called(param) + if len(ret) == 0 { + panic("no return value specified for RefreshState") + } + var r0 error if rf, ok := ret.Get(0).(func(params.UpdatePoolStateParams) error); ok { r0 = rf(param) @@ -160,6 +174,10 @@ func (_m *PoolManager) RefreshState(param params.UpdatePoolStateParams) error { func (_m *PoolManager) RootCABundle() (params.CertificateBundle, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for RootCABundle") + } + var r0 params.CertificateBundle var r1 error if rf, ok := ret.Get(0).(func() (params.CertificateBundle, error)); ok { @@ -184,6 +202,10 @@ func (_m *PoolManager) RootCABundle() (params.CertificateBundle, error) { func (_m *PoolManager) Start() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Start") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -198,6 +220,10 @@ func (_m *PoolManager) Start() error { func (_m *PoolManager) Status() params.PoolManagerStatus { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Status") + } + var r0 params.PoolManagerStatus if rf, ok := ret.Get(0).(func() params.PoolManagerStatus); ok { r0 = rf() @@ -212,6 +238,10 @@ func (_m *PoolManager) Status() params.PoolManagerStatus { func (_m *PoolManager) Stop() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Stop") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -226,6 +256,10 @@ func (_m *PoolManager) Stop() error { func (_m *PoolManager) UninstallWebhook(ctx context.Context) error { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for UninstallWebhook") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context) error); ok { r0 = rf(ctx) @@ -240,6 +274,10 @@ func (_m *PoolManager) UninstallWebhook(ctx context.Context) error { func (_m *PoolManager) Wait() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Wait") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -254,6 +292,10 @@ func (_m *PoolManager) Wait() error { func (_m *PoolManager) WebhookSecret() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WebhookSecret") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -264,13 +306,12 @@ func (_m *PoolManager) WebhookSecret() string { return r0 } -type mockConstructorTestingTNewPoolManager interface { +// NewPoolManager creates a new instance of PoolManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPoolManager(t interface { mock.TestingT Cleanup(func()) -} - -// NewPoolManager creates a new instance of PoolManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewPoolManager(t mockConstructorTestingTNewPoolManager) *PoolManager { +}) *PoolManager { mock := &PoolManager{} mock.Mock.Test(t) diff --git a/runner/common/mocks/Provider.go b/runner/common/mocks/Provider.go index 7865995b..1390d972 100644 --- a/runner/common/mocks/Provider.go +++ b/runner/common/mocks/Provider.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.1. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -20,6 +20,10 @@ type Provider struct { func (_m *Provider) AsParams() params.Provider { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for AsParams") + } + var r0 params.Provider if rf, ok := ret.Get(0).(func() params.Provider); ok { r0 = rf() @@ -34,6 +38,10 @@ func (_m *Provider) AsParams() params.Provider { func (_m *Provider) CreateInstance(ctx context.Context, bootstrapParams garm_provider_commonparams.BootstrapInstance) (garm_provider_commonparams.ProviderInstance, error) { ret := _m.Called(ctx, bootstrapParams) + if len(ret) == 0 { + panic("no return value specified for CreateInstance") + } + var r0 garm_provider_commonparams.ProviderInstance var r1 error if rf, ok := ret.Get(0).(func(context.Context, garm_provider_commonparams.BootstrapInstance) (garm_provider_commonparams.ProviderInstance, error)); ok { @@ -58,6 +66,10 @@ func (_m *Provider) CreateInstance(ctx context.Context, bootstrapParams garm_pro func (_m *Provider) DeleteInstance(ctx context.Context, instance string) error { ret := _m.Called(ctx, instance) + if len(ret) == 0 { + panic("no return value specified for DeleteInstance") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, instance) @@ -72,6 +84,10 @@ func (_m *Provider) DeleteInstance(ctx context.Context, instance string) error { func (_m *Provider) DisableJITConfig() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DisableJITConfig") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -86,6 +102,10 @@ func (_m *Provider) DisableJITConfig() bool { func (_m *Provider) GetInstance(ctx context.Context, instance string) (garm_provider_commonparams.ProviderInstance, error) { ret := _m.Called(ctx, instance) + if len(ret) == 0 { + panic("no return value specified for GetInstance") + } + var r0 garm_provider_commonparams.ProviderInstance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) (garm_provider_commonparams.ProviderInstance, error)); ok { @@ -110,6 +130,10 @@ func (_m *Provider) GetInstance(ctx context.Context, instance string) (garm_prov func (_m *Provider) ListInstances(ctx context.Context, poolID string) ([]garm_provider_commonparams.ProviderInstance, error) { ret := _m.Called(ctx, poolID) + if len(ret) == 0 { + panic("no return value specified for ListInstances") + } + var r0 []garm_provider_commonparams.ProviderInstance var r1 error if rf, ok := ret.Get(0).(func(context.Context, string) ([]garm_provider_commonparams.ProviderInstance, error)); ok { @@ -136,6 +160,10 @@ func (_m *Provider) ListInstances(ctx context.Context, poolID string) ([]garm_pr func (_m *Provider) RemoveAllInstances(ctx context.Context) error { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for RemoveAllInstances") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context) error); ok { r0 = rf(ctx) @@ -150,6 +178,10 @@ func (_m *Provider) RemoveAllInstances(ctx context.Context) error { func (_m *Provider) Start(ctx context.Context, instance string) error { ret := _m.Called(ctx, instance) + if len(ret) == 0 { + panic("no return value specified for Start") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, instance) @@ -160,10 +192,14 @@ func (_m *Provider) Start(ctx context.Context, instance string) error { return r0 } -// Stop provides a mock function with given fields: ctx, instance, force +// Stop provides a mock function with given fields: ctx, instance func (_m *Provider) Stop(ctx context.Context, instance string) error { ret := _m.Called(ctx, instance) + if len(ret) == 0 { + panic("no return value specified for Stop") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { r0 = rf(ctx, instance) @@ -174,13 +210,12 @@ func (_m *Provider) Stop(ctx context.Context, instance string) error { return r0 } -type mockConstructorTestingTNewProvider interface { +// NewProvider creates a new instance of Provider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewProvider(t interface { mock.TestingT Cleanup(func()) -} - -// NewProvider creates a new instance of Provider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewProvider(t mockConstructorTestingTNewProvider) *Provider { +}) *Provider { mock := &Provider{} mock.Mock.Test(t) diff --git a/runner/common/mocks/RepositoryHooks.go b/runner/common/mocks/RepositoryHooks.go index 96473122..72b7831a 100644 --- a/runner/common/mocks/RepositoryHooks.go +++ b/runner/common/mocks/RepositoryHooks.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.1. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type RepositoryHooks struct { func (_m *RepositoryHooks) CreateRepoHook(ctx context.Context, owner string, repo string, hook *github.Hook) (*github.Hook, *github.Response, error) { ret := _m.Called(ctx, owner, repo, hook) + if len(ret) == 0 { + panic("no return value specified for CreateRepoHook") + } + var r0 *github.Hook var r1 *github.Response var r2 error @@ -53,6 +57,10 @@ func (_m *RepositoryHooks) CreateRepoHook(ctx context.Context, owner string, rep func (_m *RepositoryHooks) DeleteRepoHook(ctx context.Context, owner string, repo string, id int64) (*github.Response, error) { ret := _m.Called(ctx, owner, repo, id) + if len(ret) == 0 { + panic("no return value specified for DeleteRepoHook") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) (*github.Response, error)); ok { @@ -79,6 +87,10 @@ func (_m *RepositoryHooks) DeleteRepoHook(ctx context.Context, owner string, rep func (_m *RepositoryHooks) GetRepoHook(ctx context.Context, owner string, repo string, id int64) (*github.Hook, *github.Response, error) { ret := _m.Called(ctx, owner, repo, id) + if len(ret) == 0 { + panic("no return value specified for GetRepoHook") + } + var r0 *github.Hook var r1 *github.Response var r2 error @@ -114,6 +126,10 @@ func (_m *RepositoryHooks) GetRepoHook(ctx context.Context, owner string, repo s func (_m *RepositoryHooks) ListRepoHooks(ctx context.Context, owner string, repo string, opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { ret := _m.Called(ctx, owner, repo, opts) + if len(ret) == 0 { + panic("no return value specified for ListRepoHooks") + } + var r0 []*github.Hook var r1 *github.Response var r2 error @@ -149,6 +165,10 @@ func (_m *RepositoryHooks) ListRepoHooks(ctx context.Context, owner string, repo func (_m *RepositoryHooks) PingRepoHook(ctx context.Context, owner string, repo string, id int64) (*github.Response, error) { ret := _m.Called(ctx, owner, repo, id) + if len(ret) == 0 { + panic("no return value specified for PingRepoHook") + } + var r0 *github.Response var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) (*github.Response, error)); ok { @@ -171,13 +191,12 @@ func (_m *RepositoryHooks) PingRepoHook(ctx context.Context, owner string, repo return r0, r1 } -type mockConstructorTestingTNewRepositoryHooks interface { +// NewRepositoryHooks creates a new instance of RepositoryHooks. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewRepositoryHooks(t interface { mock.TestingT Cleanup(func()) -} - -// NewRepositoryHooks creates a new instance of RepositoryHooks. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewRepositoryHooks(t mockConstructorTestingTNewRepositoryHooks) *RepositoryHooks { +}) *RepositoryHooks { mock := &RepositoryHooks{} mock.Mock.Test(t) diff --git a/runner/common/pool.go b/runner/common/pool.go index 92696291..fe833826 100644 --- a/runner/common/pool.go +++ b/runner/common/pool.go @@ -55,17 +55,13 @@ type PoolManager interface { HandleWorkflowJob(job params.WorkflowJob) error // RefreshState allows us to update webhook secrets and configuration for a pool manager. RefreshState(param params.UpdatePoolStateParams) error - // ForceDeleteRunner will attempt to remove a runner from the pool. - // - // Deprecated: FunctionName is deprecated. Use DeleteRunner instead. - ForceDeleteRunner(runner params.Instance) error // DeleteRunner will attempt to remove a runner from the pool. If forceRemove is true, any error // received from the provider will be ignored and we will proceed to remove the runner from the database. // An error received while attempting to remove from GitHub (other than 404) will still stop the deletion // process. This can happen if the runner is already processing a job. At which point, you can simply cancel // the job in github. Doing so will prompt GARM to reap the runner automatically. - DeleteRunner(runner params.Instance, forceRemove bool) error + DeleteRunner(runner params.Instance, forceRemove, bypassGHUnauthorizedError bool) error // InstallWebhook will create a webhook in github for the entity associated with this pool manager. InstallWebhook(ctx context.Context, param params.InstallWebhookParams) (params.HookInfo, error) diff --git a/runner/mocks/PoolManagerController.go b/runner/mocks/PoolManagerController.go index 6806623a..2fa40b8e 100644 --- a/runner/mocks/PoolManagerController.go +++ b/runner/mocks/PoolManagerController.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.28.1. DO NOT EDIT. +// Code generated by mockery v2.42.0. DO NOT EDIT. package mocks @@ -23,6 +23,10 @@ type PoolManagerController struct { func (_m *PoolManagerController) CreateEnterprisePoolManager(ctx context.Context, enterprise params.Enterprise, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) { ret := _m.Called(ctx, enterprise, providers, store) + if len(ret) == 0 { + panic("no return value specified for CreateEnterprisePoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.Enterprise, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)); ok { @@ -49,6 +53,10 @@ func (_m *PoolManagerController) CreateEnterprisePoolManager(ctx context.Context func (_m *PoolManagerController) CreateOrgPoolManager(ctx context.Context, org params.Organization, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) { ret := _m.Called(ctx, org, providers, store) + if len(ret) == 0 { + panic("no return value specified for CreateOrgPoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.Organization, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)); ok { @@ -75,6 +83,10 @@ func (_m *PoolManagerController) CreateOrgPoolManager(ctx context.Context, org p func (_m *PoolManagerController) CreateRepoPoolManager(ctx context.Context, repo params.Repository, providers map[string]common.Provider, store databasecommon.Store) (common.PoolManager, error) { ret := _m.Called(ctx, repo, providers, store) + if len(ret) == 0 { + panic("no return value specified for CreateRepoPoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.Repository, map[string]common.Provider, databasecommon.Store) (common.PoolManager, error)); ok { @@ -101,6 +113,10 @@ func (_m *PoolManagerController) CreateRepoPoolManager(ctx context.Context, repo func (_m *PoolManagerController) DeleteEnterprisePoolManager(enterprise params.Enterprise) error { ret := _m.Called(enterprise) + if len(ret) == 0 { + panic("no return value specified for DeleteEnterprisePoolManager") + } + var r0 error if rf, ok := ret.Get(0).(func(params.Enterprise) error); ok { r0 = rf(enterprise) @@ -115,6 +131,10 @@ func (_m *PoolManagerController) DeleteEnterprisePoolManager(enterprise params.E func (_m *PoolManagerController) DeleteOrgPoolManager(org params.Organization) error { ret := _m.Called(org) + if len(ret) == 0 { + panic("no return value specified for DeleteOrgPoolManager") + } + var r0 error if rf, ok := ret.Get(0).(func(params.Organization) error); ok { r0 = rf(org) @@ -129,6 +149,10 @@ func (_m *PoolManagerController) DeleteOrgPoolManager(org params.Organization) e func (_m *PoolManagerController) DeleteRepoPoolManager(repo params.Repository) error { ret := _m.Called(repo) + if len(ret) == 0 { + panic("no return value specified for DeleteRepoPoolManager") + } + var r0 error if rf, ok := ret.Get(0).(func(params.Repository) error); ok { r0 = rf(repo) @@ -143,6 +167,10 @@ func (_m *PoolManagerController) DeleteRepoPoolManager(repo params.Repository) e func (_m *PoolManagerController) GetEnterprisePoolManager(enterprise params.Enterprise) (common.PoolManager, error) { ret := _m.Called(enterprise) + if len(ret) == 0 { + panic("no return value specified for GetEnterprisePoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(params.Enterprise) (common.PoolManager, error)); ok { @@ -169,6 +197,10 @@ func (_m *PoolManagerController) GetEnterprisePoolManager(enterprise params.Ente func (_m *PoolManagerController) GetEnterprisePoolManagers() (map[string]common.PoolManager, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetEnterprisePoolManagers") + } + var r0 map[string]common.PoolManager var r1 error if rf, ok := ret.Get(0).(func() (map[string]common.PoolManager, error)); ok { @@ -195,6 +227,10 @@ func (_m *PoolManagerController) GetEnterprisePoolManagers() (map[string]common. func (_m *PoolManagerController) GetOrgPoolManager(org params.Organization) (common.PoolManager, error) { ret := _m.Called(org) + if len(ret) == 0 { + panic("no return value specified for GetOrgPoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(params.Organization) (common.PoolManager, error)); ok { @@ -221,6 +257,10 @@ func (_m *PoolManagerController) GetOrgPoolManager(org params.Organization) (com func (_m *PoolManagerController) GetOrgPoolManagers() (map[string]common.PoolManager, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetOrgPoolManagers") + } + var r0 map[string]common.PoolManager var r1 error if rf, ok := ret.Get(0).(func() (map[string]common.PoolManager, error)); ok { @@ -247,6 +287,10 @@ func (_m *PoolManagerController) GetOrgPoolManagers() (map[string]common.PoolMan func (_m *PoolManagerController) GetRepoPoolManager(repo params.Repository) (common.PoolManager, error) { ret := _m.Called(repo) + if len(ret) == 0 { + panic("no return value specified for GetRepoPoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(params.Repository) (common.PoolManager, error)); ok { @@ -273,6 +317,10 @@ func (_m *PoolManagerController) GetRepoPoolManager(repo params.Repository) (com func (_m *PoolManagerController) GetRepoPoolManagers() (map[string]common.PoolManager, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetRepoPoolManagers") + } + var r0 map[string]common.PoolManager var r1 error if rf, ok := ret.Get(0).(func() (map[string]common.PoolManager, error)); ok { @@ -299,6 +347,10 @@ func (_m *PoolManagerController) GetRepoPoolManagers() (map[string]common.PoolMa func (_m *PoolManagerController) UpdateEnterprisePoolManager(ctx context.Context, enterprise params.Enterprise) (common.PoolManager, error) { ret := _m.Called(ctx, enterprise) + if len(ret) == 0 { + panic("no return value specified for UpdateEnterprisePoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.Enterprise) (common.PoolManager, error)); ok { @@ -325,6 +377,10 @@ func (_m *PoolManagerController) UpdateEnterprisePoolManager(ctx context.Context func (_m *PoolManagerController) UpdateOrgPoolManager(ctx context.Context, org params.Organization) (common.PoolManager, error) { ret := _m.Called(ctx, org) + if len(ret) == 0 { + panic("no return value specified for UpdateOrgPoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.Organization) (common.PoolManager, error)); ok { @@ -351,6 +407,10 @@ func (_m *PoolManagerController) UpdateOrgPoolManager(ctx context.Context, org p func (_m *PoolManagerController) UpdateRepoPoolManager(ctx context.Context, repo params.Repository) (common.PoolManager, error) { ret := _m.Called(ctx, repo) + if len(ret) == 0 { + panic("no return value specified for UpdateRepoPoolManager") + } + var r0 common.PoolManager var r1 error if rf, ok := ret.Get(0).(func(context.Context, params.Repository) (common.PoolManager, error)); ok { @@ -373,13 +433,12 @@ func (_m *PoolManagerController) UpdateRepoPoolManager(ctx context.Context, repo return r0, r1 } -type mockConstructorTestingTNewPoolManagerController interface { +// NewPoolManagerController creates a new instance of PoolManagerController. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewPoolManagerController(t interface { mock.TestingT Cleanup(func()) -} - -// NewPoolManagerController creates a new instance of PoolManagerController. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewPoolManagerController(t mockConstructorTestingTNewPoolManagerController) *PoolManagerController { +}) *PoolManagerController { mock := &PoolManagerController{} mock.Mock.Test(t) diff --git a/runner/pool/pool.go b/runner/pool/pool.go index e8a46034..5c4a0a2a 100644 --- a/runner/pool/pool.go +++ b/runner/pool/pool.go @@ -337,7 +337,6 @@ func (r *basePoolManager) updateTools() error { slog.With(slog.Any("error", err)).ErrorContext( r.ctx, "failed to update tools for repo") r.setPoolRunningState(false, err.Error()) - r.waitForTimeoutOrCanceled(common.BackoffTimer) return fmt.Errorf("failed to update tools for repo %s: %w", r.helper.String(), err) } r.mux.Lock() @@ -510,7 +509,7 @@ func (r *basePoolManager) reapTimedOutRunners(runners []*github.Runner) error { slog.InfoContext( r.ctx, "reaping timed-out/failed runner", "runner_name", instance.Name) - if err := r.DeleteRunner(instance, false); err != nil { + if err := r.DeleteRunner(instance, false, false); err != nil { slog.With(slog.Any("error", err)).ErrorContext( r.ctx, "failed to update runner status", "runner_name", instance.Name) @@ -812,7 +811,7 @@ func (r *basePoolManager) AddRunner(ctx context.Context, poolID string, aditiona defer func() { if err != nil { if instance.ID != "" { - if err := r.DeleteRunner(instance, false); err != nil { + if err := r.DeleteRunner(instance, false, false); err != nil { slog.With(slog.Any("error", err)).ErrorContext( ctx, "failed to cleanup instance", "runner_name", instance.Name) @@ -1132,7 +1131,7 @@ func (r *basePoolManager) scaleDownOnePool(ctx context.Context, pool params.Pool ctx, "scaling down idle worker from pool %s", "runner_name", instanceToDelete.Name, "pool_id", pool.ID) - if err := r.DeleteRunner(instanceToDelete, false); err != nil { + if err := r.DeleteRunner(instanceToDelete, false, false); err != nil { return fmt.Errorf("failed to delete instance %s: %w", instanceToDelete.ID, err) } return nil @@ -1637,7 +1636,8 @@ func (r *basePoolManager) Start() error { defer close(initialToolUpdate) go r.startLoopForFunction(r.runnerCleanup, common.PoolReapTimeoutInterval, "timeout_reaper", false) go r.startLoopForFunction(r.scaleDown, common.PoolScaleDownInterval, "scale_down", false) - go r.startLoopForFunction(r.deletePendingInstances, common.PoolConsilitationInterval, "consolidate[delete_pending]", false) + // always run the delete pending instances routine. This way we can still remove existing runners, even if the pool is not running. + go r.startLoopForFunction(r.deletePendingInstances, common.PoolConsilitationInterval, "consolidate[delete_pending]", true) go r.startLoopForFunction(r.addPendingInstances, common.PoolConsilitationInterval, "consolidate[add_pending]", false) go r.startLoopForFunction(r.ensureMinIdleRunners, common.PoolConsilitationInterval, "consolidate[ensure_min_idle]", false) go r.startLoopForFunction(r.retryFailedInstances, common.PoolConsilitationInterval, "consolidate[retry_failed]", false) @@ -1668,17 +1668,10 @@ func (r *basePoolManager) ID() string { return r.helper.ID() } -// ForceDeleteRunner will delete a runner from a pool. -// -// Deprecated: Use DeleteRunner instead. -func (r *basePoolManager) ForceDeleteRunner(runner params.Instance) error { - return r.DeleteRunner(runner, true) -} - // Delete runner will delete a runner from a pool. If forceRemove is set to true, any error received from // the IaaS provider will be ignored and deletion will continue. -func (r *basePoolManager) DeleteRunner(runner params.Instance, forceRemove bool) error { - if !r.managerIsRunning { +func (r *basePoolManager) DeleteRunner(runner params.Instance, forceRemove, bypassGHUnauthorizedError bool) error { + if !r.managerIsRunning && !bypassGHUnauthorizedError { return runnerErrors.NewConflictError("pool manager is not running for %s", r.helper.String()) } if runner.AgentID != 0 { @@ -1694,18 +1687,32 @@ func (r *basePoolManager) DeleteRunner(runner params.Instance, forceRemove bool) r.ctx, "runner was not found in github", "agent_id", runner.AgentID) case http.StatusUnauthorized: + slog.With(slog.Any("error", err)).ErrorContext(r.ctx, "failed to remove runner from github") // Mark the pool as offline from this point forward r.setPoolRunningState(false, fmt.Sprintf("failed to remove runner: %q", err)) slog.With(slog.Any("error", err)).ErrorContext( r.ctx, "failed to remove runner") + if bypassGHUnauthorizedError { + slog.Info("bypass github unauthorized error is set, marking runner for deletion") + break + } // evaluate the next switch case. fallthrough default: return errors.Wrap(err, "removing runner") } } else { - // We got a nil response. Assume we are in error. - return errors.Wrap(err, "removing runner") + errResp := &github.ErrorResponse{} + if errors.As(err, &errResp) { + if errResp.Response != nil && errResp.Response.StatusCode == http.StatusUnauthorized && bypassGHUnauthorizedError { + slog.Info("bypass github unauthorized error is set, marking runner for deletion") + } else { + return errors.Wrap(err, "removing runner") + } + } else { + // We got a nil response. Assume we are in error. + return errors.Wrap(err, "removing runner") + } } } } diff --git a/runner/runner.go b/runner/runner.go index c8873c4f..d24565fd 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -941,17 +941,10 @@ func (r *Runner) getPoolManagerFromInstance(ctx context.Context, instance params return poolMgr, nil } -// ForceDeleteRunner will attempt to remove a runner from a pool. -// -// Deprecated: FunctionName is deprecated. Use DeleteRunner instead. -func (r *Runner) ForceDeleteRunner(ctx context.Context, instanceName string) error { - return r.DeleteRunner(ctx, instanceName, true) -} - // DeleteRunner removes a runner from a pool. If forceDelete is true, GARM will ignore any provider errors // that may occur, and attempt to remove the runner from GitHub and then the database, regardless of provider // errors. -func (r *Runner) DeleteRunner(ctx context.Context, instanceName string, forceDelete bool) error { +func (r *Runner) DeleteRunner(ctx context.Context, instanceName string, forceDelete, bypassGithubUnauthorized bool) error { if !auth.IsAdmin(ctx) { return runnerErrors.ErrUnauthorized } @@ -979,7 +972,7 @@ func (r *Runner) DeleteRunner(ctx context.Context, instanceName string, forceDel return errors.Wrap(err, "fetching pool manager for instance") } - if err := poolMgr.DeleteRunner(instance, forceDelete); err != nil { + if err := poolMgr.DeleteRunner(instance, forceDelete, bypassGithubUnauthorized); err != nil { return errors.Wrap(err, "removing runner") } return nil diff --git a/test/integration/e2e/client_utils.go b/test/integration/e2e/client_utils.go index 367ff76a..39bd6ded 100644 --- a/test/integration/e2e/client_utils.go +++ b/test/integration/e2e/client_utils.go @@ -388,9 +388,9 @@ func getInstance(apiCli *client.GarmAPI, apiAuthToken runtime.ClientAuthInfoWrit return &getInstancesResponse.Payload, nil } -func deleteInstance(apiCli *client.GarmAPI, apiAuthToken runtime.ClientAuthInfoWriter, instanceID string, forceRemove bool) error { +func deleteInstance(apiCli *client.GarmAPI, apiAuthToken runtime.ClientAuthInfoWriter, instanceID string, forceRemove, bypassGHUnauthorized bool) error { return apiCli.Instances.DeleteInstance( - clientInstances.NewDeleteInstanceParams().WithInstanceName(instanceID).WithForceRemove(&forceRemove), + clientInstances.NewDeleteInstanceParams().WithInstanceName(instanceID).WithForceRemove(&forceRemove).WithBypassGHUnauthorized(&bypassGHUnauthorized), apiAuthToken) } diff --git a/test/integration/e2e/e2e.go b/test/integration/e2e/e2e.go index 8407f09f..7555a835 100644 --- a/test/integration/e2e/e2e.go +++ b/test/integration/e2e/e2e.go @@ -73,7 +73,7 @@ func GracefulCleanup() { panic(err) } for _, instance := range poolInstances { - if err := deleteInstance(cli, authToken, instance.Name, false); err != nil { + if err := deleteInstance(cli, authToken, instance.Name, false, false); err != nil { panic(err) } slog.Info("Instance deletion initiated", "instance", instance.Name, "stage", "graceful_cleanup") diff --git a/test/integration/e2e/instances.go b/test/integration/e2e/instances.go index 9c17ed2a..edf2ab57 100644 --- a/test/integration/e2e/instances.go +++ b/test/integration/e2e/instances.go @@ -33,9 +33,9 @@ func waitInstanceStatus(name string, status commonParams.InstanceStatus, runnerS return nil, fmt.Errorf("timeout waiting for instance %s status to reach status %s and runner status %s", name, status, runnerStatus) } -func DeleteInstance(name string, forceRemove bool) { +func DeleteInstance(name string, forceRemove, bypassGHUnauthorized bool) { slog.Info("Delete instance", "instance_name", name, "force_remove", forceRemove) - if err := deleteInstance(cli, authToken, name, forceRemove); err != nil { + if err := deleteInstance(cli, authToken, name, forceRemove, bypassGHUnauthorized); err != nil { slog.Error("Failed to delete instance", "instance_name", name, "error", err) panic(err) } diff --git a/test/integration/main.go b/test/integration/main.go index fa4bf20e..609db66f 100644 --- a/test/integration/main.go +++ b/test/integration/main.go @@ -124,12 +124,12 @@ func main() { } repoPool2 = e2e.GetRepoPool(repo.ID, repoPool2.ID) e2e.DisableRepoPool(repo.ID, repoPool2.ID) - e2e.DeleteInstance(repoPool2.Instances[0].Name, false) + e2e.DeleteInstance(repoPool2.Instances[0].Name, false, false) err = e2e.WaitPoolInstances(repoPool2.ID, commonParams.InstancePendingDelete, params.RunnerPending, 1*time.Minute) if err != nil { slog.With(slog.Any("error", err)).Error("Failed to wait for instance to be running") } - e2e.DeleteInstance(repoPool2.Instances[0].Name, true) // delete instance with forceRemove + e2e.DeleteInstance(repoPool2.Instances[0].Name, true, false) // delete instance with forceRemove err = e2e.WaitInstanceToBeRemoved(repoPool2.Instances[0].Name, 1*time.Minute) if err != nil { slog.With(slog.Any("error", err)).Error("Failed to wait for instance to be removed")