kubernetes / git-sync

A sidecar app which clones a git repo and keeps it in sync with the upstream.
Apache License 2.0
2.21k stars 410 forks source link

Eliminate the need for a shell #518

Open bgrant0607 opened 2 years ago

bgrant0607 commented 2 years ago

Either replace use of the git CLI with go-git or libgit2, like ArgoCD and Flux, or otherwise eliminate the need for a shell (reimplement submodules?).

thockin commented 2 years ago

I tried to removed the shell and git clone failed. It doesn't pass even the most trivial e2e test.

Looking at go-git, some of what we need (rev-parse, ls-remote, and worktree at least) are not supported. Worktree is pretty important. There may be workarounds, but it's not a drop-in.

libgit2 would require CGO, which is a can of worms which we can evaluate.

bgrant0607 commented 2 years ago

Thanks for checking, and for describing the obstacles.

I opened this as a place for interested parties to look and/or comment.

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 1 year ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

thockin commented 1 year ago

For kicks, I tried this against my current working branch, which has some huge changes, including #691

I can make it run without a shell EXCEPT FOR submodules. If I set submodules=off it seems to run.

I don't know what we want to do with that information.

sboardwell commented 1 year ago

What would removing the shell mean for exechook-command actions?

thockin commented 1 year ago

The exechooks mechanism doesn't depend on a shell, but I suspect many exechooks are written as shell scripts.

Assuming we got rid of the shell, I suspect we would want to produce 2 images - with and without shell, or make sure people could build their own images on top of the shell-free one, or something.

But as it stands, we still need the shell, so....

sboardwell commented 1 year ago

Yes, I was already looking at adding curl in order to use it in an exechook-command

❯ cat Dockerfile
FROM registry.k8s.io/git-sync/git-sync:v3.6.6
ADD  --chmod=655 https://github.com/moparisthebest/static-curl/releases/download/v8.0.1/curl-amd64 /bin/curl

❯ docker image ls| grep 3.6.6           
git-sync                            v3.6.6-curl   8f391e1a6dd1   About a minute ago   165MB
registry.k8s.io/git-sync/git-sync   v3.6.6        ab1b1c64ba67   6 days ago           162MB
thockin commented 1 year ago

We have webhooks - does that work better for you?

Also, you can (for now?) apt-get install curl

sboardwell commented 1 year ago

Webhooks don't work because they are executed at the same time or before the exechook execution. Using apt-get bloats the image.

k8s-triage-robot commented 8 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 7 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

thockin commented 7 months ago

FTR: git submodule is still a script :(

k8s-triage-robot commented 4 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 3 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

thockin commented 3 months ago

/lifecycle frozen /remove-lifecycle stale /remove-lifecycle rotten