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

Fix handling of Run Commands from properties. #684

Merged
merged 3 commits into from
Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -384,16 +384,16 @@
</build>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>starling-central</id>
Copy link
Collaborator

Choose a reason for hiding this comment

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

guess this slipped in accidentally. Could you please revert this ?

<name>Starling Releases</name>
<url>https://starlingbank.jfrog.io/starlingbank/libs-release-local</url>
</repository>
<snapshotRepository>
<id>starling-snapshots</id>
<name>Starling Snapshots</name>
<url>https://starlingbank.jfrog.io/starlingbank/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>

<issueManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ public Builder ports(List<String> ports) {
}

public Builder runCmds(List<String> theCmds) {
if (config.runCmds == null) {
if (theCmds == null) {
config.runCmds = new ArrayList<>();
} else {
config.runCmds = theCmds;
}
else
config.runCmds = theCmds;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,7 @@ private List<String> extractPortValues(String prefix, Properties properties) {


private List<String> extractRunCommands(String prefix, Properties properties) {
List<String> ret = new ArrayList<>();
List<String> cmds = listWithPrefix(prefix, RUN, properties);
if (cmds == null) {
return null;
}
return ret;
return listWithPrefix(prefix, RUN, properties);
}

private RestartPolicy extractRestartPolicy(String prefix, Properties properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ public void testPorts() throws Exception {
assertArrayEquals(new String[]{"8080", "9090", "80"}, ports);
}

@Test
public void testRunCommands() {
List<ImageConfiguration> configs = resolveImage(
imageConfiguration,props(
"docker.name","demo",
"docker.run.1", "foo",
"docker.run.2", "bar",
"docker.run.3", "wibble")
);

assertEquals(1, configs.size());

BuildImageConfiguration buildConfig = configs.get(0).getBuildConfiguration();
String[] runCommands = new ArrayList<>(buildConfig.getRunCmds()).toArray(new String[buildConfig.getRunCmds().size()]);
assertArrayEquals(new String[]{"foo", "bar", "wibble"}, runCommands);
}

@Test
public void testEnvAndLabels() throws Exception {
List<ImageConfiguration> configs = resolveImage(
Expand Down