jib.to.image push to multiple repositories
See original GitHub issueEnvironment:
- Jib version: 1.1.2
- Build tool: Gradle v1.1.2
- OS: MacOS
Description of the issue:
Seeking a way to push the same image to multiple image repositories. We have a need where we need to host our images in both DockerHub and ECR, the documentation doesn’t make any reference to if this is possible. If it is in-fact possible, if someone can explain it here, I’d be happy to help update the documentation for the gradle plugin as needed.
Expected behavior:
Allow a means to specify multiple jib.to.image
values, such as via a comma separated list, with the expectation that each image provided will be pushed to the correct docker respository.
Steps to reproduce:
- Create a container repo on dockerhub and ECR
- Try to push one docker container to both repo’s in one build.
jib-gradle-plugin
Configuration:
jib {
to {
tags ['latest', 'develop']
// one possibility:
image "organization/repo, id.dkr.ecr.us-west-2.amazonaws.com/repo"
// second possibility:
image ['organization/repo', 'id.dkr.ecr.us-west-2.amazonaws.com/repo']
}
}
Log output:
Caused by: com.google.cloud.tools.jib.image.InvalidImageReferenceException: Invalid image reference: org/repo,id.dkr.ecr.us-east-1.amazonaws.com/repo
— OR —
- What went wrong: Script compilation errors:
Line 133: image=listOf("org/repo","id.dkr.ecr.us-east-1.amazonaws.com/repo")
^ Type mismatch: inferred type is List<String> but String? was expected
My log output is from a kotlin gradle buildscript, but I think the concepts apply no matter the buildscript language - there does not appear to be a way to specify 2 image locations to be able to push an image to 2 image repos via one build.
There is a workaround specified here but it feels somewhat un-natural and so I wonder if this tool should support this use case?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:7 (4 by maintainers)
Top GitHub Comments
Why not loop and push in a fashion similar to this?
I wouldn’t worry too much about running Jib multiple times. Everything built for an image is cached and reused (thanks to the strong reproducibility of Jib), so subsequent runs will be no-op regarding building something.