You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2017/09/01 20:58:12 UTC
geode git commit: GEODE-3556: Update gradle docker plugin to 0.5.4
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-3556 [created] 6d32e2872
GEODE-3556: Update gradle docker plugin to 0.5.4
- Note that this feature only works on Linux
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/6d32e287
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/6d32e287
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/6d32e287
Branch: refs/heads/feature/GEODE-3556
Commit: 6d32e28727136ce72ecff0017f7f6079757b819f
Parents: 4ce9220
Author: Jens Deppe <jd...@pivotal.io>
Authored: Fri Sep 1 13:56:08 2017 -0700
Committer: Jens Deppe <jd...@pivotal.io>
Committed: Fri Sep 1 13:56:08 2017 -0700
----------------------------------------------------------------------
build.gradle | 2 +-
gradle/docker.gradle | 70 ++++++++++++++---------------------------------
2 files changed, 21 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/6d32e287/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 4feb879..e413366 100755
--- a/build.gradle
+++ b/build.gradle
@@ -26,7 +26,7 @@ buildscript {
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.0.1'
classpath "com.diffplug.gradle.spotless:spotless:2.2.0"
classpath "me.champeau.gradle:jmh-gradle-plugin:0.3.1"
- classpath "com.pedjak.gradle.plugins:dockerized-test:0.4.2"
+ classpath "com.pedjak.gradle.plugins:dockerized-test:0.5.4"
}
}
http://git-wip-us.apache.org/repos/asf/geode/blob/6d32e287/gradle/docker.gradle
----------------------------------------------------------------------
diff --git a/gradle/docker.gradle b/gradle/docker.gradle
index cc7fb06..bc466f0 100644
--- a/gradle/docker.gradle
+++ b/gradle/docker.gradle
@@ -38,17 +38,6 @@
* The default is 'root'.
*/
-static def getWorkingDirArgIndex(args) {
- def index = 0
- for (arg in args) {
- if (arg.equals('-w')) {
- return index + 1
- }
- index++
- }
- return -1
-}
-
def dockerConfig = {
maxParallelForks = dunitParallelForks.toInteger()
@@ -64,61 +53,42 @@ def dockerConfig = {
// Add volumes configured by top-level build script
volumes << project.dunitDockerVolumes
- // specify the user for starting Gradle test worker within the container.
- user = dunitDockerUser
+ beforeContainerCreate = { cmd, client ->
+ def javaHomeIdx = -1
+ def pathIdx = -1
+ def tmpEnv = cmd.getEnv()
- argsInspect = { List args ->
- def javaHomeIdx = 0
- def pathIdx = 0
- def i = args.iterator()
- def j = 0
- while (i.hasNext()) {
- if (i.next() == '-e') {
- def x = i.next()
- j++
- if (x.startsWith('JAVA_HOME')) {
- javaHomeIdx = j
- }
- if (x.startsWith('PATH')) {
- pathIdx = j
- }
+ tmpEnv.eachWithIndex { x, j ->
+ if (x.startsWith('JAVA_HOME')) {
+ javaHomeIdx = j
+ }
+ if (x.startsWith('PATH')) {
+ pathIdx = j
}
- j++
}
// Remove JAVA_HOME and PATH env variables - they might not be the same as the container needs
- if (javaHomeIdx > 0) {
- args[javaHomeIdx] = 'JAVA_HOME_REMOVED='
+ if (javaHomeIdx >= 0) {
+ tmpEnv[javaHomeIdx] = 'JAVA_HOME_REMOVED='
}
- if (pathIdx > 0) {
- args[pathIdx] = 'PATH_REMOVED='
+ if (pathIdx >= 0) {
+ tmpEnv[pathIdx] = 'PATH_REMOVED='
}
- // Unfortunately this snippet of code is here and is required by dev-tools/docker/base/entrypoint.sh.
- // This allows preserving the outer user inside the running container. Required for Jenkins
- // and other environments. There doesn't seem to be a way to pass this environment variable
- // in from a Jenkins Gradle job.
- if (System.env['LOCAL_USER_ID'] == null) {
- def username = System.getProperty("user.name")
- def uid = ['id', '-u', username].execute().text.trim()
- args.add(1, "-e" as String)
- args.add(2, "LOCAL_USER_ID=${uid}" as String)
- }
+ cmd.withEnv(tmpEnv)
// Infer the index of this invocation
- def matcher = (args[args.size - 1] =~ /.*Executor (\d*).*/)
+ def cmdList = cmd.getCmd()
+ def matcher = (cmdList[cmdList.length - 1] =~ /.*Executor (\d*).*/)
- def pwdIndex = getWorkingDirArgIndex(args)
- args[pwdIndex] = args[pwdIndex] + matcher[0][1]
- def workdir = new File(args[pwdIndex])
+ def workdir = new File(cmd.getWorkingDir() + matcher[0][1])
workdir.mkdirs()
-// println args
+ cmd.withWorkingDir(workdir.toString())
- args
+ //println cmd
}
}
}
-
subprojects {
apply plugin: 'com.github.pedjak.dockerized-test'