mirror of
https://github.com/actions-runner-controller/actions-runner-controller.git
synced 2026-10-04 22:07:50 +02:00
Add status check before deserializing runner-registration response (#2699)
This commit is contained in:
@@ -921,6 +921,16 @@ func (c *Client) getActionsServiceAdminConnection(ctx context.Context, rt *regis
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode > 299 {
|
||||
registrationErr := fmt.Errorf("unexpected response from Actions service during registration call: %v", resp.StatusCode)
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%v - %v", registrationErr, err)
|
||||
}
|
||||
return nil, fmt.Errorf("%v - %v", registrationErr, string(body))
|
||||
}
|
||||
|
||||
var actionsServiceAdminConnection *ActionsServiceAdminConnection
|
||||
if err := json.NewDecoder(resp.Body).Decode(&actionsServiceAdminConnection); err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user