ContainerImage.GitSparseClone/init/entrypoint.sh
Danny Bessems 931dbcb388
All checks were successful
continuous-integration/drone/push Build is passing
Update 'init/entrypoint.sh'
2020-04-02 08:08:12 +00:00

20 lines
552 B
Bash

#!/bin/sh
set -eox pipefail
# Configure git for corporate proxy
git config --global http.proxyAuthMethod basic
# Clone git-repo
git init
git config core.sparsecheckout true
echo "$SPARSE_CHECKOUT" >> .git/info/sparse-checkout
git remote add -f origin $REMOTE_REPO
git pull origin $REMOTE_BRANCH
# Create target folder and move files
rm -Rf "$TARGET_DIR" || true
mkdir -p "$TARGET_DIR"
mv `echo "$SPARSE_CHECKOUT" | awk '{gsub(/\/\*$/, ""); print}'` $TARGET_DIR
# Uncomment the following line if your sidecar needs to have an actual PID 1
#exec "$@"