Skip to content

Commit

Permalink
add user, 3.x working locally
Browse files Browse the repository at this point in the history
  • Loading branch information
SiyaoIsHiding committed Sep 18, 2024
1 parent 5373500 commit 712ae55
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion Jenkinsfile-asf
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ pipeline {
}

def executeTests() {
sh "docker run -e TEST_JAVA_VERSION=${TEST_JAVA_VERSION} -e SERVER_VERSION=${SERVER_VERSION} -v \$(pwd):/home/docker/cassandra-java-driver apache.jfrog.io/cassan-docker/apache/cassandra-java-driver-testing-ubuntu2204 cassandra-java-driver/ci/run-tests.sh"
def container_id = sh(script: "docker run -td -e TEST_JAVA_VERSION=${TEST_JAVA_VERSION} -e SERVER_VERSION=${SERVER_VERSION} -v \$(pwd):/home/docker/cassandra-java-driver apache.jfrog.io/cassan-docker/apache/cassandra-java-driver-testing-ubuntu2204 'sleep 2h'", returnStdout: true).trim()
sh "docker exec --user root ${container_id} bash -c \"sudo bash /home/docker/cassandra-java-driver/ci/create-user.sh docker $(id -u) $(id -g) /home/docker/cassandra-java-driver\""
sh "docker exec --user docker ${container_id} './cassandra-java-driver/ci/run-tests.sh'"
}

// branch pattern for cron
Expand Down
11 changes: 6 additions & 5 deletions ci/create-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ BUILD_HOME=$4
#
################################

# disable git directory ownership checks
su ${username} -c "git config --global safe.directory '*'"

if grep "^ID=" /etc/os-release | grep -q 'debian\|ubuntu' ; then
deluser docker
adduser --quiet --disabled-login --no-create-home --uid $uid --gecos ${username} ${username}
groupmod --non-unique -g $gid $username
gpasswd -a ${username} sudo >/dev/null
Expand All @@ -57,9 +61,6 @@ mkdir -p ${BUILD_HOME}/.ssh
echo 'Host *\n UserKnownHostsFile /dev/null\n StrictHostKeyChecking no' > ${BUILD_HOME}/.ssh/config

# proper permissions
chown -R ${username}:${username} ${BUILD_HOME}
chown -R ${username}:${username} /home/docker
chmod og+wx ${BUILD_HOME}
chmod 600 ${BUILD_HOME}/.ssh/config

# disable git directory ownership checks
su ${username} -c "git config --global safe.directory '*'"
chmod 600 ${BUILD_HOME}/.ssh/config
2 changes: 1 addition & 1 deletion ci/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
. ~/env.txt
printenv | sort
cd $(dirname "$(readlink -f "$0")")/..
mvn -B -V install -DskipTests -Dmaven.javadoc.skip=true
mvn -B -V clean install -DskipTests -Dmaven.javadoc.skip=true
jabba use ${TEST_JAVA_VERSION}
printenv | sort
mvn -B -V verify -T 1 -Dcassandra.version=${SERVER_VERSION} -Ddse=false -Dmaven.test.failure.ignore=true -Dmaven.javadoc.skip=true;

0 comments on commit 712ae55

Please sign in to comment.