🏡 index : ~doyle/gitlab-cargo-shim.git

author Jordan Doyle <jordan@doyle.la> 2024-02-24 19:59:52.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2024-02-24 20:27:50.0 +00:00:00
commit
dc1c88d83892abc90f66a7d10ae992a61c5fe4f6 [patch]
tree
d22e4bdb90dfb81530d7dd8fc198c02b73c17dc2
parent
b819b9136de428d47082608c0918485ac80bd441
download
dc1c88d83892abc90f66a7d10ae992a61c5fe4f6.tar.gz

Fix docker build



Diff

 Dockerfile  |  2 +-
 src/main.rs | 15 ++++-----------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 6dec25d..3e1e614 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
FROM rust:1-slim-bookworm AS builder

RUN apt update && apt install -y make
RUN apt update && apt install -y make pkg-config clang

COPY . /sources
WORKDIR /sources
diff --git a/src/main.rs b/src/main.rs
index 11092fa..d380ec0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -585,13 +585,6 @@ impl<U: UserProvider + PackageProvider + Send + Sync + 'static> thrussh::server:

            match args.next().as_deref() {
                Some("git-upload-pack") => {
                    // check the executable requested to be ran is the `git-upload-pack` we
                    // expect. we're not actually going to execute this, but we'll pretend
                    // to be it instead in `data`.
                    if args.next().as_deref() != Some("git-upload-pack") {
                        anyhow::bail!("not git-upload-pack");
                    }

                    // parse the requested project from the given path (the argument
                    // given to `git-upload-pack`)
                    let arg = args.next();
@@ -603,10 +596,10 @@ impl<U: UserProvider + PackageProvider + Send + Sync + 'static> thrussh::server:
                        self.project = Some(Arc::from(project.to_string()));
                    } else {
                        session.extended_data(channel, 1, CryptoVec::from_slice(indoc::indoc! {b"
                    \r\nNo project was given in the path part of the SSH URI. A GitLab group and project should be defined in your .cargo/config.toml as follows:
                        [registries]
                        my-project = {{ index = \"ssh://domain.to.registry.com/my-group/my-project\" }}\r\n
                "}));
                            \r\nNo project was given in the path part of the SSH URI. A GitLab group and project should be defined in your .cargo/config.toml as follows:
                                [registries]
                                my-project = {{ index = \"ssh://domain.to.registry.com/my-group/my-project\" }}\r\n
                        "}));
                        session.close(channel);
                    }