Skip to content

Commit cfb68f8

Browse files
Check webhook secret for entity
Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
1 parent e3ffc15 commit cfb68f8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

runner/pool/pool.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ func NewEntityPoolManager(ctx context.Context, entity params.GithubEntity, cfgIn
102102
return nil, errors.Wrap(err, "getting github client")
103103
}
104104

105+
if entity.WebhookSecret == "" {
106+
return nil, errors.New("webhook secret is empty")
107+
}
108+
105109
wg := &sync.WaitGroup{}
106110
keyMuxes := &keyMutex{}
107111

@@ -1689,16 +1693,17 @@ func (r *basePoolManager) Stop() error {
16891693
func (r *basePoolManager) RefreshState(param params.UpdatePoolStateParams) error {
16901694
r.mux.Lock()
16911695

1692-
r.entity.WebhookSecret = param.WebhookSecret
1696+
if param.WebhookSecret != "" {
1697+
r.entity.WebhookSecret = param.WebhookSecret
1698+
}
16931699
if param.InternalConfig != nil {
16941700
r.cfgInternal = *param.InternalConfig
1695-
}
1696-
1697-
r.urls = urls{
1698-
webhookURL: r.cfgInternal.BaseWebhookURL,
1699-
callbackURL: r.cfgInternal.InstanceCallbackURL,
1700-
metadataURL: r.cfgInternal.InstanceMetadataURL,
1701-
controllerWebhookURL: r.cfgInternal.ControllerWebhookURL,
1701+
r.urls = urls{
1702+
webhookURL: r.cfgInternal.BaseWebhookURL,
1703+
callbackURL: r.cfgInternal.InstanceCallbackURL,
1704+
metadataURL: r.cfgInternal.InstanceMetadataURL,
1705+
controllerWebhookURL: r.cfgInternal.ControllerWebhookURL,
1706+
}
17021707
}
17031708

17041709
ghc, err := garmUtil.GithubClient(r.ctx, r.entity, r.cfgInternal.GithubCredentialsDetails)

0 commit comments

Comments
 (0)