Initiale Version des Scriptings zur automatisch Aktualisierung der Übung
authorKai Moritz <kai@juplo.de>
Tue, 14 Dec 2021 17:55:02 +0000 (18:55 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 28 Oct 2024 06:41:36 +0000 (07:41 +0100)
BRANCHES.sh [new file with mode: 0755]
BUILD.sh [new file with mode: 0755]
DIFF.sh [new file with mode: 0755]
PUSH.sh [new file with mode: 0755]
REBASE.sh [new file with mode: 0755]
RESET.sh [new file with mode: 0755]

diff --git a/BRANCHES.sh b/BRANCHES.sh
new file mode 100755 (executable)
index 0000000..ca40dc1
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+set -e
+
+config__flawed_setup__zookeeper=config/flawed-setup--zookeeper
+config__flawed_setup__zookeeper__ROOT=grundlagen/docker
+grundlagen__simple_producer=grundlagen/simple-producer
+grundlagen__simple_producer__ROOT=grundlagen/docker
+grundlagen__simple_producer__vorlage=grundlagen/simple-producer--vorlage
+grundlagen__simple_producer__vorlage__ROOT=grundlagen/simple-producer
+grundlagen__simple_consumer=grundlagen/simple-consumer
+grundlagen__simple_consumer__ROOT=grundlagen/simple-producer
+grundlagen__simple_consumer__vorlage=grundlagen/simple-consumer--vorlage
+grundlagen__simple_consumer__vorlage__ROOT=grundlagen/simple-consumer
+producer__spring_producer=producer/spring-producer
+producer__spring_producer__ROOT=grundlagen/simple-producer
+producer__rest_producer=producer/rest-producer
+producer__rest_producer__ROOT=producer/spring-producer
+consumer__spring_consumer=consumer/spring-consumer
+consumer__spring_consumer__ROOT=grundlagen/simple-consumer
+
+BRANCHES="\
+  config__flawed_setup__zookeeper \
+  grundlagen__simple_producer \
+  grundlagen__simple_producer__vorlage \
+  grundlagen__simple_consumer \
+  grundlagen__simple_consumer__vorlage \
+  producer__spring_producer \
+  producer__rest_producer \
+  consumer__spring_consumer \
+  "
diff --git a/BUILD.sh b/BUILD.sh
new file mode 100755 (executable)
index 0000000..abc5e00
--- /dev/null
+++ b/BUILD.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -e
+
+source BRANCHES.sh
+
+for i in $BRANCHES;
+do
+  declare -n branch=${i}
+  git checkout $branch
+  if [ -e 'pom.xml' ]
+  then
+    if [[ $branch =~ "--vorlage" ]]
+    then
+      echo -e "\nIgnoriere Vorlage...\n"
+    else
+      echo -e "\nBuilding $branch"
+      ./README.sh build
+      echo -e "\nPushing Docker image for $branch"
+      mvn docker:push
+    fi
+  else
+    echo -e "\nIgnoriere Branch $branch ohne Projekt...\n"
+  fi
+done
diff --git a/DIFF.sh b/DIFF.sh
new file mode 100755 (executable)
index 0000000..a2f25cf
--- /dev/null
+++ b/DIFF.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e
+
+source BRANCHES.sh
+
+for i in $BRANCHES;
+do
+  declare -n branch=${i}
+  echo -e "\nDiff from $branch against origin/$branch\n"
+  git diff $branch origin/$branch
+done
diff --git a/PUSH.sh b/PUSH.sh
new file mode 100755 (executable)
index 0000000..5c2d521
--- /dev/null
+++ b/PUSH.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+set -e
+
+source BRANCHES.sh
+
+for i in $BRANCHES;
+do
+  declare -n branch=${i}
+  echo -e "\nPushing $branch over origin/$branch"
+  git tag -f ${branch}--BACKUP-ORIGIN--$(date +'%Y-%m-%d--%H-%M-%S') origin/$branch
+  git tag -f ${branch}--BACKUP-ORIGIN--LAST origin/$branch
+  git push --force  origin $branch:$branch
+done
diff --git a/REBASE.sh b/REBASE.sh
new file mode 100755 (executable)
index 0000000..1abcb78
--- /dev/null
+++ b/REBASE.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+
+source BRANCHES.sh
+
+for i in $BRANCHES;
+do
+  declare -n root=${i}__ROOT
+  declare -n branch=${i}
+  echo -e "\nRebasing $branch on $root"
+  git rebase -i $root $branch;
+done
diff --git a/RESET.sh b/RESET.sh
new file mode 100755 (executable)
index 0000000..e22090a
--- /dev/null
+++ b/RESET.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+
+source BRANCHES.sh
+
+for i in $BRANCHES;
+do
+  declare -n branch=${i}
+  echo -e "\nResetting $branch to origin/$branch\n\n"
+  git checkout $branch 
+  git reset --hard origin/$branch;
+done