-
Notifications
You must be signed in to change notification settings - Fork 87
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
[WFMP-262]: Allow to add labels to the images. #543
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
import static java.lang.String.format; | ||
import static java.lang.String.join; | ||
import static org.wildfly.plugin.common.PropertyNames.WILDFLY_IMAGE_LABELS; | ||
|
||
import java.io.IOException; | ||
import java.nio.charset.StandardCharsets; | ||
|
@@ -15,6 +16,7 @@ | |
import java.time.Duration; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.apache.maven.plugin.MojoExecutionException; | ||
|
@@ -95,6 +97,9 @@ public class ApplicationImageMojo extends PackageServerMojo { | |
@Parameter(alias = "image") | ||
private ApplicationImageInfo image; | ||
|
||
@Parameter(property = WILDFLY_IMAGE_LABELS, alias = "labels", required = false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs some Java doc for the plugin documentation. In that it needs a |
||
private List<String> labels = Collections.emptyList(); | ||
Comment on lines
+100
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be a <labels>
<version>1.0</version>
<description>"Test description "</description>
</labels> Also the alias and required aren't really needed. |
||
|
||
@Override | ||
protected String getGoal() { | ||
return "image"; | ||
|
@@ -223,8 +228,13 @@ private void generateDockerfile(String runtimeImage, Path targetDir, String wild | |
|
||
// Create the Dockerfile content | ||
final StringBuilder dockerfileContent = new StringBuilder(); | ||
dockerfileContent.append("FROM ").append(runtimeImage).append('\n') | ||
.append("COPY --chown=jboss:root ").append(jbossHome).append(" $JBOSS_HOME\n") | ||
dockerfileContent.append("FROM ").append(runtimeImage).append('\n'); | ||
if (labels != null) { | ||
for (String label : labels) { | ||
dockerfileContent.append("LABEL ").append(label).append("\n"); | ||
} | ||
} | ||
dockerfileContent.append("COPY --chown=jboss:root ").append(jbossHome).append(" $JBOSS_HOME\n") | ||
.append("RUN chmod -R ug+rwX $JBOSS_HOME\n") | ||
.append("COPY --chown=jboss:root ").append(getDeploymentContent().getFileName()) | ||
.append(" $JBOSS_HOME/standalone/deployments/").append(targetName); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,11 @@ | |
<image> | ||
<group>wildfly-maven-plugin</group> | ||
</image> | ||
<labels> | ||
<label>version="1.0"</label> | ||
<label>description="This text illustrates \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor, but the quotes should be |
||
that label-values can span multiple lines."</label> | ||
</labels> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
|
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.
Not a blocker, but this doesn't need to be here if you'd rather it not be. I had originally created this file for shared properties to ensure the values stay the same, but this is likely not to be shared.