Skip to content

Commit

Permalink
Cleanup clone-repos
Browse files Browse the repository at this point in the history
* Checking for a link && using "-f" is redundant.
* Helper scripts that are not used anywhere else feels weird to me.
  • Loading branch information
Aakash Shah committed Jul 8, 2020
1 parent ee159f3 commit 8358550
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 47 deletions.
52 changes: 32 additions & 20 deletions clone-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,51 @@

set -e

source ./helpers/clone.sh
source ./helpers/disable-cred-hook.sh
function clone {
local repo=$1
local destination=$2
local branch=${3:-master}

if [ ! -d $destination ]; then
echo "Cloning $destination"
git clone $repo $destination --branch $branch
else
echo "$destination already present, skipping"
fi
}

pushd ~/workspace > /dev/null
function disable_cred_hook {
mkdir -p "${1}/.git/hooks"
cat > "${1}/.git/hooks/post-merge" << EOT
#!/usr/bin/env bash
# Override the default hook that complains about credentials
exit 1
EOT
chmod +x "${1}/.git/hooks/post-merge"
}

pushd ~/workspace > /dev/null
clone [email protected]:pivotal/pivotal_ide_prefs.git ~/workspace/pivotal_ide_prefs
clone [email protected]:cloudfoundry/capi-release.git ~/workspace/capi-release develop
clone [email protected]:cloudfoundry/capi-env-pool.git ~/workspace/capi-env-pool
disable_cred_hook ~/workspace/capi-env-pool
clone [email protected]:cloudfoundry/capi-ci.git ~/workspace/capi-ci
clone [email protected]:cloudfoundry/capi-dockerfiles.git ~/workspace/capi-dockerfiles
clone [email protected]:cloudfoundry/capi-ci-private.git ~/workspace/capi-ci-private
disable_cred_hook ~/workspace/capi-ci-private
clone [email protected]:cloudfoundry/cf-deployment.git ~/workspace/cf-deployment
clone [email protected]:cloudfoundry/cf-for-k8s.git ~/workspace/cf-for-k8s

# clone golang repos and symlink them into the GOPATH
clone [email protected]:cloudfoundry/cf-acceptance-tests.git ~/go/src/github.com/cloudfoundry/cf-acceptance-tests
if [ ! -L ~/workspace/cf-acceptance-tests ]; then
ln -sf $HOME/go/src/github.com/cloudfoundry/cf-acceptance-tests ~/workspace/cf-acceptance-tests
fi

clone [email protected]:cloudfoundry/sync-integration-tests.git ~/go/src/code.cloudfoundry.org/sync-integration-tests
ln -sfn $HOME/go/src/code.cloudfoundry.org/sync-integration-tests ~/workspace/sync-integration-tests

clone [email protected]:cloudfoundry/capi-bara-tests.git ~/go/src/github.com/cloudfoundry/capi-bara-tests
if [ ! -L ~/workspace/capi-bara-tests ]; then
ln -sf $HOME/go/src/github.com/cloudfoundry/capi-bara-tests ~/workspace/capi-bara-tests
fi

clone [email protected]:cloudfoundry/cli.git ~/go/src/code.cloudfoundry.org/cli
if [ ! -L ~/workspace/cli ]; then
ln -sf $HOME/go/src/code.cloudfoundry.org/cli/ ~/workspace/cli
fi

disable_cred_hook ~/workspace/capi-env-pool
disable_cred_hook ~/workspace/capi-ci-private

# clone golang repos and symlink them into the GOPATH
ln -sf $HOME/go/src/github.com/cloudfoundry/cf-acceptance-tests ~/workspace/cf-acceptance-tests
ln -sfn $HOME/go/src/code.cloudfoundry.org/sync-integration-tests ~/workspace/sync-integration-tests
ln -sf $HOME/go/src/github.com/cloudfoundry/capi-bara-tests ~/workspace/capi-bara-tests
ln -sf $HOME/go/src/code.cloudfoundry.org/cli/ ~/workspace/cli
popd > /dev/null
14 changes: 0 additions & 14 deletions helpers/clone.sh

This file was deleted.

13 changes: 0 additions & 13 deletions helpers/disable-cred-hook.sh

This file was deleted.

0 comments on commit 8358550

Please sign in to comment.