declare -n branch=${i}
git checkout "$branch"
- if [[ "$branch" =~ "--vorlage" ]]; then
+ if [[ "$branch" == *--vorlage ]]; then
echo -e "\nIgnoriere Vorlage: $branch\n"
continue
fi
mvn clean install
if $PUBLISH; then
echo -e "\nVeröffentliche Docker-Image für $branch"
- if [[ "$branch" =~ "grundlagen/" ]]; then
+ if [[ "$branch" == grundlagen/* ]]; then
mvn jib:build
else
mvn spring-boot:build-image -Dspring-boot.build-image.publish=true
source branches.sh
-for i in grundlagen__docker $BRANCHES;
-do
+TIMESTAMP=$(date +'%Y-%m-%d--%H-%M-%S')
+
+for i in grundlagen__docker $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 || echo "origin/$branch existiert (noch) nicht!"
- git tag -f ${branch}--BACKUP-ORIGIN--LAST origin/$branch || echo "origin/$branch existiert (noch) nicht!"
- git push --force origin $branch:$branch
+ git tag -f "${branch}--BACKUP-ORIGIN--${TIMESTAMP}" "origin/$branch" || echo "origin/$branch existiert (noch) nicht!"
+ git tag -f "${branch}--BACKUP-ORIGIN--LAST" "origin/$branch" || echo "origin/$branch existiert (noch) nicht!"
+ git push --force origin "$branch:$branch"
done
source branches.sh
-if [ "$1" == "" ]
-then
- echo "No Tag-Prefix specified: Resetting to remote branches"
- for i in grundlagen__docker $BRANCHES
- do
- declare -n branch=${i}
- echo -e "\nResetting $branch to origin/$branch\n\n"
- git checkout $branch
- git reset --hard origin/$branch
- done
-else
- for i in grundlagen__docker $BRANCHES
- do
- declare -n branch=${i}
- echo -e "\nResetting $branch to tag ${branch}--$1\n"
- git checkout $branch
- git reset --hard ${branch}--$1
- done
-fi
+[ "$1" = "" ] && echo "No Tag-Prefix specified: Resetting to remote branches"
+
+for i in grundlagen__docker $BRANCHES; do
+ declare -n branch=${i}
+ if [ "$1" = "" ]; then
+ ref="origin/$branch"
+ else
+ ref="${branch}--$1"
+ fi
+ echo -e "\nResetting $branch to $ref"
+ git checkout "$branch"
+ git reset --hard "$ref"
+done
git checkout scripting