Skip to main content

cli tool to manage saltstack git repositories

Project description

Savory

About

Savory is a cli tool for managing saltstack git repositories

Commandline

Usage: savory [OPTIONS]

Options:
  -f, --file TEXT         repository file
  -r, --repo TEXT         repository file repo
  -t, --tag TEXT          repository file tag
  -d, --destination TEXT  repository file destination
  --help                  Show this message and exit.

fetch reposities from a local repository file:

savory --file localfile.yml

fetch reposities from a repository file in a git repo:

savory --file repofile_in_repo.yml \
       --repo git@gitserver:saltstack/savory.git \
       --tag master \
       --destination /tmp

Repository file example

defaults:
  destination: /srv/salt
  type: formula

repositories:
  - formula1
  - formula2
  - formula3
  - pillar_data

formula1:
  repo: git@gitserver:saltstack/formula1.git
  tag: 1.0.0

formula2:
  repo: git@gitserver:saltstack/formula2.git
  tag: 1.0.1

formula3:
  repo: git@gitserver:saltstack/formula3.git
  tag: 1.0.3

pillar_data:
  repo: git@gitserver:saltstack/pillar_data.git
  tag: prod
  destination: /srv/pillar
  type: pillar

In the above example formula1, formula2 and formula3 are using git tags (recommended for formulas) and a branch for the pillar_data repo.

Install

  • install savory

    pip3 install savory
  • create a new git user and make sure that this user has quest permissions to all repositories that you want to manage with savory

  • create a new keypair and place the keys in .ssh

    [root@salt-master ~]# ssh-keygen -t ed25519
    Generating public/private ed25519 key pair.
    Enter file in which to save the key (/root/.ssh/id_ed25519): /root/.ssh/gitlab
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /root/.ssh/gitlab.
    Your public key has been saved in /root/.ssh/gitlab.pub.
    The key fingerprint is:
    SHA256:abcdefghijklmnopqrstuvwABCDEFGHIJKLMNOP+RST root@salt-master
    The key's randomart image is:
    +--[ED25519 256]--+
    |  BX^.+.   . o ..|
    |..o^.@ ..o. . o. |
    |+++.%   +.      .|
    |o=.o .   .    .. |
    |o..     S    . E.|
    |.             . .|
    |             . . |
    |              o  |
    |             .   |
    +----[SHA256]-----+
  • adjust the gitlab user in gitlab and add the public key generated in the previous step to this user

  • copy the systemd files from https://gitlab.com/solvinity/savory/-/tree/main/systemd and place them in /etc/systemd/system

  • enable savory.timer by running

    systemctl enable savory.timer
  • verify in journalctl if the repositories are cloned to the configured location specified in the repository file.

To-do

Implement cleanup/delete of unused repositories

Changelog

0.1.4 (2021-12-17) - add exit code on failure

0.1.3 (2021-08-12)

  • changed wrong url in setup.py

0.1.2 (2021-08-12)

0.1.0 (2021-08-12) initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

savory-0.1.4.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

savory-0.1.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file savory-0.1.4.tar.gz.

File metadata

  • Download URL: savory-0.1.4.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for savory-0.1.4.tar.gz
Algorithm Hash digest
SHA256 24de3f679ad832a2cf926fe06fbb5609da1cc9247a549f2d1dac91718c33c581
MD5 f446e41bdeb547502890720a48b21156
BLAKE2b-256 d6f5effc35688dd01c6733abed1311933e4123801df4266c137c6291a6564683

See more details on using hashes here.

File details

Details for the file savory-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: savory-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for savory-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8e1668040ef3d241dff031e0d102f530e0060443dbfe51db8efbc47b9610cae5
MD5 198d0e266f0e89171d6c7ba7c412f8f0
BLAKE2b-256 55053cb3b2023418f6215affed59b651605b8de030b3583a4e95ca7e9efae19c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page