spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.66k stars 575 forks source link

Separate push-tags goal #331

Closed anton-johansson closed 6 years ago

anton-johansson commented 7 years ago

Description

In pull request #127, support for pushing only tags specified in the POM was added, which is great! However, when I have a configuration that binds to the different lifecycle phases, like this:

<configuration>
    <serverId>[repo-hostname]</serverId>
    <registryUrl>https://[repo-hostname]:[repo-port]</registryUrl>
    <imageName>[repo-hostname]:[repo-port]/xxx/yyy</imageName>
    <dockerDirectory>${basedir}/src/docker</dockerDirectory>
    <imageTags>
        <imageTag>${project.version}</imageTag>
        <imageTag>latest</imageTag>
    </imageTags>
</configuration>
<executions>
    <execution>
        <id>build-docker-image</id>
        <phase>package</phase>
        <goals>
            <goal>build</goal>
        </goals>
    </execution>
    <execution>
        <id>push-docker-image</id>
        <phase>deploy</phase>
        <goals>
            <goal>push</goal>
        </goals>
    </execution>
</executions>

... it doesn't really work that well. I want to build my images in the package phase, but I don't want to build them again in my deploy phase. But I still want a simple way of executing my phases ('mvn packageormvn deploy`).

How to reproduce

Use the Maven configuration above, and all tags founds for that image name will be pushed.

Software:

anton-johansson commented 7 years ago

One idea: instead of having a separate goal, we could check if we have imageTags specified in our POM, and if so just call Utils.pushImageTag instead of Utils.pushImage. This makes a lot more sense to me, but it would change the behavior, and break backwards-compatibility. :(

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.