Skip to content

Commit 9d105dc

Browse files
committed
make it work
1 parent c2bd093 commit 9d105dc

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

e2e/custom_registry/registry/launcher.sh

+4
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ function start_registry() {
2121
fi
2222
echo "127.0.0.1:${port}"
2323
return 0
24+
}
25+
26+
function stop_registry() {
27+
:
2428
}

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}"

oci/private/registry/crane_launcher.sh.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
readonly SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
2-
readonly CRANE_REGISTRY_BIN="/Users/thesayyn/Documents/go-containerregistry/main"
2+
readonly CRANE_REGISTRY_BIN="${SCRIPT_DIR}/{{CRANE}}"
33

44
function start_registry() {
55
local storage_dir="$1"

oci/private/registry/zot_launcher.sh.tpl

-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ function start_registry() {
77
local deadline="${3:-5}"
88
local config_path="$storage_dir/config.json"
99
10-
echo "$storage_dir" >&2
1110
cat > "${config_path}" <<EOF
1211
{
1312
"storage": { "rootDirectory": "$storage_dir/..", "dedupe": false, "commit": true },
@@ -33,8 +32,6 @@ EOF
3332
return 0
3433
}
3534

36-
37-
3835
function stop_registry() {
3936
local storage_dir="$1"
4037
rm -rf "${storage_dir}/.uploads"

0 commit comments

Comments
 (0)