Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support using GitLab project tokens #75

Closed
defreng opened this issue Jan 21, 2021 · 0 comments · Fixed by #76
Closed

Support using GitLab project tokens #75

defreng opened this issue Jan 21, 2021 · 0 comments · Fixed by #76

Comments

@defreng
Copy link

defreng commented Jan 21, 2021

When bootstrapping flux with GitLab, it needs to perform various actions on the GitLab instance:

  • Creating a repository (if it doesn't exist, yet)
  • Adding a deployment key

During these operations, it will try to find the correct GitLab project using the GitLab API. With the current implementation, the search is restricted to return only groups with an access level >= 10.

When using a project access token in gitlab (from a repository that has already been manually created), the gitlab API will not list project parent groups if search is performed with access level >= 10. This will cause the bootstrapping to fail:

ubuntu@myhost:~$ flux bootstrap gitlab \
>     --owner=mygroup/mysubgroup \
>     --repository=myrepo

✗ failed to list projects, error: failed to find group named 'mygroup/mysubgroup'

The relevant code sections are:

Solution
The requirement on the access level can simply be omitted. The GitLab API will only list projects/groups the provided token can see.

defreng added a commit to defreng/pkg that referenced this issue Jan 21, 2021
This will make it possible to use project-level access tokens

Resolves: fluxcd#75
defreng added a commit to defreng/pkg that referenced this issue Jan 21, 2021
This will make it possible to use project-level access tokens

Resolves: fluxcd#75
Signed-off-by: Alexander Hungenberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant