|
|
@@ -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()
|