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.

skipPom is ignored by "push" goal

See original GitHub issue

Description

Have a multi-module project with docker-maven-plugin configuration in the images-parent module, which has packaging “pom”. Each subdirectory module has a simple minimal pom.xml with packaging “jar” and Dockerfile to build an image. The d-m-p configuration has skipPom=true configured The “build” goal is bound to “package” amd “push” is bound to “install”.

During the “build” goal, the pom with packaging=pom is correctly skipped as expected. unfortunately the “push” goal ignores skipPom and attempts to run in the parent pom.

[INFO] --- docker-maven-plugin:0.36.0:build (docker-build) @  images-parent  ---
[INFO] DOCKER> [ images-parent :1-0-0-snapshot] : Skipped building
[INFO]

[INFO] --- docker-maven-plugin:0.36.0:push (repository-push) @ images-parent ---
[ERROR] DOCKER> Unable to add tag [our.registry.com/docker/images/images-parent:1-0-0-snapshot] to image [images-parent:1-0-0-snapshot] : {"message":"No such image: images-parent:1-0-0-snapshot"} (Not Found: 404) [{"message":"No such image: images-parent:1-0-0-snapshot"} (Not Found: 404)]

Info

  • docker-maven-plugin version :0.36.0
  • Maven version (mvn -v) :
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: ~/Apps/apache-maven-3.8.1
Java version: 11.0.10, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
  • Docker version :
Client:
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df350
 Built:             Wed Jun  2 11:56:22 2021
 OS/Arch:           darwin/amd64
 Context:           desktop-linux
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:58 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  • If it’s a bug, how to reproduce : In images-parent:
	<modules>
		<module>child</module>
	</modules>

	<build>
		<plugins>
			<plugin>
				<groupId>io.fabric8</groupId>
				<artifactId>docker-maven-plugin</artifactId>
				<extensions>true</extensions>
				<executions>
					<execution>
						<id>docker-build</id>
						<phase>package</phase>
						<goals>
							<goal>build</goal>
						</goals>
						<configuration>
							<images>
								<image>
									<name>%a:${docker.release.tag}</name>
									<build>
										<contextDir>${docker.contextDir}</contextDir>
										<assembly>
											<name>dependencies</name>
											<descriptorRef>dependencies</descriptorRef>
										</assembly>
										<cleanup>try</cleanup>
										<filter>@</filter>
									</build>
								</image>
							</images>
						</configuration>
					</execution>
					<execution>
						<id>repository-push</id>
						<phase>install</phase>
						<goals>
							<goal>push</goal>
						</goals>
						<configuration>
							<images>
								<image>
									<name>%a:${docker.release.tag}</name>
									<build/>
								</image>
							</images>
						</configuration>
					</execution>
				</executions>
				<configuration>
					<dockerHost>${docker.host}</dockerHost>
					<certPath>${docker.certPath}</certPath>
					<sourceDirectory>.</sourceDirectory>
					<imagePullPolicy>IfNotPresent</imagePullPolicy>
					<pushRegistry>${docker.target.repository}</pushRegistry>
					<authConfig>
						<username>${docker.auth.user}</username>
						<password>${docker.auth.pass}</password>
					</authConfig>
					<retries>1</retries>
					<skipPush>${docker.skip.push}</skipPush>
					<skipPom>true</skipPom>
					<useColor>true</useColor>
					<verbose>true</verbose>
				</configuration>
			</plugin>
		</build>

The pom for “child” has minimal configuration, the idea is it’s inheriting all build config from its parent.

The workaround for the moment is to put everything in the parent into pluginManagement and add a build section to every child:

	<build>
		<plugins>
			<plugin>
				<groupId>io.fabric8</groupId>
				<artifactId>docker-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

* If it's a feature request, what is your use case :
* Sample project : *[GitHub Clone URL]*

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rohanKanojiacommented, Jul 29, 2021

ohk, I’ll take care of this.

1reaction
edrandallcommented, Jul 4, 2021

Maybe skipPom should be pushed up to the AbstractDockerMojo level such that it applies uniformly to all goals.

I notice there’s also a docker.skip.machine, which I’ve not previously come across, distinct from docker.skip; There’s a difference in the way they are used but the effective difference to the end user is unclear to me -perhaps it’s more related to testing the plugin without performing any docker actions?

Read more comments on GitHub >

github_iconTop Results From Across the Web

build(deps): bump docker-maven-plugin from 0.38.1 to 0.39.0
... <li><code>skipPom</code> is ignored by "push" goal (<a ... <li>Revert "Only push the <code>latest</code> tag if no other ...
Read more >
fabric8io/docker-maven-plugin
If set dont push any images even when docker:push is called. docker.skip.push. skipPom. If set to true this plugin will skip every projects ......
Read more >
fabric8io/docker-maven-plugin v0.39.0 on GitHub
... Fix logic bug to remove dangling images in BuildService (1522) @rkhmelichek; skipPom is ignored by "push" goal (1482) @rohanKanojia ...
Read more >
How to ignore a Maven goal in one child? - Stack Overflow
I have a parent POM with two children, one of which knows how to jboss-as:deploy, and the other does not. How do I...
Read more >
Create a PUSH goal – Chalene Johnson
The easiest way to get started on creating your PUSH goal is to watch this quick video. Shop Now Real World Push Goal...
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