To promote a build after successful deployment of an docker image of artifactory, we have to do a curl like this:
curl -k -I -u usr:pw -X POST https://company.com/artifactory/api/docker... - H "Content-Type: application/json" -d '{"targetRepo":"project-release","dockerRepository":"project/sample","tag":"1.0.0","copy":"false"}'
When trying this with maven use the exec plugin:
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>promote-image</id>
<phase>deploy</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>curl</executable>
<arguments>
<argument>-k</argument>
<argument>-i</argument>
<argument>-u ${USER}:{PWD}</argument>
<argument>-X POST https://company.com/artifactory/api/docker/docker-local/v2/promote</argument>
<argument>-H "Content-Type: application/json"</argument>
<argument>-d '{"targetRepo":"${docker.repository.release}","dockerRepository":"${docker.image.prefix}/${project.artifactId}","tag":"${project.version}","copy":"false"}'</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
...
But this is leading to a broken build on CI with the reason:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:exec (promote-image) on project myproject: Execution promote-image of goal org.codehaus.mojo:exec-maven-plugin:1.2:exec failed: Can't handle single and double quotes in same argument -> [Help 1]
I assume this is because -d '" - how could that be solved?