Skip to content

Commit

Permalink
fix: invalid tarball manifest creation (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
mboulton-fathom authored Sep 14, 2023
1 parent 98328b4 commit 2257c18
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions oci/private/tarball.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ readonly BLOBS_DIR="${STAGING_DIR}/blobs"
readonly TARBALL_PATH="{{tarball_path}}"
readonly TAGS_FILE="{{tags}}"

# Replace newlines (unix or windows line endings) with % character.
# We can't pass newlines to yq due to https://github.com/mikefarah/yq/issues/1430 and
# we can't update YQ at the moment because structure_test depends on a specific version:
# see https://github.com/bazel-contrib/rules_oci/issues/212
REPOTAGS="$(tr -d '\r' < "${TAGS_FILE}" | tr '\n' '%')"

MANIFEST_DIGEST=$(${YQ} eval '.manifests[0].digest | sub(":"; "/")' "${IMAGE_DIR}/index.json" | tr -d '"')
MANIFEST_BLOB_PATH="${IMAGE_DIR}/blobs/${MANIFEST_DIGEST}"

Expand All @@ -29,7 +23,11 @@ for LAYER in $(${YQ} ".[]" <<< $LAYERS); do
cp -f "${IMAGE_DIR}/blobs/${LAYER}" "${BLOBS_DIR}/${LAYER}.tar.gz"
done

repo_tags="${REPOTAGS}" \
# Replace newlines (unix or windows line endings) with % character.
# We can't pass newlines to yq due to https://github.com/mikefarah/yq/issues/1430 and
# we can't update YQ at the moment because structure_test depends on a specific version:
# see https://github.com/bazel-contrib/rules_oci/issues/212
repo_tags="$(tr -d '\r' < "${TAGS_FILE}" | tr '\n' '%')" \
config="blobs/${CONFIG_DIGEST}" \
layers="${LAYERS}" \
"${YQ}" eval \
Expand Down

0 comments on commit 2257c18

Please sign in to comment.