feat: push tag
This commit is contained in:
1 parent
dc04ab912d
commit
1a99271fa8
1 file changed
+16
-1
@@ -3,6 +3,7 @@ package registry
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -71,7 +72,10 @@ func pushToRegistry(appName string, tag string) error {
|
|||||||
// fn-registry-create-repository "$APP" "$DOKKU_REGISTRY_SERVER" "$IMAGE_REPO"
|
// fn-registry-create-repository "$APP" "$DOKKU_REGISTRY_SERVER" "$IMAGE_REPO"
|
||||||
|
|
||||||
common.LogVerboseQuiet("Pushing $IMAGE_REPO:$TAG")
|
common.LogVerboseQuiet("Pushing $IMAGE_REPO:$TAG")
|
||||||
// docker push "${DOKKU_REGISTRY_SERVER}${IMAGE_REPO}:${TAG}"
|
if !dockerPush(fmt.Sprintf("%s%s:%s", registryServer, imageRepo, tag)) {
|
||||||
|
// TODO: better error
|
||||||
|
return errors.New("Unable to push image")
|
||||||
|
}
|
||||||
|
|
||||||
common.LogVerboseQuiet("Cleaning up")
|
common.LogVerboseQuiet("Cleaning up")
|
||||||
// fn-registry-image-cleanup "$APP" "$DOKKU_REGISTRY_SERVER" "$IMAGE_REPO" "$IMAGE_TAG" "$TAG"
|
// fn-registry-image-cleanup "$APP" "$DOKKU_REGISTRY_SERVER" "$IMAGE_REPO" "$IMAGE_TAG" "$TAG"
|
||||||
@@ -90,3 +94,14 @@ func dockerTag(imageID string, imageTag string) bool {
|
|||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func dockerPush(imageTag string) bool {
|
||||||
|
cmd := sh.Command(common.DockerBin(), "image", "push", imageTag)
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
if err := cmd.Run(); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
Reference in new issue
Block a user