ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject ambari git commit: AMBARI-8438 ambari build in docker to open Java debug port. (jaoki)
Date Wed, 26 Nov 2014 22:20:35 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk aebd5c0b3 -> 501785fa5


AMBARI-8438 ambari build in docker to open Java debug port. (jaoki)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/501785fa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/501785fa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/501785fa

Branch: refs/heads/trunk
Commit: 501785fa532525dbae61ca69f6e6a5098577862a
Parents: aebd5c0
Author: Jun Aoki <jaoki@apache.org>
Authored: Wed Nov 26 14:20:25 2014 -0800
Committer: Jun Aoki <jaoki@apache.org>
Committed: Wed Nov 26 14:20:25 2014 -0800

----------------------------------------------------------------------
 dev-support/docker/README.md                    |  8 ++--
 dev-support/docker/docker/Dockerfile            |  1 +
 dev-support/docker/docker/bin/ambaribuild.py    | 42 ++++++++++++++++++--
 .../docker/docker/bin/test/ambaribuild_test.py  | 16 +++++++-
 4 files changed, 58 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/501785fa/dev-support/docker/README.md
----------------------------------------------------------------------
diff --git a/dev-support/docker/README.md b/dev-support/docker/README.md
index 6613e0d..fedfd50 100644
--- a/dev-support/docker/README.md
+++ b/dev-support/docker/README.md
@@ -17,7 +17,7 @@ how to build
 --------------------
 
 ```
-docker build -t ambari/build ./docker
+docker build -t ambari/build ./dev-support/docker/docker
 ```
 
 how to run
@@ -32,19 +32,21 @@ docker run --privileged -t -i -p 80:80 -p 5005:5005 -p 8080:8080 -h node1.mydoma
 # build, install ambari and deploy hadoop in container
 cd {ambari src}
 docker rm ambari1
-docker run --privileged -t -p 80:80 -p 5005:5005 -p 8080:8080 -h node1.mydomain.com --name
ambari1 -v ${AMBARI_SRC:-$(pwd)}:/tmp/ambari ambari/build /tmp/ambari-build-docker/bin/ambaribuild.py
[test|server|agent|deploy] [-b] [-s [HDP|BIGTOP|PHD]]
+docker run --privileged -t -p 80:80 -p 5005:5005 -p 8080:8080 -h node1.mydomain.com --name
ambari1 -v ${AMBARI_SRC:-$(pwd)}:/tmp/ambari ambari/build /tmp/ambari-build-docker/bin/ambaribuild.py
[test|server|agent|deploy] [-b] [-s [HDP|BIGTOP|PHD]] [-d] [-c]
 where
 test: mvn test
 server: install and run ambari-server
 agent: install and run ambari-server and ambari-agent
 deploy: install and run ambari-server and ambari-agent, and deploy a hadoop
 -b option to rebuild ambari
+-d option to start ambari-server with --debug option
+-c option to clean local git repo. "git clean -xdf"
 ```
 
 how to run unit test
 --------------------
 ```
-cd docker
+cd dev-support/docker/docker
 python -m bin.test.ambaribuild_test
 
 ```

http://git-wip-us.apache.org/repos/asf/ambari/blob/501785fa/dev-support/docker/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/dev-support/docker/docker/Dockerfile b/dev-support/docker/docker/Dockerfile
index 96ba8ff..bd2c1f4 100644
--- a/dev-support/docker/docker/Dockerfile
+++ b/dev-support/docker/docker/Dockerfile
@@ -15,6 +15,7 @@ FROM centos:centos6
 RUN echo root:changeme | chpasswd
 
 ## Install some basic utilities that aren't in the default image
+RUN yum clean all -y && yum update -y
 RUN yum -y install vim wget rpm-build sudo which telnet tar openssh-server openssh-clients
ntp git python-setuptools httpd
 # phantomjs dependency
 RUN yum -y install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6

http://git-wip-us.apache.org/repos/asf/ambari/blob/501785fa/dev-support/docker/docker/bin/ambaribuild.py
----------------------------------------------------------------------
diff --git a/dev-support/docker/docker/bin/ambaribuild.py b/dev-support/docker/docker/bin/ambaribuild.py
index 66df31f..50db0e2 100755
--- a/dev-support/docker/docker/bin/ambaribuild.py
+++ b/dev-support/docker/docker/bin/ambaribuild.py
@@ -14,6 +14,7 @@
 
 import subprocess, time, sys
 import json
+import datetime
 from optparse import OptionParser
 
 SKIP_TEST="-DskipTests"
@@ -29,14 +30,12 @@ def git_deep_cleaning():
 	return proc.wait()
 
 def ambariUnitTest():
-	git_deep_cleaning()
 	proc = subprocess.Popen("mvn -fae clean install",
 			shell=True,
 			cwd="/tmp/ambari")
 	return proc.wait()
 
 def buildAmbari(stack_distribution):
-	git_deep_cleaning()
 	stack_distribution_param = ""
 	if stack_distribution is not None:
 		stack_distribution_param = "-Dstack.distribution=" + stack_distribution
@@ -134,35 +133,57 @@ def create_cluster():
 
 # Loop to not to exit Docker container
 def no_exit():
+	print ""
 	print "loop to not to exit docker container..."
+	print ""
 	while True:
 		time.sleep(NO_EXIT_SLEEP_TIME)
 
 class ParseResult:
+	is_deep_clean = False
 	is_rebuild = False
 	stack_distribution = None
 	is_test = False
 	is_install_server = False
 	is_install_agent = False
 	is_deploy = False
+	is_server_debug = False
 
 def parse(argv):
 	result = ParseResult()
 	if len(argv) >=2:
 		parser = OptionParser()
+		parser.add_option("-c", "--clean",
+				dest="is_deep_clean",
+				action="store_true",
+				default=False,
+				help="if this option is set, git clean -xdf is executed for the ambari local git repo")
+
 		parser.add_option("-b", "--rebuild",
 				dest="is_rebuild",
 				action="store_true",
 				default=False,
 				help="set this flag if you want to rebuild Ambari code")
+
 		parser.add_option("-s", "--stack_distribution",
 				dest="stack_distribution",
 				help="set a stack distribution. [HDP|PHD|BIGTOP]. Make sure -b is also set when you set
a stack distribution")
+
+		parser.add_option("-d", "--server_debug",
+				dest="is_server_debug",
+				action="store_true",
+				default=False,
+				help="set a debug option for ambari-server")
+
 		(options, args) = parser.parse_args(argv[1:])
+		if options.is_deep_clean:
+			result.is_deep_clean = True
 		if options.is_rebuild:
 			result.is_rebuild = True
 		if options.stack_distribution:
 			result.stack_distribution = options.stack_distribution
+		if options.is_server_debug:
+			result.is_server_debug = True
 
 	if argv[0] == "test":
 		result.is_test = True
@@ -187,6 +208,8 @@ if __name__ == "__main__":
 		print "specify one of test, server, agent or deploy"
 		sys.exit(1)
 
+	start = datetime.datetime.utcnow()
+
 	# test: execute unit test
 	# server: install ambari-server
 	#    with or without rebuild
@@ -197,8 +220,15 @@ if __name__ == "__main__":
 
 	parsed_args = parse(sys.argv[1:])
 
+	if parsed_args.is_deep_clean:
+		retcode = git_deep_cleaning()
+		if retcode != 0: sys.exit(retcode)
+
 	if parsed_args.is_test:
 		retcode = ambariUnitTest()
+		end = datetime.datetime.utcnow()
+		print ""
+		print "Duration: " + str((end-start).seconds) + " seconds"
 		sys.exit(retcode)
 
 	if parsed_args.is_rebuild:
@@ -210,7 +240,7 @@ if __name__ == "__main__":
 		if retcode != 0: sys.exit(retcode)
 		retcode = setup_ambari_server()
 		if retcode != 0: sys.exit(retcode)
-		retcode = start_ambari_server()
+		retcode = start_ambari_server(parsed_args.is_server_debug)
 		if retcode != 0: sys.exit(retcode)
 		retcode = start_dependant_services()
 		if retcode != 0: sys.exit(retcode)
@@ -229,5 +259,9 @@ if __name__ == "__main__":
 		retcode = create_cluster()
 		if retcode != 0: sys.exit(retcode)
 
-	no_exit()
+	end = datetime.datetime.utcnow()
 
+	print ""
+	print "Duration: " + str((end-start).seconds) + " seconds"
+	print "Parameters: " + str(sys.argv)
+	no_exit()

http://git-wip-us.apache.org/repos/asf/ambari/blob/501785fa/dev-support/docker/docker/bin/test/ambaribuild_test.py
----------------------------------------------------------------------
diff --git a/dev-support/docker/docker/bin/test/ambaribuild_test.py b/dev-support/docker/docker/bin/test/ambaribuild_test.py
index 223fa98..a324f5f 100755
--- a/dev-support/docker/docker/bin/test/ambaribuild_test.py
+++ b/dev-support/docker/docker/bin/test/ambaribuild_test.py
@@ -18,52 +18,64 @@ from bin import ambaribuild
 def unittest():
 	# parse
 	result = ambaribuild.parse(["test"])
+	assert result.is_deep_clean == False
 	assert result.is_test == True
 	assert result.is_rebuild == False
 	assert result.stack_distribution == None
 	assert result.is_install_server == False
 	assert result.is_install_agent == False
 	assert result.is_deploy == False
+	assert result.is_server_debug == False
 
 	result = ambaribuild.parse(["server"])
+	assert result.is_deep_clean == False
 	assert result.is_test == False
 	assert result.is_rebuild == False
 	assert result.stack_distribution == None
 	assert result.is_install_server == True
 	assert result.is_install_agent == False
 	assert result.is_deploy == False
+	assert result.is_server_debug == False
 
 	result = ambaribuild.parse(["agent"])
+	assert result.is_deep_clean == False
 	assert result.is_test == False
 	assert result.is_rebuild == False
 	assert result.stack_distribution == None
 	assert result.is_install_server == True
 	assert result.is_install_agent == True
 	assert result.is_deploy == False
+	assert result.is_server_debug == False
 
 	result = ambaribuild.parse(["agent", "-b"])
+	assert result.is_deep_clean == False
 	assert result.is_test == False
 	assert result.is_rebuild == True
 	assert result.stack_distribution == None
 	assert result.is_install_server == True
 	assert result.is_install_agent == True
 	assert result.is_deploy == False
+	assert result.is_server_debug == False
 
-	result = ambaribuild.parse(["deploy"])
+	result = ambaribuild.parse(["deploy", "-d"])
+	assert result.is_deep_clean == False
 	assert result.is_test == False
 	assert result.is_rebuild == False
 	assert result.stack_distribution == None
 	assert result.is_install_server == True
 	assert result.is_install_agent == True
 	assert result.is_deploy == True
+	assert result.is_server_debug == True
 
-	result = ambaribuild.parse(["deploy", "-b", "-s", "BIGTOP"])
+	result = ambaribuild.parse(["deploy", "-b", "-s", "BIGTOP", "-d", "-c"])
+	assert result.is_deep_clean == True
 	assert result.is_test == False
 	assert result.is_rebuild == True
 	assert result.stack_distribution == "BIGTOP"
 	assert result.is_install_server == True
 	assert result.is_install_agent == True
 	assert result.is_deploy == True
+	assert result.is_server_debug == True
 
 if __name__ == "__main__":
 	unittest()


Mime
View raw message