-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jetcd-launcher: allow starting Etcd Container via non-root user on Linux #1390
Conversation
jetcd-launcher/src/main/java/io/etcd/jetcd/launcher/EtcdContainer.java
Outdated
Show resolved
Hide resolved
jetcd-launcher/src/main/java/io/etcd/jetcd/launcher/EtcdContainer.java
Outdated
Show resolved
Hide resolved
jetcd-launcher/src/main/java/io/etcd/jetcd/launcher/EtcdContainer.java
Outdated
Show resolved
Hide resolved
jetcd-launcher/src/main/java/io/etcd/jetcd/launcher/EtcdContainer.java
Outdated
Show resolved
Hide resolved
@@ -63,6 +64,8 @@ public class EtcdContainer extends GenericContainer<EtcdContainer> { | |||
private Path dataDirectory; | |||
private Collection<String> additionalArgs; | |||
private boolean shouldMountDataDirectory = true; | |||
private boolean rootless = true; | |||
private String user = "1000"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should not be set to an arbitrary number by default better to leave it empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, once user is set it and then run with specially user, otherwise, not doing anything here at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- So for the current PR, to resolve io.etcd.jetcd.launcher.EtcdContainer -- Error deleting directory when using jetcd-tests on unit-testing. #1310, either,
@RegisterExtension
public static final EtcdClusterExtension CLUSTER = EtcdClusterExtension.builder()
.withNodes(1)
.withUser("1000:1000")
.build();
- Or,
@RegisterExtension
public static final EtcdClusterExtension CLUSTER = EtcdClusterExtension.builder()
.withNodes(1)
.withMountDirectory(false)
.build();
- This still looks weird to me, but I don't want to change the default value of
withMountDirectory
in this PR. Maybe another friend will need to file a PR to change the unit tests.
jetcd-launcher/src/main/java/io/etcd/jetcd/launcher/EtcdContainer.java
Outdated
Show resolved
Hide resolved
jetcd-launcher/src/main/java/io/etcd/jetcd/launcher/EtcdContainer.java
Outdated
Show resolved
Hide resolved
jetcd-launcher/src/main/java/io/etcd/jetcd/launcher/EtcdContainer.java
Outdated
Show resolved
Hide resolved
For #1310 Signed-off-by: linghengqian <linghengqian@outlook.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lburgazzoli, linghengqian The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/tmp/jetcd_test_etcd0_15814517176251913946/member
will be changed to the Linux user logged in on the current host. Although apache/shardingsphere will not benefit from this change due to the need to stay on the jdk8 runtime baseline.1000
will be the current Linux user. This can be verified withcat /etc/passwd
. Refer to https://docs.docker.com/engine/reference/run/#user , https://docs.docker.com/engine/security/userns-remap/ and https://www.docker.com/blog/understanding-the-docker-user-instruction/ .linghengqian@DESKTOP-2OCN434:~/TwinklingLiftWorks/git/public/shardingsphere$ cat /etc/passwd root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin systemd-network:x:100:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin messagebus:x:102:105::/nonexistent:/usr/sbin/nologin systemd-timesync:x:103:106:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin syslog:x:104:111::/home/syslog:/usr/sbin/nologin _apt:x:105:65534::/nonexistent:/usr/sbin/nologin uuidd:x:106:112::/run/uuidd:/usr/sbin/nologin tcpdump:x:107:113::/nonexistent:/usr/sbin/nologin linghengqian:x:1000:1000:,,,:/home/linghengqian:/bin/bash usbmux:x:108:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin rtkit:x:109:117:RealtimeKit,,,:/proc:/usr/sbin/nologin
sdk install java 17.0.11-ms sdk use java 17.0.11-ms git clone git@github.com:linghengqian/jetcd.git -b fix-not-root-user cd ./jetcd/ ./gradlew clean publishToMavenLocal