public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>
Subject: [PATCH 3/3] scripts/ci_build: Make CI script more generic
Date: Tue,  1 May 2018 20:55:11 +0300	[thread overview]
Message-ID: <20180501175511.26145-4-asmirnov@ilbers.de> (raw)
In-Reply-To: <20180501175511.26145-1-asmirnov@ilbers.de>

Make this script more generic, so it could be used by any CI and by user
as well. Also add parameter to specify build folder.

Usage:
  ci_build [-v] -b BUILD_DIR

And this command will build all the default Isar images.

Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 scripts/ci_build.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 55 insertions(+), 11 deletions(-)

diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index e941f8c..6b5871e 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -1,28 +1,72 @@
-# Script for Jenkins build
+# Script for CI system build
 #
 # Alexander Smirnov <asmirnov@ilbers.de>
-# Copyright (c) 2016-2017 ilbers GmbH
+# Copyright (c) 2016-2018 ilbers GmbH
 
 #!/bin/sh
 
+ES_BUG=3
+
 # Export $PATH to use 'parted' tool
 export PATH=$PATH:/sbin
 
-# Get parameters from the command line
-WORKSPACE=$1
-GIT_COMMIT=$2
-
 # Go to Isar root
 cd $(dirname $0)/..
 
-# Setup build folder for current revision
-if [ ! -d /build/$WORKSPACE/$GIT_COMMIT ]; then
-        mkdir -p /build/$WORKSPACE/$GIT_COMMIT
+# Start build in Isar tree by default
+BUILD_DIR=./build
+
+show_help() {
+    echo "This script builds all the default Isar images."
+    echo
+    echo "Usage:"
+    echo "    $0 [params]"
+    echo
+    echo "Parameters:"
+    echo "    -b, --build BUILD_DIR set path to build directory. If not set,"
+    echo "                          the build will be started in current path."
+    echo "    -v, --verbose         set verbose level of bitbake output."
+    echo "    --help                display this message and exit."
+    echo
+    echo "Exit status:"
+    echo " 0  if OK,"
+    echo " 3  if invalid parameters are passed."
+}
+
+# Parse command line to get user configuration
+while [ $# -gt 0 ]
+do
+    key="$1"
+
+    case $key in
+    -h|--help)
+        show_help
+        exit 0
+        ;;
+    -b|--build)
+        BUILD_DIR="$2"
+        shift
+        ;;
+    -v|--verbose)
+        BB_ARGS="$BB_ARGS -v"
+        ;;
+    *)
+        echo "error: invalid parameter '$key', please try '--help' to get list of supported parameters"
+        exit $ES_BUG
+        ;;
+    esac
+
+    shift
+done
+
+# Setup build folder for the current build
+if [ ! -d $BUILD_DIR ]; then
+        mkdir -p $BUILD_DIR
 fi
-source isar-init-build-env /build/$WORKSPACE/$GIT_COMMIT
+source isar-init-build-env $BUILD_DIR
 
 # Start build for all possible configurations
-bitbake -v \
+bitbake $BB_ARGS \
         multiconfig:qemuarm-wheezy:isar-image-base \
         multiconfig:qemuarm-jessie:isar-image-base \
         multiconfig:qemuarm-stretch:isar-image-base \
-- 
2.1.4


  parent reply	other threads:[~2018-05-01 17:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 17:55 [PATCH 0/3] Update scripts Alexander Smirnov
2018-05-01 17:55 ` [PATCH 1/3] scripts/vm_smoke_test: Add verbosity parameter Alexander Smirnov
2018-05-02  8:30   ` Henning Schild
2018-05-01 17:55 ` [PATCH 2/3] scripts/vm_smoke_test: Check if QEMU didn't start Alexander Smirnov
2018-05-02  8:36   ` Henning Schild
2018-05-01 17:55 ` Alexander Smirnov [this message]
2018-05-02  8:39   ` [PATCH 3/3] scripts/ci_build: Make CI script more generic Henning Schild
2018-05-02  8:42 ` [PATCH 0/3] Update scripts Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180501175511.26145-4-asmirnov@ilbers.de \
    --to=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox