You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
New feature: Allow authentication by personal tokens (#53)
* Correct usage of cargo-get in .gitlab-ci snippet
* Add note reg. incompatibility of cargo and thrussh
* README: Add .ssh/config for personal token usage
* README: Newer cargo versions do not allow URL-embedded passwords
* Refactor: Add function to build client with token
* Allow authentication with personal token
* Keep personal token in User
* Optionally use personal token for reading packages
* Optionally use personal token for DL urls
* README: Add usage of personal token authentication
* Consider only packages with type generic
---------
Co-authored-by: Morian Sonnet <morian.sonnet@isea.rwth-aachen.de>
Copy file name to clipboardExpand all lines: README.md
+15-6Lines changed: 15 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,19 +6,28 @@ Say goodbye to your Git dependencies, `gitlab-cargo-shim` is a stateless SSH ser
6
6
7
7
Access controls work like they do in GitLab, builds are scoped to users - if they don't have permission to the dependency they can't build it, it's that simple.
8
8
9
-
Users are identified by their SSH keys from GitLab when connecting to the server and an [impersonation token][imp-token] will be generated for that run in order to pull available versions. Builds will insert their token as a username to the SSH server and the shim will use that to call the GitLab API.
9
+
Users are either identified by their SSH keys from GitLab when connecting to the server or by an Gitlab personal-token. If no token is given, an [impersonation token][imp-token] will be generated for that run in order to pull available versions. Doing so requires ad admin personal token.
10
10
11
-
To publish run `cargo package` and push the resulting `.crate` file to the GitLab package repository with a semver-compatible version string, to consume the package configure your `.cargo/config.toml` and `Cargo.toml` accordingly.
11
+
To publish run `cargo package` and push the resulting `.crate` file to the GitLab package repository with a semver-compatible version string, to consume the package configure your `.cargo/config.toml`, `Cargo.toml` and, optionally, `.ssh/config` accordingly.
12
+
13
+
At time of writing, `libssh2`, which `cargo` implicitly uses for communicating with the registry by SSH, is incompatible with rust's `thrussh`, due to non-overlapping ciphers. Hence, activating `net.git-fetch-with-cli` is necessary.
12
14
13
15
```toml
14
16
# .cargo/config.toml
15
17
[registries]
16
-
my-gitlab-project = { index = "ssh://gitlab-cargo-shim.local/my-gitlab-group/my-gitlab-project" }
18
+
my-gitlab-project = { index = "ssh://gitlab-cargo-shim.local/my-gitlab-group/my-gitlab-project/" }
19
+
[net]
20
+
git-fetch-with-cli = true
17
21
18
22
# Cargo.toml
19
23
[dependencies]
20
24
my-crate = { version = "0.1", registry = "my-gitlab-project" }
21
25
```
26
+
```ssh-config
27
+
# .ssh/config (only if authentication by personal token is requires)
28
+
Host gitlab-cargo-shim.local
29
+
User personal-token:<your-personal-token>
30
+
```
22
31
23
32
In your CI build, setup a `before_script` step to replace the connection string with one containing the CI token:
24
33
@@ -34,13 +43,13 @@ To release your package from CI, add a new pipeline step:
0 commit comments