newrelic-experimental / gitlab

Gitlab exporters to send metrics,logs,traces to New Relic
9 stars 6 forks source link

Gitlab Permission Error #36

Closed AvihaiV closed 4 months ago

AvihaiV commented 4 months ago

Hi,

We are using GitLab Runners on K8s. When running the export we are getting the following error:

$ python3 -u /app/main.py
Traceback (most recent call last):
  File "/app/main.py", line 30, in <module>
    projects = gl.projects.list(owned=GLAB_PROJECT_OWNERSHIP,visibility=GLAB_PROJECT_VISIBILITY,get_all=True)
  File "/usr/local/lib/python3.10/site-packages/gitlab/exceptions.py", line [33](https://git.app.com/user/new-relic-test/-/jobs/2883415#L33)6, in wrapped_f
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/gitlab/mixins.py", line 247, in list
    obj = self.gitlab.http_list(path, **data)
  File "/usr/local/lib/python3.10/site-packages/gitlab/client.py", line 925, in http_list
    return list(GitlabList(self, url, query_data, **kwargs))
  File "/usr/local/lib/python3.10/site-packages/gitlab/client.py", line 1182, in __init__
    self._query(url, query_data, **self._kwargs)
  File "/usr/local/lib/python3.10/site-packages/gitlab/client.py", line 1192, in _query
    result = self._gl.http_request("get", url, query_data=query_data, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/gitlab/client.py", line 788, in http_request
    raise gitlab.exceptions.GitlabAuthenticationError(
gitlab.exceptions.GitlabAuthenticationError: [40](https://git.app.com/user/new-relic-test/-/jobs/2883415#L40)1: 401 Unauthorized

We are using a bot access key, it is a member in all projects but not an owner, so I set the variable:

variables:
    GLAB_PROJECT_OWNERSHIP: "False"

But still getting the same error. Any suggestions?

Thanks!

AvihaiV commented 4 months ago

Found the issue.

I was using an old Docker image, changed it to: docker.io/dpacheconr/gitlab-metrics-exporter:1.0.14

And added the correct value for - GLAB_ENDPOINT