Skip to content

Commit

Permalink
make it work
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn committed Nov 30, 2023
1 parent c2bd093 commit b856ded
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions oci/private/image.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function get_option() {

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

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

} 2>> "${STDERR}"
2 changes: 1 addition & 1 deletion oci/private/registry/crane_launcher.sh.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
readonly SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
readonly CRANE_REGISTRY_BIN="/Users/thesayyn/Documents/go-containerregistry/main"
readonly CRANE_REGISTRY_BIN="${SCRIPT_DIR}/{{CRANE}}"

function start_registry() {
local storage_dir="$1"
Expand Down
1 change: 0 additions & 1 deletion oci/private/registry/zot_launcher.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function start_registry() {
local deadline="${3:-5}"
local config_path="$storage_dir/config.json"
echo "$storage_dir" >&2
cat > "${config_path}" <<EOF
{
"storage": { "rootDirectory": "$storage_dir/..", "dedupe": false, "commit": true },
Expand Down

0 comments on commit b856ded

Please sign in to comment.