Adding the possibility to pull changes from git before updating images

This commit is contained in:
2023-10-03 13:13:51 +02:00
parent d58f26d49c
commit cc7d62d975
2 changed files with 12 additions and 0 deletions

View File

@@ -7,6 +7,12 @@ import config
DOCKER_COMPOSE_PATH = config.portainer_compose_dir + '/{}/docker-compose.yml' DOCKER_COMPOSE_PATH = config.portainer_compose_dir + '/{}/docker-compose.yml'
BASH_COMPANION_SCRIPT = os.getcwd() + '/docker_updater.sh' BASH_COMPANION_SCRIPT = os.getcwd() + '/docker_updater.sh'
REPO_UPDATER_SCRIPT = os.getcwd() + '/update_repo.sh'
def update_repositories():
for repo_path in config.git_repositories:
os.system(f"{REPO_UPDATER_SCRIPT} {repo_path}")
def update_stack(stack): def update_stack(stack):

6
update_repos.sh Executable file
View File

@@ -0,0 +1,6 @@
REPO_PATH=$1
git -C $REPO_PATH fetch --tags
LAST_HASH=`git -C $REPO_PATH rev-list --tags --max-count=1`
LAST_TAG=`git -C $REPO_PATH describe --tags $LAST_HASH`
git -C $REPO_PATH checkout $LAST_TAG