Skip to content

Commit 505c7ce

Browse files
committed
make it work
1 parent c2bd093 commit 505c7ce

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

oci/private/image.sh.tpl

+7-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function get_option() {
3333

3434
function empty_base() {
3535
local registry=$1
36-
local ref="$registry/image:latest"
36+
local ref="$registry/oci/empty_base:latest"
3737
ref="$("${CRANE}" append --oci-empty-base -t "${ref}" -f {{empty_tar}})"
3838
ref=$("${CRANE}" config "${ref}" | "${JQ}" ".rootfs.diff_ids = [] | .history = []" | "${CRANE}" edit config "${ref}")
3939
ref=$("${CRANE}" manifest "${ref}" | "${JQ}" ".layers = []" | "${CRANE}" edit manifest "${ref}")
@@ -158,8 +158,12 @@ if [ ${#ENV_EXPANSIONS[@]} -ne 0 ]; then
158158
fi
159159

160160
if [ -n "$OUTPUT" ]; then
161-
"${CRANE}" pull "${REF}" "./${OUTPUT}" --format=oci --prune
162-
stop_registry "${STORAGE_DIR}"
161+
"${CRANE}" pull "${REF}" "./${OUTPUT}" --format=oci --annotate-ref
162+
mv "${OUTPUT}/index.json" "${OUTPUT}/temp.json"
163+
"${JQ}" --arg ref "${REF}" '.manifests |= map(select(.annotations["org.opencontainers.image.ref.name"] == $ref)) | del(.manifests[0].annotations)' "${OUTPUT}/temp.json" > "${OUTPUT}/index.json"
164+
rm "${OUTPUT}/temp.json"
165+
"${CRANE}" layout gc "./${OUTPUT}"
166+
stop_registry "${OUTPUT}"
163167
fi
164168

165169
} 2>> "${STDERR}"

0 commit comments

Comments
 (0)