From ff3439784393b04e31c270dd8d7e07d132887675 Mon Sep 17 00:00:00 2001 From: accetto <34798830+accetto@users.noreply.github.com> Date: Mon, 2 Aug 2021 17:53:26 +0200 Subject: [PATCH] 'builder.sh' added - local build pipeline runner --- builder.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 builder.sh diff --git a/builder.sh b/builder.sh new file mode 100644 index 0000000..558393d --- /dev/null +++ b/builder.sh @@ -0,0 +1,62 @@ +#!/bin/bash + +main() { + + local blend=${1?Need blend} + local cmd=${2?Need command} + + local log="scrap_builder.log" + + case "${cmd}" in + + pre_build | build | push | post_push ) + + ./docker/hooks/"${cmd}" dev "${blend}" + ;; + + all ) + + ./docker/hooks/pre_build dev "${blend}" > "${log}" + + if [[ $? -eq 0 ]] ; then + + if grep -Po 'new image should be built|Building of new image has been forced' "${log}" ; then + + for c in "build" "push" "post_push" ; do + + echo + echo "-------------" + echo "--> ${c}" + echo "-------------" + echo + + ./docker/hooks/"${c}" dev "${blend}" + + if [[ $? -ne 0 ]] ; then exit ; fi + done + + rm -f "${log}" + + echo + echo "----" + echo "Done" + echo "----" + echo + + else + echo + echo "------------------------------------------------" + echo "No build needed for '${blend}'" + echo "------------------------------------------------" + echo + fi + fi + ;; + + *) + echo "Unknown command: ${cmd}" + ;; + esac +} + +main $@