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

Wrong path for check of local git hash #847

Closed
MaksonHerson opened this issue Dec 8, 2023 · 3 comments · Fixed by #848
Closed

Wrong path for check of local git hash #847

MaksonHerson opened this issue Dec 8, 2023 · 3 comments · Fixed by #848

Comments

@MaksonHerson
Copy link

Hello!
In my instance I specify GITSYNC_ROOT = /bitnami/gitsync. According this all actions with git hash (change, update) must perform at the /bitnami/gitsync path. But I encountered with next problem: my gitsync instance try to work with git stuff files at /gitsync/ directory. So in logs I met circling errors:

{"logger":"","ts":"2023-12-08 11:54:49.235889","caller":{"file":"main.go","line":1624},"level":0,"msg":"worktree failed checks or was empty","path":"/gitsync/.worktrees/3abb97bee2cd587231968a0cbc6b3d700898b266"}

{"logger":"","ts":"2023-12-08 11:54:49.727507","caller":{"file":"main.go","line":1682},"msg":"can't change stale worktree mtime","error":"mkdir /gitsync: permission denied","path":"/gitsync/.worktrees/3abb97bee2cd587231968a0cbc6b3d700898b266"}

Logically these checks must perform at dir, specified at GITSYNC_ROOT variable. But it seems like it try to

Here is piece of it's manifest:

    sidecars:
      - name: git-sync
        image: registry.k8s.io/git-sync/git-sync:v4.1.0
        imagePullPolicy: IfNotPresent
        envFrom:
          - secretRef:
              name: kps-git-sync
        env:
          - name: GITSYNC_USERNAME
            value: kps-git-sync
          - name: GITSYNC_REPO
            value: https://git.example.org/file.git
          - name: GITSYNC_ROOT
            value: /bitnami/gitsync
          - name: GITSYNC_LINK
            value: /bitnami/wordpress/wp-content/themes/my-theme
          - name: GITSYNC_PERIOD
            value: "10s"
          - name: GITSYNC_MAX_FAILURES
            value: "-1"
        volumeMounts:
          - mountPath: /bitnami
            name: data
        securityContext:
          allowPrivilegeEscalation: false
          capabilities:
            drop:
            - ALL
          runAsNonRoot: true
          runAsUser: 1001

Gitsync works inside k8s sidecar and runs like none root user. User 1001 cant create nothing at / as he is none root user. And as I understand he does not need it at all (because /bitnami/gitsync is his workdir).
Also have to say that gitsync works correct and I have the problem with this logs only.

What should I do to escape this error?

@thockin
Copy link
Member

thockin commented Dec 8, 2023

Can you run with -v 6 and post full logs, including the beginning (all the flags) and everything up to this error?

There is no place where "gitsync" is hardcoded, so something is mis-parsing.

@thockin
Copy link
Member

thockin commented Dec 8, 2023

Aha, I think I found the bug. Will have to think about how to fix it. Relative paths are hard :)

@thockin
Copy link
Member

thockin commented Dec 8, 2023

#848

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 a pull request may close this issue.

2 participants