Skip to content

Commit

Permalink
build the binary providing a branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
garikello3d committed Jan 6, 2024
1 parent ef1ad78 commit 44e863c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
6 changes: 3 additions & 3 deletions scripts/build-internal.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

if [ $# -ne 1 ]; then
echo usage $0 \<os_ident\>
if [ $# -ne 2 ]; then
echo usage $0 \<os_ident\> \<branch\>
exit 1
fi

cd /
git clone /src/ bigarchiver && \
git clone --branch $2 --single-branch /src/ bigarchiver && \
cd bigarchiver/ && \
cargo test --release && cargo build --release && \
mkdir -pv /src/scripts/build/$1/ && \
Expand Down
36 changes: 28 additions & 8 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,32 @@

set -e

if [ $# -eq 0 ]; then
echo usage $0 --image\|--app [ os_ident ]
function usage {
printf "to prepare docker build image:\n\t$0 --image [os_ident]\n"
printf "to build the application based on prviousely built image:\n\t$0 --app <branch> [os_ident]\n"
exit 1
}

case $1 in
--image)
OS=$2
ARGS_MAX=2
;;
--app)
BRANCH=$2
OS=$3
ARGS_MAX=3
if [ -z $BRANCH ]; then
usage
fi
;;
*)
usage
exit 3
esac

if [ $# -gt $ARGS_MAX ]; then
usage
fi

cat PLATFORMS | sed '/^#/d;/^[[:space:]]*$/d' | while read LINE; do
Expand All @@ -18,8 +41,8 @@ cat PLATFORMS | sed '/^#/d;/^[[:space:]]*$/d' | while read LINE; do
IMAGE_FROM=${WORDS[1]}
PAC_MGR=${WORDS[2]}

if [ -n "$2" ]; then
if [ x"$IDENT" != x"$2" ] ; then
if [ -n "$OS" ]; then
if [ "x$OS" != "x$IDENT" ]; then
continue
fi
fi
Expand All @@ -32,11 +55,8 @@ cat PLATFORMS | sed '/^#/d;/^[[:space:]]*$/d' | while read LINE; do
;;
--app)
echo building application for $IDENT
docker run -v=.:/src bigarchiver-$IDENT /bin/bash -l -c "/build-internal.sh $IDENT"
docker run -v=.:/src bigarchiver-$IDENT /bin/bash -l -c "/build-internal.sh $IDENT $BRANCH"
;;
*)
echo invalid usage
exit 3
esac
cd scripts
done
Expand Down

0 comments on commit 44e863c

Please sign in to comment.