Repository: bigtop Updated Branches: refs/heads/BIGTOP-2679 575a939a6 -> 44f1d4de9 (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/44f1d4de Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/44f1d4de Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/44f1d4de Branch: refs/heads/BIGTOP-2679 Commit: 44f1d4de99953c9cf205cbce49caa70d241810ad Parents: 2a6343e Author: Olaf Flebbe <[email protected]> Authored: Mon Jan 30 21:49:01 2017 +0100 Committer: Olaf Flebbe <[email protected]> Committed: Mon Jan 30 21:49:01 2017 +0100 ---------------------------------------------------------------------- .dockerignore | 1 - bigtop-ci/create-container.sh | 52 ++++++++++++++++++++++++++++++++++++++ bigtop-ci/entrypoint.sh | 4 +++ bigtop-ci/repo-container.sh | 36 ++++++++++++++++++++++++++ bigtop-ci/run-container.sh | 35 +++++++++++++++++++++++++ 5 files changed, 127 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/44f1d4de/.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/44f1d4de/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..564eafc --- /dev/null +++ b/bigtop-ci/create-container.sh @@ -0,0 +1,52 @@ +#!/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 +RUN chown -R jenkins /var/lib/jenkins/bigtop && sed -i /GRADLE_OPTS/d /etc/profile.d/bigtop.sh +# 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 run --name container-$OS image-$OS -m help + http://git-wip-us.apache.org/repos/asf/bigtop/blob/44f1d4de/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/44f1d4de/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/44f1d4de/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..030a63a --- /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-$$
