1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00

Fix unregistering agents used with agent tokens (#2870)

from discussion on matrix

I'm not sure if this is the best way to fix this, but I don't really see
a different way.
This commit is contained in:
qwerty287 2023-11-24 18:19:38 +01:00 committed by GitHub
parent a6d651175d
commit 111a0b4ea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -352,6 +352,10 @@ func (s *RPC) RegisterAgent(ctx context.Context, platform, backend, version stri
func (s *RPC) UnregisterAgent(ctx context.Context) error {
agent, err := s.getAgentFromContext(ctx)
if agent.OwnerID > 0 {
// registered with individual agent token -> do not unregister
return nil
}
log.Debug().Msgf("unregistering agent with ID %d", agent.ID)
if err != nil {
return err