#!/bin/bash REPOS=( "oc-auth" "oc-catalog" "oc-datacenter" "oc-front" "oc-monitord" "oc-peer" "oc-shared" "oc-scheduler" "oc-schedulerd" "oc-workflow" "oc-workspace" ) # Function to clone repositories clone_repo() { local branch=${2:-main} local repo_url="https://cloud.o-forge.io/core/$1.git" local repo_name=$(basename "$repo_url" .git) echo "Processing repository: $repo_name" if [ ! -d "$1" ]; then echo "Cloning repository: $repo_name" git clone "$repo_url" if [ $? -ne 0 ]; then echo "Error cloning $repo_url" exit 1 fi fi echo "Repository '$repo_name' already exists. Pulling latest changes..." cd "$repo_name" && git checkout $branch && git pull && cd .. } branch=${1:-main} cd .. # Iterate through each repository in the list for repo in "${REPOS[@]}"; do clone_repo "$repo" "$branch" done echo "All repositories processed successfully."