mirror of
https://github.com/external-secrets/external-secrets.git
synced 2024-12-14 11:57:59 +00:00
fix: gitlab empty response (#4152)
Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
This commit is contained in:
parent
3218a21cb7
commit
b518bae15f
1 changed files with 10 additions and 2 deletions
|
@ -224,14 +224,22 @@ func (g *gitlabBase) GetSecret(_ context.Context, ref esv1beta1.ExternalSecretDa
|
|||
|
||||
data, resp, err := g.projectVariablesClient.GetVariable(g.store.ProjectID, ref.Key, vopts)
|
||||
metrics.ObserveAPICall(constants.ProviderGitLab, constants.CallGitLabProjectVariableGet, err)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp == nil {
|
||||
return nil, errors.New("gitlab response is nil")
|
||||
}
|
||||
|
||||
if !isEmptyOrWildcard(g.store.Environment) && resp.StatusCode == http.StatusNotFound {
|
||||
vopts.Filter.EnvironmentScope = "*"
|
||||
data, resp, err = g.projectVariablesClient.GetVariable(g.store.ProjectID, ref.Key, vopts)
|
||||
metrics.ObserveAPICall(constants.ProviderGitLab, constants.CallGitLabProjectVariableGet, err)
|
||||
}
|
||||
|
||||
if resp.StatusCode >= 400 && resp.StatusCode != http.StatusNotFound && err != nil {
|
||||
return nil, err
|
||||
if resp.StatusCode >= 400 && resp.StatusCode != http.StatusNotFound {
|
||||
return nil, fmt.Errorf("gitlab response status code was not OK: %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
err = g.ResolveGroupIds()
|
||||
|
|
Loading…
Reference in a new issue