This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
idhub-docker/pull-repos.sh

45 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
set -e
set -u
# DEBUG
set -x
# clone or pull git repo
_pull() {
myurl="${1}"
expected_branch="${2}"
mydir_raw="$(basename "${myurl}")"
mydir="${mydir_raw%.git}"
if [ -d "${mydir}" ]; then
cd "${mydir}"
git pull
current_branch="$(git branch --show-current)"
# ensure we are in the right branch without invalidating docker build cache
# yes, even without no branch switch and no new commits
if [ ! "${current_branch}" = "${expected_branch}" ]; then
git checkout "${expected_branch}"
fi
cd -
else
git clone -b "${expected_branch}" "${myurl}" "${mydir}"
fi
}
main() {
figlet 'pull repositories'
_pull 'https://gitea.pangea.org/pangea/django-orchestra' 'sso'
_pull 'https://gitea.pangea.org/pangea/django-musician' 'sso'
_pull 'git@gitea.pangea.org:trustchain-oc1-orchestral/IdHub.git' 'main'
_pull 'git@gitea.pangea.org:trustchain-oc1-orchestral/authentik.git' 'trustchain-oc1-orchestral'
# we only use this to get idhub dependency
# didkit-0.3.2-cp311-cp311-manylinux_2_34_x86_64.whl
_pull 'git@gitea.pangea.org:trustchain-oc1-orchestral/ssikit_trustchain.git' 'master'
}
main "${@}"