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

Adding the from.platforms Jib config parameter to jib-maven-plugin and to the jib-gradle-plugin #2568

Merged
merged 21 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from 10 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
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ Optional<String> getMode() {
}
}

/** Configuration for {@code platform} parameter. * */
public static class PlatformsConfiguration {
@Nullable @Parameter private String os;
@Nullable @Parameter private String architecture;

@Nullable
String getOs() {
return this.os;
}

@Nullable
String getArchitecture() {
return this.architecture;
}
}

/** Configuration for {@code from} parameter. */
public static class FromConfiguration {

Expand All @@ -135,6 +151,16 @@ public static class FromConfiguration {
@Nullable @Parameter private String credHelper;

@Parameter private FromAuthConfiguration auth = new FromAuthConfiguration();

@Parameter private List<PlatformsConfiguration> platforms;

/** Constructor for defaults . * */
chanseokoh marked this conversation as resolved.
Show resolved Hide resolved
public FromConfiguration() {
PlatformsConfiguration platform = new PlatformsConfiguration();
platform.os = "linux";
platform.architecture = "amd64";
platforms = Collections.singletonList(platform);
}
}

/** Configuration for {@code to} parameter, where image is required. */
Expand Down Expand Up @@ -330,6 +356,15 @@ protected void checkJibVersion() throws MojoExecutionException {
MojoCommon.checkJibVersion(descriptor);
}

/**
* Gets the specified platforms.
*
* @return the specified platforms
*/
List<PlatformsConfiguration> getPlatforms() {
return from.platforms;
}

/**
* Gets the base image reference.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public Log getLog() {

@Test
public void testDefaults() {
Assert.assertEquals("linux", testPluginConfiguration.getPlatforms().get(0).getOs());
Assert.assertEquals("amd64", testPluginConfiguration.getPlatforms().get(0).getArchitecture());
Assert.assertEquals("", testPluginConfiguration.getAppRoot());
Assert.assertNull(testPluginConfiguration.getWorkingDirectory());
Assert.assertTrue(testPluginConfiguration.getExtraClasspath().isEmpty());
Expand Down