#!/bin/bash # Adds all selected Azure repos as submodules into this container. # Uses --reference to local clones in AnalisiMig/isypol2-project-rag to avoid re-downloading objects. set -u RAG_MODULES="/c/Users/Luigi1/Desktop/AnalisiMig/isypol2-project-rag/.git/modules/projects" LOG="$(pwd)/.add-submodules.log" : > "$LOG" # Format per riga: # org = Isypol → be-isypol # org = BeTransformation → be-transformation REPOS=$(cat <<'EOF' BeTransformation Security IAM BeTransformation Security Profile BeTransformation Security Security BeTransformation Payment PaymentAddebitoDirettoCA BeTransformation Payment PaymentAddebitoDirettoContract BeTransformation Payment PaymentCash BeTransformation Payment PaymentEventContract BeTransformation Payment PaymentManager BeTransformation Events EventDispatcher BeTransformation Events EventScheduleAndMonitor BeTransformation Events FileManager BeTransformation Document BeyhondDoc-image BeTransformation Document BeyhondDocPublish BeTransformation Document DocumentArchiver BeTransformation Document DocumentChecklist BeTransformation Document DocumentContract BeTransformation Document DocumentGenerator BeTransformation Document DocumentGeneratorBdoc BeTransformation Document DocumentGeneratorContract BeTransformation Document DocumentGeneratorIsy1 BeTransformation Document DocumentSignature BeTransformation Document DocumentStore BeTransformation Comunication ComunicationManager BeTransformation Common BeyondocSimulator BeTransformation Common ConfigManager BeTransformation Common Contabilita BeTransformation Common Domain BeTransformation Common EspressionLanguage BeTransformation Common Language BeTransformation Common LanguageSqlGenerator BeTransformation Common LiquibaseFilter BeTransformation Common MicroFrontendCommons BeTransformation Common QuarkusArchetype BeTransformation Common survey BeTransformation Common workflow BeTransformation Campain CampainManager Isypol ProcessoVendita CoherenceService Isypol ProcessoVendita Dossier Isypol ProcessoVendita DossierInitializer Isypol ProcessoVendita PostVendita Isypol Anagrafe Anagrafe Isypol Anagrafe AnagrafeConnector Isypol Anagrafe AnagrafeConnectorCA Isypol Anagrafe AnagrafeConnectorContract Isypol Anagrafe AnagrafeConnectorDev Isypol Anagrafe AnagrafeConnectorIsy1 Isypol Anagrafe AnagrafeGestore Isypol Anagrafe AnagrafeGestoreSimulator Isypol Anagrafe AnagrafeSql Isypol Anagrafe GestoriFlussoManager Isypol Anagrafe ServizioConsRappAnagrafeConnecDev Isypol Anagrafe ServizioConsRappAnagrafeConnector Isypol Anagrafe ServizioConsRappAnagrafeContract Isypol Batch DWH Isypol CreditAgricole APISimulator Isypol CreditAgricole AnagrafeSqlReport Isypol CreditAgricole Anonimizzatore Isypol CreditAgricole BE4API Isypol CreditAgricole CABL Isypol CreditAgricole CACartaceoService Isypol CreditAgricole CAData Isypol CreditAgricole CADocuemntSignatureOTP Isypol CreditAgricole CADocuemntSignatureOTPSimulator Isypol CreditAgricole CAInfoSinistri Isypol CreditAgricole CAJbpm Isypol CreditAgricole CAJbpmSimulator Isypol CreditAgricole CASIS Isypol CreditAgricole CAWSO2Simulator Isypol CreditAgricole CaWso2TokenSimulator Isypol CreditAgricole ConnectorTester Isypol CreditAgricole ContabilitaReport Isypol CreditAgricole DWHReport Isypol CreditAgricole Dynatrace Isypol CreditAgricole FreeBridge Isypol CreditAgricole NRT_CA Isypol CreditAgricole PSASimulator Isypol CreditAgricole PaymentAddebitoDirettoCASimulator Isypol CreditAgricole PreventivatoreAuto Isypol CreditAgricole SDUConnector Isypol CreditAgricole SDUSimulator Isypol FabricaProdotto FabricaProdotto Isypol Polizze Polizze Isypol Pricing PricingManager EOF ) TOTAL=$(echo "$REPOS" | wc -l | tr -d ' ') i=0 ok=0 fail=0 while IFS=' ' read -r ORG AREA REPO; do i=$((i+1)) if [ "$ORG" = "Isypol" ]; then REF="$RAG_MODULES/be-isypol/modules/$AREA/$REPO" SRC_WORKTREE="/c/Users/Luigi1/Desktop/AnalisiMig/isypol2-project-rag/projects/be-isypol/$AREA/$REPO" else REF="$RAG_MODULES/be-transformation/modules/$AREA/$REPO" SRC_WORKTREE="/c/Users/Luigi1/Desktop/AnalisiMig/isypol2-project-rag/projects/be-transformation/$AREA/$REPO" fi URL="git@ssh.dev.azure.com:v3/$ORG/$AREA/$REPO" PATH_IN_CONTAINER="$AREA/$REPO" printf "[%d/%d] %s " "$i" "$TOTAL" "$PATH_IN_CONTAINER" if [ -d "$PATH_IN_CONTAINER/.git" ] || [ -f "$PATH_IN_CONTAINER/.git" ]; then echo "... SKIP (already present)" ok=$((ok+1)) continue fi if [ ! -d "$REF" ]; then echo "... FAIL (reference missing: $REF)" | tee -a "$LOG" fail=$((fail+1)) continue fi BRANCH=$(git -C "$SRC_WORKTREE" branch --show-current 2>/dev/null) if [ -z "$BRANCH" ]; then BRANCH=$(git -C "$SRC_WORKTREE" symbolic-ref --short HEAD 2>/dev/null) fi if [ -z "$BRANCH" ]; then echo "... FAIL (cannot detect local branch in $SRC_WORKTREE)" | tee -a "$LOG" fail=$((fail+1)) continue fi printf "[branch=%s] ... " "$BRANCH" if git submodule add --reference "$REF" -b "$BRANCH" "$URL" "$PATH_IN_CONTAINER" >>"$LOG" 2>&1; then echo "OK" ok=$((ok+1)) else echo "FAIL (see $LOG)" fail=$((fail+1)) fi done <<< "$REPOS" echo "" echo "Done. OK=$ok FAIL=$fail TOTAL=$TOTAL"