You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by ev...@apache.org on 2019/01/30 07:38:32 UTC
[bigtop] branch master updated: BIGTOP-3149. Support to enable
Nexus proxy for Docker Provisioner (#457)
This is an automated email from the ASF dual-hosted git repository.
evansye pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bigtop.git
The following commit(s) were added to refs/heads/master by this push:
new aa79a9c BIGTOP-3149. Support to enable Nexus proxy for Docker Provisioner (#457)
aa79a9c is described below
commit aa79a9cfa985e0d113083ffcc20f040f1199d390
Author: Evans Ye <ev...@apache.org>
AuthorDate: Wed Jan 30 15:38:27 2019 +0800
BIGTOP-3149. Support to enable Nexus proxy for Docker Provisioner (#457)
---
build.gradle | 21 +++++++++++++++++----
provisioner/docker/docker-hadoop.sh | 27 ++++++++++++++++++++++++++-
2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/build.gradle b/build.gradle
index a925be0..3674750 100644
--- a/build.gradle
+++ b/build.gradle
@@ -412,16 +412,29 @@ task "configure-nexus"(dependsOn: tasks.findAll { alltask -> alltask.name.starts
' Use -PNEXUS_USERPASS=user:passwd to overwrite default username passwd admin:admin123') doLast {
def m2Dir = System.getProperty("user.home") + "/.m2"
mkdir(m2Dir)
- def writer = new File(m2Dir + "/settings.xml")
+ def m2Writer = new File(m2Dir + "/settings.xml")
def writeMirrorLine = { name ->
- writer.append("<mirror><name>$name</name><url>$_NEXUS_URL/content/repositories/$name/</url><mirrorOf>$name</mirrorOf></mirror>")
+ m2Writer.append("<mirror><name>$name</name><url>$_NEXUS_URL/content/repositories/$name/</url><mirrorOf>$name</mirrorOf></mirror>")
}
- writer.text = "<settings><mirrors>"
+ m2Writer.text = "<settings><mirrors>"
writeMirrorLine( "central")
repos.each{ r->
writeMirrorLine( r.name)
}
- writer.append("</mirrors></settings>")
+ m2Writer.append("</mirrors></settings>")
+
+ def gradleDir = System.getProperty("user.home") + "/.gradle/init.d"
+ mkdir(gradleDir)
+ def gradleWriter = new File(gradleDir + "/bigtop_nexus.gradle")
+ gradleWriter.text = """
+allprojects {
+ repositories {
+ maven {
+ url "$_NEXUS_URL/content/repositories/central"
+ }
+ }
+}
+ """
}
task "bigtop-puppet"(type:Exec,
diff --git a/provisioner/docker/docker-hadoop.sh b/provisioner/docker/docker-hadoop.sh
index e53da15..5bfca48 100755
--- a/provisioner/docker/docker-hadoop.sh
+++ b/provisioner/docker/docker-hadoop.sh
@@ -16,7 +16,7 @@
# limitations under the License.
usage() {
- echo "usage: $PROG [-C file ] args"
+ echo "usage: $PROG [-C file] args"
echo " -C file Use alternate file for config.yaml"
echo " commands:"
echo " -c NUM_INSTANCES, --create NUM_INSTANCES Create a Docker based Bigtop Hadoop cluster"
@@ -27,6 +27,9 @@ usage() {
echo " -E, --env-check Check whether required tools has been installed"
echo " -l, --list List out container status for the cluster"
echo " -p, --provision Deploy configuration changes"
+ echo " -n, --nexus [NEXUS_URL] Configure Nexus proxy to speed up test execution"
+ echo " If no NEXUS_URL specified, default to http://NEXUS_IP:8081/nexus,"
+ echo " where NEXUS_IP is the ip of the container named nexus"
echo " -s, --smoke-tests Run Bigtop smoke tests"
echo " -h, --help"
exit 1
@@ -192,6 +195,14 @@ log() {
echo -e "\n[LOG] $1\n"
}
+configure-nexus() {
+ for node in ${NODES[*]}; do
+ docker exec $node bash -c "cd /bigtop-home; ./gradlew -PNEXUS_URL=$1 configure-nexus"
+ done
+ wait
+}
+
+
PROG=`basename $0`
if [ $# -eq 0 ]; then
@@ -242,6 +253,20 @@ while [ $# -gt 0 ]; do
-l|--list)
list
shift;;
+ -n|--nexus)
+ if [ $# -lt 2 ] || [[ $2 == -* ]]; then
+ NEXUS_IP=`docker inspect --format "{{.NetworkSettings.IPAddress}}" nexus`
+ if [ $? != 0 ]; then
+ log "No container named nexus exists. To create one:\n $ docker run -d --name nexus sonatype/nexus"
+ exit 1
+ fi
+ configure-nexus "http://$NEXUS_IP:8081/nexus"
+ shift
+ else
+ configure-nexus $2
+ shift 2
+ fi
+ ;;
-p|--provision)
provision
shift;;