Add getProviderBaseParams function in basePoolManager
This commit is contained in:
parent
7074f01541
commit
dcff6f9854
1 changed files with 15 additions and 20 deletions
|
|
@ -130,6 +130,16 @@ type basePoolManager struct {
|
|||
keyMux *keyMutex
|
||||
}
|
||||
|
||||
func (r *basePoolManager) getProviderBaseParams(pool params.Pool) common.ProviderBaseParams {
|
||||
r.mux.Lock()
|
||||
defer r.mux.Unlock()
|
||||
|
||||
return common.ProviderBaseParams{
|
||||
PoolInfo: pool,
|
||||
ControllerInfo: r.controllerInfo,
|
||||
}
|
||||
}
|
||||
|
||||
func (r *basePoolManager) HandleWorkflowJob(job params.WorkflowJob) error {
|
||||
if err := r.ValidateOwner(job); err != nil {
|
||||
return errors.Wrap(err, "validating owner")
|
||||
|
|
@ -591,10 +601,7 @@ func (r *basePoolManager) cleanupOrphanedGithubRunners(runners []*github.Runner)
|
|||
"pool_id", pool.ID)
|
||||
listInstancesParams := common.ListInstancesParams{
|
||||
ListInstancesV011: common.ListInstancesV011Params{
|
||||
ProviderBaseParams: common.ProviderBaseParams{
|
||||
PoolInfo: pool,
|
||||
ControllerInfo: r.controllerInfo,
|
||||
},
|
||||
ProviderBaseParams: r.getProviderBaseParams(pool),
|
||||
},
|
||||
}
|
||||
poolInstances, err = provider.ListInstances(r.ctx, pool.ID, listInstancesParams)
|
||||
|
|
@ -664,10 +671,7 @@ func (r *basePoolManager) cleanupOrphanedGithubRunners(runners []*github.Runner)
|
|||
|
||||
startParams := common.StartParams{
|
||||
StartV011: common.StartV011Params{
|
||||
ProviderBaseParams: common.ProviderBaseParams{
|
||||
PoolInfo: pool,
|
||||
ControllerInfo: r.controllerInfo,
|
||||
},
|
||||
ProviderBaseParams: r.getProviderBaseParams(pool),
|
||||
},
|
||||
}
|
||||
if err := provider.Start(r.ctx, dbInstance.ProviderID, startParams); err != nil {
|
||||
|
|
@ -888,10 +892,7 @@ func (r *basePoolManager) addInstanceToProvider(instance params.Instance) error
|
|||
if instanceIDToDelete != "" {
|
||||
deleteInstanceParams := common.DeleteInstanceParams{
|
||||
DeleteInstanceV011: common.DeleteInstanceV011Params{
|
||||
ProviderBaseParams: common.ProviderBaseParams{
|
||||
PoolInfo: pool,
|
||||
ControllerInfo: r.controllerInfo,
|
||||
},
|
||||
ProviderBaseParams: r.getProviderBaseParams(pool),
|
||||
},
|
||||
}
|
||||
if err := provider.DeleteInstance(r.ctx, instanceIDToDelete, deleteInstanceParams); err != nil {
|
||||
|
|
@ -906,10 +907,7 @@ func (r *basePoolManager) addInstanceToProvider(instance params.Instance) error
|
|||
|
||||
createInstanceParams := common.CreateInstanceParams{
|
||||
CreateInstanceV011: common.CreateInstanceV011Params{
|
||||
ProviderBaseParams: common.ProviderBaseParams{
|
||||
PoolInfo: pool,
|
||||
ControllerInfo: r.controllerInfo,
|
||||
},
|
||||
ProviderBaseParams: r.getProviderBaseParams(pool),
|
||||
},
|
||||
}
|
||||
providerInstance, err := provider.CreateInstance(r.ctx, bootstrapArgs, createInstanceParams)
|
||||
|
|
@ -1350,10 +1348,7 @@ func (r *basePoolManager) deleteInstanceFromProvider(ctx context.Context, instan
|
|||
|
||||
deleteInstanceParams := common.DeleteInstanceParams{
|
||||
DeleteInstanceV011: common.DeleteInstanceV011Params{
|
||||
ProviderBaseParams: common.ProviderBaseParams{
|
||||
PoolInfo: pool,
|
||||
ControllerInfo: r.controllerInfo,
|
||||
},
|
||||
ProviderBaseParams: r.getProviderBaseParams(pool),
|
||||
},
|
||||
}
|
||||
if err := provider.DeleteInstance(ctx, identifier, deleteInstanceParams); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue