Skip to content

Commit

Permalink
'builder.sh' added - local build pipeline runner
Browse files Browse the repository at this point in the history
  • Loading branch information
accetto committed Aug 2, 2021
1 parent 3cc40c0 commit ff34397
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions builder.sh
Original file line number Diff line number Diff line change
@@ -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 $@

0 comments on commit ff34397

Please sign in to comment.