aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject aurora-packaging git commit: Add a convenience to build all artifacts.
Date Thu, 27 Aug 2015 23:09:34 GMT
Repository: aurora-packaging
Updated Branches:
  refs/heads/master 7ed66ba0c -> 97347155d


Add a convenience to build all artifacts.

Reviewed at https://reviews.apache.org/r/37861/


Project: http://git-wip-us.apache.org/repos/asf/aurora-packaging/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora-packaging/commit/97347155
Tree: http://git-wip-us.apache.org/repos/asf/aurora-packaging/tree/97347155
Diff: http://git-wip-us.apache.org/repos/asf/aurora-packaging/diff/97347155

Branch: refs/heads/master
Commit: 97347155d16bfbbb337a9309c7fa8f9e51b0026a
Parents: 7ed66ba
Author: Bill Farner <wfarner@apache.org>
Authored: Thu Aug 27 16:09:21 2015 -0700
Committer: Bill Farner <wfarner@twitter.com>
Committed: Thu Aug 27 16:09:21 2015 -0700

----------------------------------------------------------------------
 build-artifact.sh | 69 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 45 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora-packaging/blob/97347155/build-artifact.sh
----------------------------------------------------------------------
diff --git a/build-artifact.sh b/build-artifact.sh
index bb24b36..30e4384 100755
--- a/build-artifact.sh
+++ b/build-artifact.sh
@@ -19,34 +19,55 @@ print_available_builders() {
   find builder -name Dockerfile | sed "s/\/Dockerfile$//"
 }
 
-if [[ $# -ne 3 ]]; then
-  echo "usage: $0 BUILDER RELEASE_TAR AURORA_VERSION"
-  echo 'Where BUILDER is a builder directory in:'
-  print_available_builders
-  exit 1
-else
+realpath() {
+  echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
+}
+
+run_build() {
   BUILDER_DIR=$1
   RELEASE_TAR=$2
   AURORA_VERSION=$3
-fi
 
-IMAGE_NAME="aurora-$(basename $BUILDER_DIR)"
-echo "Using docker image $IMAGE_NAME"
-docker build -t "$IMAGE_NAME" "$BUILDER_DIR"
+  IMAGE_NAME="aurora-$(basename $BUILDER_DIR)"
+  echo "Using docker image $IMAGE_NAME"
+  docker build -t "$IMAGE_NAME" "$BUILDER_DIR"
 
-function realpath {
-  echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"
+  ARTIFACT_DIR="$(pwd)/dist/$BUILDER_DIR"
+  mkdir -p $ARTIFACT_DIR
+  docker run \
+    --rm \
+    -e AURORA_VERSION=$AURORA_VERSION \
+    -v "$(pwd)/specs:/specs:ro" \
+    -v "$(realpath $RELEASE_TAR):/src.tar.gz:ro" \
+    -v "$ARTIFACT_DIR:/dist" \
+    -t "$IMAGE_NAME" /build.sh
+
+  echo "Produced artifacts in $ARTIFACT_DIR:"
+  ls $ARTIFACT_DIR
 }
 
-ARTIFACT_DIR="$(pwd)/dist/$BUILDER_DIR"
-mkdir -p $ARTIFACT_DIR
-docker run \
-  --rm \
-  -e AURORA_VERSION=$AURORA_VERSION \
-  -v "$(pwd)/specs:/specs:ro" \
-  -v "$(realpath $RELEASE_TAR):/src.tar.gz:ro" \
-  -v "$ARTIFACT_DIR:/dist" \
-  -t "$IMAGE_NAME" /build.sh
-
-echo "Produced artifacts in $ARTIFACT_DIR:"
-ls $ARTIFACT_DIR
+case $# in
+  2)
+    for builder in $(print_available_builders); do
+      run_build $builder $1 $2
+      echo $builder
+    done
+    ;;
+
+  3)
+    run_build "$@"
+    ;;
+
+  *)
+    echo 'usage:'
+    echo 'to build all artifacts:'
+    echo "  $0 RELEASE_TAR AURORA_VERSION"
+    echo
+    echo 'or to build a specific artifact:'
+    echo "  $0 BUILDER RELEASE_TAR AURORA_VERSION"
+    echo
+    echo 'Where BUILDER is a builder directory in:'
+    print_available_builders
+    exit 1
+    ;;
+esac


Mime
View raw message