Skip to content
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

Added property to set docker user #17

Merged
merged 1 commit into from
Apr 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build-server/src/main/java/nl/tudelft/ewi/build/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public interface Config {
int getMaximumConcurrentJobs();

String getStagingDirectory();

String getWorkingDirectory();


String getClientId();

String getClientSecret();


String getDockerUser();

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public PropertyBasedConfig() {
this.properties = new Properties();
reload();
}

public void reload() {
try (InputStreamReader reader = new InputStreamReader(getClass().getResourceAsStream("/config.properties"))) {
properties.load(reader);
Expand All @@ -24,29 +24,35 @@ public void reload() {
log.error(e.getMessage());
}
}


@Override
public int getHttpPort() {
return Integer.parseInt(properties.getProperty("http.port", "8080"));
}


@Override
public int getMaximumConcurrentJobs() {
return Integer.parseInt(properties.getProperty("docker.max-containers"));
}


@Override
public String getStagingDirectory() {
return properties.getProperty("docker.staging-directory");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we still need this?

}

public String getWorkingDirectory() {
return properties.getProperty("docker.working-directory");
}


@Override
public String getClientId() {
return properties.getProperty("authorization.client-id");
}


@Override
public String getClientSecret() {
return properties.getProperty("authorization.client-secret");
}


@Override
public String getDockerUser() {
return properties.getProperty("docker.user", "root");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ public ContainerExit call() throws Exception {
ContainerConfig.Builder configBuilder = ContainerConfig.builder()
.image(buildInstructionInterpreter.getImage(buildInstruction))
.cmd(buildInstructionInterpreter.getCommand(buildInstruction).split(" "))
.user(config.getDockerUser())
.volumes(volume)
.workingDir(WORK_DIR);

Expand Down
1 change: 1 addition & 0 deletions build-server/src/main/resources/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ authorization.client-secret = t2hLCXVE
docker.max-containers = 3
docker.staging-directory = /workspace
docker.working-directory = /workspace
docker.user = root

http.port = 8082