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

Fix gitlab-fetcher to obtain tags and branches #3809

Merged
merged 1 commit into from
Jul 14, 2020

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Jul 13, 2020

Until now, the gitlab-fetcher determined the source's rev by checking
the latest commit of the given ref using the
/repository/branches-API.

This breaks however when trying to fetch a gitlab-repo by its tag:

$ nix repl
nix-repl> builtins.fetchTree gitlab:Ma27/nvim.nix/0.2.0
error: --- Error ------------------------------------------------------------------------------------- nix
unable to download 'https://gitlab.com/api/v4/projects/Ma27%2Fnvim.nix/repository/branches/0.2.0': HTTP error 404 ('')

When using the /commits?ref_name-endpoint[1] you can pass any kind of
valid ref to the gitlab-fetcher.

Please note that this fetches the only first 20 commits on a ref,
unfortunately there's currently no endpoint which only retrieves the
latest commit of any kind of ref.

[1] https://docs.gitlab.com/ee/api/commits.html#list-repository-commits

cc @edolstra

Until now, the `gitlab`-fetcher determined the source's rev by checking
the latest commit of the given `ref` using the
`/repository/branches`-API.

This breaks however when trying to fetch a gitlab-repo by its tag:

```
$ nix repl
nix-repl> builtins.fetchTree gitlab:Ma27/nvim.nix/0.2.0
error: --- Error ------------------------------------------------------------------------------------- nix
unable to download 'https://gitlab.com/api/v4/projects/Ma27%2Fnvim.nix/repository/branches/0.2.0': HTTP error 404 ('')
```

When using the `/commits?ref_name`-endpoint[1] you can pass any kind of
valid ref to the `gitlab`-fetcher.

Please note that this fetches the only first 20 commits on a ref,
unfortunately there's currently no endpoint which only retrieves the
latest commit of any kind of `ref`.

[1] https://docs.gitlab.com/ee/api/commits.html#list-repository-commits
@Ma27 Ma27 mentioned this pull request Jul 13, 2020
@edolstra edolstra merged commit 298ff6a into NixOS:flakes Jul 14, 2020
@Ma27 Ma27 deleted the gitlab-refs branch July 14, 2020 13:23
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 this pull request may close these issues.

2 participants