Skip to content

Commit f5f13c8

Browse files
committed
Try caching per output image name
1 parent 693ca45 commit f5f13c8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

bin/y-build

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ BUILDCTL_OPTS="$@"
1212
DEFAULT_REGISTRY=builds-registry.ystack.svc.cluster.local
1313
[ -z "$BUILDS_REGISTRY" ] && BUILDS_REGISTRY=$DEFAULT_REGISTRY
1414
[ -z "$PUSH_REGISTRY" ] && PUSH_REGISTRY=$DEFAULT_REGISTRY
15-
[ -z "$BUILDKIT_CACHE" ] && BUILDKIT_CACHE="type=registry,ref=$BUILDS_REGISTRY/ystack:buildcache"
16-
[ -z "$IMPORT_CACHE" ] && IMPORT_CACHE="--import-cache=$BUILDKIT_CACHE"
17-
[ -z "$EXPORT_CACHE" ] && EXPORT_CACHE="--export-cache=$BUILDKIT_CACHE,mode=max"
18-
[ "$IMPORT_CACHE" = "false" ] && IMPORT_CACHE=""
19-
[ "$EXPORT_CACHE" = "false" ] && EXPORT_CACHE=""
2015
[ -z "$BUILDKIT_HOST" ] && BUILDKIT_HOST=tcp://buildkitd.ystack.svc.cluster.local:8547
2116

2217
if [ "$(curl -s --connect-timeout 3 http://$BUILDS_REGISTRY/v2/)" != "{}" ]
@@ -65,6 +60,12 @@ if [[ ! -z "$GIT_COMMIT" ]]; then
6560
fi
6661
fi
6762

63+
[ -z "$BUILDKIT_CACHE" ] && BUILDKIT_CACHE="type=registry,ref=$(echo $IMAGE | sed 's|/|/ystack-buildcache/|' | sed s/:$BUILD_TAG//)"
64+
[ -z "$IMPORT_CACHE" ] && IMPORT_CACHE="--import-cache=$BUILDKIT_CACHE"
65+
[ -z "$EXPORT_CACHE" ] && EXPORT_CACHE="--export-cache=$BUILDKIT_CACHE,mode=max"
66+
[ "$IMPORT_CACHE" = "false" ] && IMPORT_CACHE=""
67+
[ "$EXPORT_CACHE" = "false" ] && EXPORT_CACHE=""
68+
6869
echo "Build command:"
6970
set -x
7071
y-buildctl \

0 commit comments

Comments
 (0)