ContainerImage.GitSparseClone/init/entrypoint.sh

20 lines
552 B
Bash
Raw Normal View History

2020-02-17 12:40:01 +00:00
#!/bin/sh
2020-02-24 11:43:35 +00:00
set -eox pipefail
2020-02-17 12:40:01 +00:00
2020-02-17 14:12:18 +00:00
# Configure git for corporate proxy
git config --global http.proxyAuthMethod basic
2020-02-17 12:40:01 +00:00
# Clone git-repo
git init
git config core.sparsecheckout true
2020-02-18 10:29:25 +00:00
echo "$SPARSE_CHECKOUT" >> .git/info/sparse-checkout
2020-02-17 12:40:01 +00:00
git remote add -f origin $REMOTE_REPO
git pull origin $REMOTE_BRANCH
2020-02-17 12:53:54 +00:00
# Create target folder and move files
2020-04-02 08:08:12 +00:00
rm -Rf "$TARGET_DIR" || true
mkdir -p "$TARGET_DIR"
2020-02-18 10:29:25 +00:00
mv `echo "$SPARSE_CHECKOUT" | awk '{gsub(/\/\*$/, ""); print}'` $TARGET_DIR
2020-02-17 12:40:01 +00:00
2020-03-16 08:06:41 +00:00
# Uncomment the following line if your sidecar needs to have an actual PID 1
#exec "$@"