summaryrefslogtreecommitdiffstats
path: root/jjb/ci_gate_security/anteater-clone-all-repos.sh
blob: 8a9e73d8513f6961fa7a06e2487991bfad06a720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# SPDX-license-identifier: Apache-2.0
set -o errexit
set -o pipefail
set -o nounset
export PATH=$PATH:/usr/local/bin/


#WORKSPACE="$(pwd)"

cd $WORKSPACE
if [ ! -d "$WORKSPACE/allrepos" ]; then
  mkdir $WORKSPACE/allrepos
fi

cd $WORKSPACE/allrepos

declare -a PROJECT_LIST
EXCLUDE_PROJECTS="All-Projects|All-Users|securedlab"

PROJECT_LIST=($(ssh gerrit.opnfv.org -p 29418 gerrit ls-projects | egrep -v $EXCLUDE_PROJECTS))
echo "PROJECT_LIST=(${PROJECT_LIST[*]})" > $WORKSPACE/opnfv-projects.sh

for PROJECT in ${PROJECT_LIST[@]}; do
  echo "> Cloning $PROJECT"
  if [ ! -d "$PROJECT" ]; then
    git clone "https://gerrit.opnfv.org/gerrit/$PROJECT.git"
  else
    pushd "$PROJECT" > /dev/null
    git pull -f
    popd > /dev/null
  fi
done