saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.09k stars 5.47k forks source link

[BUG] Git repos are not fetched when using salt-ssh #66794

Open mazzy89 opened 1 month ago

mazzy89 commented 1 month ago

Description

Git repos defined under gitfs_remotes are not fetched when using salt-ssh

Setup

Steps to Reproduce the behavior

dir struct of the myrepo.com/repo/homelab.git

.
├── config
│   ├── log.txt
│   ├── master
│   └── roster
├── Makefile
├── packages.txt
├── pillar
│   ├── top.sls
│   └── users
├── salt
│   ├── top.sls
│   └── users
└── Saltfile

master

cachedir: /tmp/salt

fileserver_backend:
  - gitfs

gitfs_provider: pygit2
gitfs_base: main
gitfs_remotes:
  - git@github.com:saltstack-formulas/users-formula.git:
    - base: v0.48.8
  - https://myrepo.com/repo/homelab.git:
    - root: saltstack/salt

git_pillar_env: base

ext_pillar:
  - git:
      - "main https://myrepo.com/repo/homelab.git":
        - root: saltstack/pillar

log_level: debug

salt-ssh '*' state.apply

[DEBUG   ] Could not find file 'salt://top.sls' in saltenv 'base'

Expected behavior

Salt defined git repos should be pulled and top.sls should be placed in the proper mountpoint and the state applied.

Screenshots If applicable, add screenshots to help explain your problem.

Versions Report

$ salt --versions-report
Salt Version:
          Salt: 3006.9

Python Version:
        Python: 3.12.4 (main, Jun  7 2024, 06:33:07) [GCC 14.1.1 20240522]

Dependency Versions:
          cffi: 1.17.0
      cherrypy: Not Installed
  cryptography: Not Installed
      dateutil: 2.9.0.post0
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.4
       libgit2: 1.8.1
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.8
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.1
     pycparser: 2.22
      pycrypto: Not Installed
  pycryptodome: 3.20.0
        pygit2: 1.15.1
  python-gnupg: Not Installed
        PyYAML: 6.0.2
         PyZMQ: 26.1.0
        relenv: Not Installed
         smmap: Not Installed
       timelib: Not Installed
       Tornado: Not Installed
           ZMQ: 4.3.5

System Versions:
          dist: archcraft rolling n/a
        locale: utf-8
       machine: x86_64
       release: 6.10.3-zen1-2-zen
        system: Linux
       version: Archcraft rolling n/a

Additional context Add any other context about the problem here.

welcome[bot] commented 1 month ago

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

mazzy89 commented 1 month ago

Important to mention that the cache dir where should be supposed stored the git files is empty /tmp/salt/gitfs/refs/base. This is empty.

mazzy89 commented 1 month ago

I have tested manually cd into /tmp/salt/gitfs/U48dr+66BGaxRlsRVyFUopVPySTAKzlU8_yHkh1LoB8=/_ which is the dir that should get the formula from git. Only the .git folder is present. When I'm in that directory and I pull the branch manually and then re-run salt-ssh at that point everything works.

So it seems that the gitfs_remotes configuration for salt-ssh do not work.