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

docker:volume-remove should not fail the build if the volume is not found #763

Closed
KedneckInc opened this issue Apr 22, 2017 · 10 comments
Closed
Labels

Comments

@KedneckInc
Copy link

Description

Docker:volume-remove mapped to maven lifecycle 'clean' fails the build if the volume cannot be found.

Since the purpose of 'volume-remove' is to simply remove the given volume, if it's already gone, there's no reason to fail the build.

Unfortunately, there doesn't seem to be any flag or setting that will stop the plugin from failing the build.

Info

  • d-m-p version : 0.20.0
  • Maven version (mvn -v) :
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)
Maven home: /opt/apache-maven-3.3.9
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_121/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.10.2.el7.x86_64", arch: "amd64", family: "unix"
  • Docker version : 17.03.0-ce, build 60ccb22
  • If it's a bug, how to reproduce :

I'd call it a bug, but you might think of it as a feature request. Either way...

Create a simple pom.xml including something like the following

...
     <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>volume-cleanup</id>
            <phase>clean</phase>
            <goals><goal>volume-remove</goal></goals>
          </execution>
          <execution>
            <id>volume</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>volume-create</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <verbose>true</verbose>

          <!-- For volume-create -->
          <volumes>
            <volume>
              <name>gcssj-config</name>
              <driver>local</driver>
            </volume>
          </volumes>
...

Run mvn clean on an already clean project with no volume. Boom.

  • If it's a feature request, what is your use case :
  1. Consider binding the volume-clean step to the 'initialize' phase to guarantee that the volume is rebuilt every time.

  2. Consider the standard mvn clean install, which will fail every time because 'volume-clean' fails when the volume isn't present.

@rhuss
Copy link
Collaborator

rhuss commented May 16, 2017

I agree with you that we should be more conservative here and make fabric8:volume-remove a no-op when the volume does not exist.

Fancy of sending a PR for this ?

@rhuss rhuss added the bug label May 16, 2017
@KedneckInc
Copy link
Author

KedneckInc commented May 17, 2017 via email

@rhuss
Copy link
Collaborator

rhuss commented May 17, 2017

@KedneckInc Sorry, can't find it. Which PR do you refer to ?

@KedneckInc
Copy link
Author

KedneckInc commented May 18, 2017 via email

@KedneckInc
Copy link
Author

KedneckInc commented May 25, 2017 via email

@rhuss
Copy link
Collaborator

rhuss commented May 26, 2017

Thanks ;-) I will check #788 this later today.

@KedneckInc
Copy link
Author

Anything?

@ghost
Copy link

ghost commented Feb 8, 2018

@rhuss, @KedneckInc, did #788 resolve this? should it be closed?

@rhuss
Copy link
Collaborator

rhuss commented Feb 9, 2018

I think so, so I'm going to close this isssue. @KedneckInc feel free to re-open if this is not the case.

@rhuss rhuss closed this as completed Feb 9, 2018
@KedneckInc
Copy link
Author

Many Thanks! I'm sorry I took so long to respond, but this did indeed fix the problem. Now our developers don't have to manually clean up the old volumes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants