Add option for custom builder for Skaffold to push image
#5 032 ouverte le 17 nov. 2020
Métriques du dépôt
- Stars
- (12 822 étoiles)
- Métriques de merge PR
- (Merge moyen 3j 6h) (16 PRs mergées en 30 j)
Description
Background
Certain external builders, such as the Spring Boot image builder, are difficult to integrate with Skaffold as they build to the local Docker daemon only, and pushing is left as a separate step to be done with a docker push.
As a result, users of such builders must define custom build scripts that usually have the form:
#!/bin/sh
set -e
cd "$BUILD_CONTEXT"
mvn -pl "$1" org.springframework.boot:spring-boot-maven-plugin:build-image
-Dspring-boot.build-image.imageName="$IMAGE" -DskipTests=true
if [ "$PUSH_IMAGE" = true ]; then
docker push "$IMAGE"
fi
This script must have execute permission. This is repetitive boilerplate. It's not portable between *nix and Windows systems (and we don't offer a mechanism to specify per-OS commands). It loses clarity as the builder definition is now elsewhere.
Feature Request
Skaffold should offer the ability to auto-push these images.
I was thinking a flag to indicate whether a custom builder supports pushing images would be enough. Something like:
custom:
buildCommand: mvn -pl my/project org.springframework.boot:spring-boot-maven-plugin:build-image
-Dspring-boot.build-image.imageName=$IMAGE -DskipTests=true
supportsPush: false
That does presume that the only other option is to build to the local docker daemon. Perhaps it might be better to have something more explicit like:
custom:
buildCommand: ...
type: localDockerOnly