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

skipExistingImages not working correctly? #4314

Open
dsvensson opened this issue Sep 25, 2024 · 0 comments
Open

skipExistingImages not working correctly? #4314

dsvensson opened this issue Sep 25, 2024 · 0 comments

Comments

@dsvensson
Copy link

dsvensson commented Sep 25, 2024

Environment:

  • Jib version: 3.4.3
  • Build tool: gradle 8.10
  • OS: Linux/macOS

Description of the issue:
skipExistingImages is supposed to make the error of having already pushed the image go away, but I still get:

Execution failed for task ':name:jib'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: 
Tried to push image manifest for blablabla.amazonaws.com/some/name:theversion but failed because:
Registry may not support pushing OCI Manifest or Docker Image Manifest Version 2, Schema 2

I've verified that skipExistingImages is correctly set to true when gradle is invoked by adding the following print in one of my build.gradle.kts files:

println("skip-existing: ${JibSystemProperties.skipExistingImages()}")

This prints true.

The problem typically occurs if there's some flakiness in the CI so a few of the images get pushed successfully, which during a retry will cause a failure due to already pushed images.

The workaround is ofc to just commit something which changes the hash used as tag allowing the build to complete, but it's an inconvenience compared to just retry.

Expected behavior:

Complete silence and exit 0, or some log that says the image already exists.

Steps to reproduce:

  1. Create an immutable AWS ECR repository entry
  2. Run jib task to push
    • In my case this produces an Image Index with the tag, plus two untagged Image entries, one for each of arm64 and x64.
  3. Repeat 2.

jib-gradle-plugin Configuration:

println("skip-existing: ${JibSystemProperties.skipExistingImages()}")

jib {
	to {
		image = "...:$commitHash"
		credHelper.helper = "ecr-login"
	}
	from {
		image = "amazoncorretto:17"

		platforms {
			platform {
				architecture = "amd64"
				os = "linux"
			}
			platform {
				architecture = "arm64"
				os = "linux"
			}
		}
	}
	container {
		environment = mapOf(
			...,
		)
		entrypoint = listOf("...")
		labels.set(
			mapOf(
				"org.opencontainers.image.revision" to version,
				"org.opencontainers.image.source" to "...",
			),
		)
	}
	extraDirectories {
		paths {
			path {
				setFrom(layout.buildDirectory.dir("extra"))
				into = "/app"
			}
			...
		}
		permissions.set(mapOf(
			"..." to "755"
		))
	}

	pluginExtensions {
		pluginExtension {
			implementation = "com.google.cloud.tools.jib.gradle.extension.layerfilter.JibLayerFilterExtension"
			configuration(Action<com.google.cloud.tools.jib.gradle.extension.layerfilter.Configuration> {
				filters {
					filter {
						...
					}
					...
				}
			})
		}
	}
}

Log output:

Execution failed for task ':name:jib'.
> com.google.cloud.tools.jib.plugins.common.BuildStepsExecutionException: 
Tried to push image manifest for blablabla.amazonaws.com/some/name:theversion but failed because:
Registry may not support pushing OCI Manifest or Docker Image Manifest Version 2, Schema 2

Additional Information:

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

No branches or pull requests

2 participants