Skip to content

Instantly share code, notes, and snippets.

@marcothz
Last active September 28, 2023 13:29
Show Gist options
  • Save marcothz/2675f0371e730e63cffb71561a2336c0 to your computer and use it in GitHub Desktop.
Save marcothz/2675f0371e730e63cffb71561a2336c0 to your computer and use it in GitHub Desktop.

Revisions

  1. marcothz revised this gist Sep 28, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion sync-repositories.sh
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ do
    # rsync -avh --delete --force --delete-excluded $IGNORE $SOURCE/control-repo/ $TARGET

    rsync -avh $IGNORE $SOURCE/<git-repository-1>/ $TARGET/
    rsync -avh $IGNORE $SOURCE/<git-repository-1>/ $TARGET/
    rsync -avh $IGNORE $SOURCE/<git-repository-2>/ $TARGET/

    sleep 2
    done
  2. marcothz created this gist Sep 28, 2023.
    21 changes: 21 additions & 0 deletions sync-repositories.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    # This requires ruby, so you might need to do a . ~/.asdf/asdf.sh
    # /opt/puppetlabs/pdk/share/cache/ruby/2.7.0/bin/r10k puppetfile install --moduledir=/etc/puppetlabs/code/environments/testing_dev_branch/modules

    SOURCE=/home/<user>/git/puppet-modules
    TARGET=/etc/puppetlabs/code/environments/testing_dev_branch

    IGNORE=--exclude='.git/'

    mkdir -p $TARGET/modules

    while true
    do
    # We can't run this all the time, because it will also delete the modules.
    # Which would make a full modules sync everytime.
    # rsync -avh --delete --force --delete-excluded $IGNORE $SOURCE/control-repo/ $TARGET

    rsync -avh $IGNORE $SOURCE/<git-repository-1>/ $TARGET/
    rsync -avh $IGNORE $SOURCE/<git-repository-1>/ $TARGET/

    sleep 2
    done