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/06 13:41:24 UTC
[geode] 01/02: GEODE-3556: Add support for setting the user inside
docker containers
This is an automated email from the ASF dual-hosted git repository.
jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git
commit e330ee0e03746a1f7d00663770447f378551f318
Author: Jens Deppe <jd...@pivotal.io>
AuthorDate: Tue Sep 5 19:22:49 2017 -0700
GEODE-3556: Add support for setting the user inside docker containers
---
gradle.properties | 2 +-
gradle/docker.gradle | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/gradle.properties b/gradle.properties
index 042cf42..e78a1b7 100755
--- a/gradle.properties
+++ b/gradle.properties
@@ -53,6 +53,6 @@ nexusSignArchives = true
# Control how many concurrent dunit (using docker) tests will be run
dunitParallelForks = 8
# This is the name of the Docker image for running parallel dunits
-dunitDockerImage = openjdk:8
+dunitDockerImage = apachegeode/geode-build
# Docker user for parallel dunit tests
dunitDockerUser = root
diff --git a/gradle/docker.gradle b/gradle/docker.gradle
index bc466f0..207d823 100644
--- a/gradle/docker.gradle
+++ b/gradle/docker.gradle
@@ -53,10 +53,14 @@ 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()
+ def tmpEnv = []
+ cmd.getEnv().each { tmpEnv << it }
tmpEnv.eachWithIndex { x, j ->
if (x.startsWith('JAVA_HOME')) {
@@ -75,6 +79,16 @@ def dockerConfig = {
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()
+ tmpEnv << ("LOCAL_USER_ID=${uid}" as String)
+ }
+
cmd.withEnv(tmpEnv)
// Infer the index of this invocation
--
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.