Merge pull request #446 from gabriel-samfira/fix-url-composition
Use JoinPath() and relative paths
This commit is contained in:
commit
e14f3858ef
3 changed files with 3 additions and 16 deletions
|
|
@ -45,14 +45,8 @@ func (s *ScaleSetClient) GenerateJitRunnerConfig(ctx context.Context, runnerName
|
|||
return params.RunnerScaleSetJitRunnerConfig{}, fmt.Errorf("failed to ensure admin info: %w", err)
|
||||
}
|
||||
|
||||
serviceURL, err := s.actionsServiceInfo.GetURL()
|
||||
if err != nil {
|
||||
return params.RunnerScaleSetJitRunnerConfig{}, fmt.Errorf("failed to get pipeline URL: %w", err)
|
||||
}
|
||||
jitConfigPath := fmt.Sprintf("/%s/%d/generatejitconfig", scaleSetEndpoint, scaleSetID)
|
||||
jitConfigURL := serviceURL.JoinPath(jitConfigPath)
|
||||
|
||||
req, err := s.newActionsRequest(ctx, http.MethodPost, jitConfigURL.String(), bytes.NewBuffer(body))
|
||||
jitConfigPath := fmt.Sprintf("%s/%d/generatejitconfig", scaleSetEndpoint, scaleSetID)
|
||||
req, err := s.newActionsRequest(ctx, http.MethodPost, jitConfigPath, bytes.NewBuffer(body))
|
||||
if err != nil {
|
||||
return params.RunnerScaleSetJitRunnerConfig{}, fmt.Errorf("failed to create request: %w", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,7 @@ func (s *ScaleSetClient) newActionsRequest(ctx context.Context, method, path str
|
|||
return nil, fmt.Errorf("failed to get pipeline URL: %w", err)
|
||||
}
|
||||
|
||||
uri, err := actionsURI.Parse(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse path: %w", err)
|
||||
}
|
||||
|
||||
uri := actionsURI.JoinPath(path)
|
||||
q := uri.Query()
|
||||
if q.Get("api-version") == "" {
|
||||
q.Set("api-version", "6.0-preview")
|
||||
|
|
|
|||
|
|
@ -671,14 +671,11 @@ Loop:
|
|||
slog.ErrorContext(w.ctx, "error starting listener", "error", err, "consumer_id", w.consumerID)
|
||||
if canceled := w.sleepWithCancel(2 * time.Second); canceled {
|
||||
slog.InfoContext(w.ctx, "worker is stopped; exiting keepListenerAlive")
|
||||
w.mux.Unlock()
|
||||
return
|
||||
}
|
||||
// we failed to start the listener. Try again.
|
||||
w.mux.Unlock()
|
||||
continue
|
||||
}
|
||||
w.mux.Unlock()
|
||||
|
||||
select {
|
||||
case <-w.quit:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue