Repository: bigtop Updated Branches: refs/heads/BIGTOP-2679 c5c077351 -> ec32048bf (forced update)
BIGTOP-2679: Streamline CI Jobs Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/ec32048b Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/ec32048b Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/ec32048b Branch: refs/heads/BIGTOP-2679 Commit: ec32048bf5794e373db61cc2c3c2dad832b239fe Parents: 2a6343e Author: Olaf Flebbe <[email protected]> Authored: Mon Jan 30 21:49:01 2017 +0100 Committer: Olaf Flebbe <[email protected]> Committed: Tue Jan 31 19:49:29 2017 +0100 ---------------------------------------------------------------------- .dockerignore | 1 - bigtop-ci/create-container.sh | 54 ++++++++++++++++++++++++++++++++++++++ bigtop-ci/entrypoint.sh | 4 +++ bigtop-ci/repo-container.sh | 36 +++++++++++++++++++++++++ bigtop-ci/run-container.sh | 35 ++++++++++++++++++++++++ 5 files changed, 129 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/ec32048b/.dockerignore ---------------------------------------------------------------------- diff --git a/.dockerignore b/.dockerignore index a7b219a..150d143 100644 --- a/.dockerignore +++ b/.dockerignore @@ -15,5 +15,4 @@ build output -bigtop-packages dl http://git-wip-us.apache.org/repos/asf/bigtop/blob/ec32048b/bigtop-ci/create-container.sh ---------------------------------------------------------------------- diff --git a/bigtop-ci/create-container.sh b/bigtop-ci/create-container.sh new file mode 100755 index 0000000..9edb5c1 --- /dev/null +++ b/bigtop-ci/create-container.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +while [[ $# -gt 1 ]] +do +key="$1" +case $key in + -t|--target) + TARGET="$2" + shift + ;; + -o|--os) + OS="$2" + shift + ;; + -n|--nexus) + NEXUS="--net=container:nexus" + CONFIGURE_NEXUS="configure-nexus" + shift + ;; + *) + echo "usage build.sh --os debian-8|centos-7|... --target hadoop|tez|..." + exit 1 # unknown option + ;; +esac +shift +done + +# prepare source image +cat >Dockerfile <<EOF +FROM bigtop/slaves:$OS +# copy source to container +COPY . /var/lib/jenkins/bigtop +# make it belong to compile account +# disable gradle daemon +# create output dir (for docker cp) +RUN chown -R jenkins /var/lib/jenkins/bigtop && sed -i /GRADLE_OPTS/d /etc/profile.d/bigtop.sh && mkdir -p /var/lib/jenkins/bigtop/output +# define default user jenkins +USER jenkins +WORKDIR /var/lib/jenkins/bigtop +ENTRYPOINT [ "bigtop-ci/entrypoint.sh" ] +# initialize gradle +RUN bigtop-ci/entrypoint.sh +# make it a volume, performancewise +VOLUME /var/lib/jenkins +EOF + +# build source image +docker build -t image-$OS . + +# This container collects all the output +# use gradle option "-m" +docker rm -f container-$OS || true +docker run --name container-$OS image-$OS -m help + http://git-wip-us.apache.org/repos/asf/bigtop/blob/ec32048b/bigtop-ci/entrypoint.sh ---------------------------------------------------------------------- diff --git a/bigtop-ci/entrypoint.sh b/bigtop-ci/entrypoint.sh new file mode 100755 index 0000000..cab665e --- /dev/null +++ b/bigtop-ci/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +. /etc/profile.d/bigtop.sh +exec ./gradlew "$@" http://git-wip-us.apache.org/repos/asf/bigtop/blob/ec32048b/bigtop-ci/repo-container.sh ---------------------------------------------------------------------- diff --git a/bigtop-ci/repo-container.sh b/bigtop-ci/repo-container.sh new file mode 100755 index 0000000..24d410d --- /dev/null +++ b/bigtop-ci/repo-container.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +while [[ $# -gt 1 ]] +do +key="$1" +case $key in + -t|--target) + TARGET="$2" + shift + ;; + -o|--os) + OS="$2" + shift + ;; + -n|--nexus) + NEXUS="--net=container:nexus" + CONFIGURE_NEXUS="configure-nexus" + shift + ;; + *) + echo "usage build.sh --os debian-8|centos-7|... --target hadoop|tez|..." + exit 1 # unknown option + ;; +esac +shift +done + +docker commit container-$OS repo-$OS +case $OS in +*debian*|*ubuntu*) R=apt;; +*) R=yum;; +esac +docker run --name repo-container-$OS repo-$OS $R +mkdir -p output +docker cp repo-container-$OS:/var/lib/jenkins/bigtop/output . +docker rm -v repo-container-$OS http://git-wip-us.apache.org/repos/asf/bigtop/blob/ec32048b/bigtop-ci/run-container.sh ---------------------------------------------------------------------- diff --git a/bigtop-ci/run-container.sh b/bigtop-ci/run-container.sh new file mode 100755 index 0000000..8f27617 --- /dev/null +++ b/bigtop-ci/run-container.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +while [[ $# -gt 1 ]] +do +key="$1" +case $key in + -t|--target) + TARGET="$2" + shift + ;; + -o|--os) + OS="$2" + shift + ;; + -n|--nexus) + NEXUS="--net=container:nexus" + CONFIGURE_NEXUS="configure-nexus" + shift + ;; + *) + echo "usage build.sh --os debian-8|centos-7|... --target hadoop|tez|..." + exit 1 # unknown option + ;; +esac +shift +done + +docker run --name container-$OS-$TARGET-$$ $NEXUS image-$OS $CONFIGURE_NEXUS $TARGET-pkg + +# save output +mkdir -p output +docker cp container-$OS-$TARGET-$$:/var/lib/jenkins/bigtop/output . +# copy to results container +docker cp output/ container-$OS:/var/lib/jenkins/bigtop/output +docker rm -v container-$OS-$TARGET-$$
