Skip to content

Use http_archive with private Gitlab repo #16659

@kilian-funk

Description

@kilian-funk

Description of the feature request:

I would like to use this in my WORKSPACE file:

http_archive(
    name = "my_repo",
    url = "https://gitlab.com/kilian-funk/test_project/-/archive/main/test_project-main.tar.gz",
    auth_patterns = {"gitlab.com": "PRIVATE-TOKEN: <password>"},
}

where test_project is a private repository.

What underlying problem are you trying to solve with this feature?

The tarball containing the repo can be downloaded on the command line with:

curl --header "PRIVATE-TOKEN: <token-goes-here>" <url>

Unfortunately the http_archive rule results in something equivalent to:

curl --header "Authentication: PRIVATE-TOKEN: <token-goes-here>" <url>

Therefore, http_archive is not compatible with gitlab.com for private repos, since it does not let the user customize the authentication header in the required way. http_archive is making too many assumptions on how an authentication header should look like.

Which operating system are you running Bazel on?

Linux, Ubuntu

What is the output of bazel info release?

release 5.3.2

If bazel info release returns development version or (@non-git), tell us how you built Bazel.


What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

---

Have you found anything relevant by searching the web?

no

Any other information, logs, or outputs that you want to share?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions