question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Imagenames are wrong in case of several profiles

See original GitHub issue

Hi we got the following describes setup. We are using two profiles. One to push into our own registry and one to push into the registry of our customer. If both profiles are executed with mvn clean package -P docker-image-to-customer-registry,docker-image-to-private-registry I would expect to have 2 images in my local machine registry:

  1. customer/${project.artifactId}😒{project.version}
  2. private/${project.artifactId}😒{project.version}

The log shows clearly that both profiles are executed successfully but both profiles are building an image with the same name:

  • private/project.artifactId}😒{project.version}

So it seems clear to me that the last setup name does always win.

<profile>
            <id>docker-image-to-customer-registry</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>io.fabric8</groupId>
                            <artifactId>docker-maven-plugin</artifactId>
                            <version>${version.docker.maven.plugin}</version>
                            <executions>
                                <execution>
                                    <id>build-for-customer</id>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>build</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <verbose>true</verbose>
                                <images>
                                    <image>
                                        <registry>${customer.url}</registry>
                                        <name>customer/${project.artifactId}:${project.version}</name>
                                        <build>
                                            <contextDir>.</contextDir>
                                            <assembly>
                                                <mode>dir</mode>
                                                <inline xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
                                                        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
                                                    <files>
                                                        <file>
                                                            <source>
                                                                target/${project.artifactId}-exec.jar
                                                            </source>
                                                        </file>
                                                    </files>
                                                </inline>
                                            </assembly>
                                            <tags>
                                                <tag>latest</tag>
                                            </tags>
                                        </build>
                                    </image>
                                </images>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        <profile>
            <id>docker-image-to-private-registry</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>io.fabric8</groupId>
                            <artifactId>docker-maven-plugin</artifactId>
                            <version>${version.docker.maven.plugin}</version>
                            <executions>
                                <execution>
                                    <id>build-for-private</id>
                                    <phase>package</phase>
                                    <goals>
                                        <goal>build</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <verbose>true</verbose>
                                <images>
                                    <image>
                                        <registry>${private.url}</registry>
                                        <name>private/${project.artifactId}:${project.version}</name>
                                        <build>
                                            <contextDir>.</contextDir>
                                            <assembly>
                                                <mode>dir</mode>
                                                <inline xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
                                                        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
                                                    <files>
                                                        <file>
                                                            <source>
                                                                target/${project.artifactId}-exec.jar
                                                            </source>
                                                        </file>
                                                    </files>
                                                </inline>
                                            </assembly>
                                            <tags>
                                                <tag>latest</tag>
                                            </tags>
                                        </build>
                                    </image>
                                </images>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

0reactions
Captain-P-Goldfishcommented, Mar 13, 2021

oh great… I just tried to put the configuration into the execution-section and it works like this. This will at least do for me. But did not expect this. It’s the first time I am having problems with differnet plugin configurations over different profiles…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple profile pics? Wrong profile pics - Apple Community
Something very strange is happening with my Apple ID. I noticed that on my iPhone, the profile pic that is showing for me...
Read more >
Bug? macOS Sierra Preview/Quick Look issues with rendering ...
I had this problem with High Sierra, Preview, and a DisplayCal profile. The latest version of DisplayCal, 3.5, has in its release notes:....
Read more >
React Native - Image Require Module using Dynamic Names
I made a custom image component which takes in a boolean to check if the image is from web or is being passed...
Read more >
Don't Use the @Profile Annotation in a Spring Boot App!
Why using Spring's @Profile annotation is a bad idea and what to do instead. ... The main use case for profiles in Spring...
Read more >
Custom configuration - Testcontainers for Java
The configuration will be loaded from multiple locations. ... configuration property names should be set in upper case with underscore separators, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found