Skip to content

Commit

Permalink
refactor: remote workdir workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn committed Oct 16, 2023
1 parent 4e125bf commit 14c29c3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 46 deletions.
11 changes: 4 additions & 7 deletions oci/private/image.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,16 @@ EOF
cat "${refs}"
}

function history() {
local ref="$1"
}

# this will redirect stderr(2) to stderr file.
{
source "${REGISTRY_LAUNCHER}"
readonly REGISTRY=$(start_registry "${STORAGE_DIR}" "${STDERR}")

OUTPUT=""
WORKDIR=""
FIXED_ARGS=()
ENV_EXPANSIONS=()

Expand All @@ -95,7 +98,6 @@ for ARG in "$@"; do
(oci:empty_base) FIXED_ARGS+=("$(empty_base $REGISTRY $@)") ;;
(oci:layout*) FIXED_ARGS+=("$(base_from_layout ${ARG/oci:layout\/} $REGISTRY)") ;;
(--output=*) OUTPUT="${ARG#--output=}" ;;
(--workdir=*) WORKDIR="${ARG#--workdir=}" ;;
(--env-file=*)
# NB: the '|| [-n $in]' expression is needed to process the final line, in case the input
# file doesn't have a trailing newline.
Expand Down Expand Up @@ -155,11 +157,6 @@ if [ ${#ENV_EXPANSIONS[@]} -ne 0 ]; then
REF=$("${CRANE}" mutate "${REF}" ${environment_args[@]})
fi

# TODO: https://github.com/google/go-containerregistry/issues/1515
if [ -n "${WORKDIR}" ]; then
REF=$("${CRANE}" config "${REF}" | "${JQ}" --arg workdir "${WORKDIR}" '.config.WorkingDir = $workdir' | "${CRANE}" edit config "${REF}")
fi

if [ -n "$OUTPUT" ]; then
"${CRANE}" pull "${REF}" "./${OUTPUT}" --format=oci
fi
Expand Down
78 changes: 40 additions & 38 deletions oci/private/versions.bzl
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
"Mirror of release info"

# WARNING: only v0.12.0 and above is supported.
# WARNING: only v0.15.1 and above is supported due to --workdir feature.
CRANE_VERSIONS = {
"v0.15.2": {
"darwin_arm64": "sha256-XPquVFIWvxd6ZKhSo/HxI7lYBDjOYIoOnNy02uK6F0c=",
"darwin_x86_64": "sha256-xzpmoZ4cwx0jKP07UvMZgZqb9sOKOA3/TfTeq6AsFHc=",
"linux_arm64": "sha256-r6C/VtlfqG/nHV2tteA5YLfAWG7qhCcMykC0Gm1h+7I=",
"linux_armv6": "sha256-xCwHYjAb2Gy+VPJbbwZJmLxI2FEnSRi1rxBmmcgzeeM=",
"linux_i386": "sha256-auD3v7isyLJTunFiDoteFyrDyA6eEV8s+wL0QbhIzGI=",
"linux_ppc64le": "sha256-SJh/KqiTi0sM2AJHxV+rTn5Is5WOsfLo5H4wSb/GkUI=",
"linux_s390x": "sha256-66RccOhj0T7NC+BGg6mgW1FvnDgXC1KV7sVM1BcA7xw=",
"linux_x86_64": "sha256-vV9yrpY3OsZAZ5phCCgLbXZph3PKIfKTrjDMF0E+KtE=",
"windows_arm64": "sha256-F/rbrozOPGEVeb/KEKJ/T3B0n26rvZ3/VBs2amTBz3c=",
"windows_armv6": "sha256-7vBk/IKCO1j5uECE32eZmrQAbAnzbxeNgye0BiqoLs4=",
"windows_x86_64": "sha256-1y42OZTiJt2C7of8xeqcwy2kiFeylXLf6+BvNS2Y13Y=",
},
"v0.14.0": {
"darwin_arm64": "sha256-8g+3rziZKW/OK2YPTHUWmvFDUhX6/zXInY/tVZaOb2E=",
"darwin_x86_64": "sha256-h+vdsXSnfez8MUgLMPLLg7tVqeyyRSxSJBatC/+yPRY=",
"linux_arm64": "sha256-8QeMgjli2vFNI9QBVKZVELU2TompycffP5kfGen+tAE=",
"linux_armv6": "sha256-geo5WbuD4mq8/ay2veV3XGj03AoMLbwIB4CR4kcKKG4=",
"linux_i386": "sha256-aLzfhkWKUXfIJ7u4IJ9tg54Gu4aEBwJAkyS/1ZHVT/Q=",
"linux_s390x": "sha256-L2aEmQerb9+ZEEwg5ZikzJjzpC2bu6kw9C8J4kOwRMc=",
"linux_x86_64": "sha256-W2j+D3/pFwuj4Wd/R+z8iSxoei/cvCsd45q16WY95dc=",
"windows_arm64": "sha256-F0gUInC2psNFGV68DhSnn8AalX/wOHhd5SH0RAixYpg=",
"windows_armv6": "sha256-WoSZPcKgphu9RBaMrY1huXaU0JnTh2FrKoV5KQbXHzk=",
"windows_x86_64": "sha256-0ZbFoXN6Deo3yVLoHlygcn4hGXvXMF8iVradTlXGJNA=",
},
"v0.12.0": {
"darwin_arm64": "sha256-JGUx0myrqV3ZPktKiFrvn6SdhOBAmG61mCqjxYQnEa8=",
"darwin_x86_64": "sha256-iO6yCJMD76cJWW5qncXShfaX/QT+6Q+DWURxo9WpQxs=",
"linux_arm64": "sha256-6UOCFY2oV0qOEhyvo2imibV4yYVVXw11Y8Rn74pbXYQ=",
"linux_armv6": "sha256-/f3JPlgHttVu/xaklKAAyXCRoAZKi1RZHQf4EdegTj0=",
"linux_i386": "sha256-Xv0VU3BXuSQcLgxsirsls/CEJeDRuhqBDhDRt+P2iss=",
"linux_s390x": "sha256-ioK8HWp0shvCtmrIobiLZA3ROGuePHy8XPN3ZRvc0QQ=",
"linux_x86_64": "sha256-u1K+/Ch5/zmMd+n0cAXabTj9mowFU21sRd1PgEC1p5o=",
"windows_arm64": "sha256-qxJw7Bfk45qOiFGLWMuG7zZahLKN2necKcqUyDUEtbw=",
"windows_armv6": "sha256-YKRi+clqdDlbYukFiupLgas3OdT7P2s2O6NuQ7jb6PM=",
"windows_x86_64": "sha256-SqbfgWZ+Ee9ve6F/0dkQ3YnRf8s4gFL42ATNezhhXDk=",
},
"v0.16.1": {
"darwin_arm64": "sha256-OgSfRI2SluHc01ZsWALiQbzU4Yc/mYoSKCRlXiDg10Q=",
"darwin_x86_64": "sha256-0AynKTFcu5FKFFQl2y49eoFsXB+DVFlxiBV64heyN34=",
"linux_arm64": "sha256-niJneTd6IHE/FqyU3sn2wX9piDTqQMM6bIb53ohFcis=",
"linux_armv6": "sha256-submkJ8j5DTlRA0E8om9KQ9+mMJBQotG0BAsYpn6NQ8=",
"linux_i386": "sha256-XXZ5/2Oz1poXNIbY9IOomRt2IDPAKN689md3nU5LqOU=",
"linux_ppc64le": "sha256-p7xthOifRHjqDB8owPkVlkAJJVUKYWeKQhIvtx9e/z8=",
"linux_s390x": "sha256-7yLdSqxExI4cSRIbQJaPfILy0Y+7Ze6fNmQpLb9abWk=",
"linux_x86_64": "sha256-EV3ITRTFrcicFuP6KX6U8GqexJK7Hccw2mJIULd8m+I=",
"windows_arm64": "sha256-H4CfiYT15fh9E9VRTeLYlv3/Ys+1Rnr2Gp1xAqFtpWE=",
"windows_armv6": "sha256-j6Oa4+kBYGOub0jlMSfUGNtpoCR0G/kACh4YB456PGE=",
"windows_x86_64": "sha256-iU9Nm6K8+07QE/f72n+WL3yS2+84/dFy1GdgdfTopRk="
},
"v0.15.2": {
"darwin_arm64": "sha256-XPquVFIWvxd6ZKhSo/HxI7lYBDjOYIoOnNy02uK6F0c=",
"darwin_x86_64": "sha256-xzpmoZ4cwx0jKP07UvMZgZqb9sOKOA3/TfTeq6AsFHc=",
"linux_arm64": "sha256-r6C/VtlfqG/nHV2tteA5YLfAWG7qhCcMykC0Gm1h+7I=",
"linux_armv6": "sha256-xCwHYjAb2Gy+VPJbbwZJmLxI2FEnSRi1rxBmmcgzeeM=",
"linux_i386": "sha256-auD3v7isyLJTunFiDoteFyrDyA6eEV8s+wL0QbhIzGI=",
"linux_ppc64le": "sha256-SJh/KqiTi0sM2AJHxV+rTn5Is5WOsfLo5H4wSb/GkUI=",
"linux_s390x": "sha256-66RccOhj0T7NC+BGg6mgW1FvnDgXC1KV7sVM1BcA7xw=",
"linux_x86_64": "sha256-vV9yrpY3OsZAZ5phCCgLbXZph3PKIfKTrjDMF0E+KtE=",
"windows_arm64": "sha256-F/rbrozOPGEVeb/KEKJ/T3B0n26rvZ3/VBs2amTBz3c=",
"windows_armv6": "sha256-7vBk/IKCO1j5uECE32eZmrQAbAnzbxeNgye0BiqoLs4=",
"windows_x86_64": "sha256-1y42OZTiJt2C7of8xeqcwy2kiFeylXLf6+BvNS2Y13Y="
},
"v0.15.1": {
"darwin_arm64": "sha256-KRDyztB0PThEG54QTJnR/P2C8YtNi5gyp2BpZWf38MY=",
"darwin_x86_64": "sha256-vb5/cJ1Z4Cgr+t8DDGjjbDSzYSEHXnmxSk1u72Iw7qA=",
"linux_arm64": "sha256-zgmSFvSu2y2ewfRKBb7930Umt24ye4v+E39MhgzdyWk=",
"linux_armv6": "sha256-LTHYDH27vd7rD+nSx1b3rv/HKP6+NKbW8kIqCsG5nDw=",
"linux_i386": "sha256-ygBgvnegB8ZGvCmGxxofpzBn0sv8aWliNWLuWBNLqjo=",
"linux_ppc64le": "sha256-txB7LESm2Efnvijky8wLopmF1nfRNGyS5hR+Do7mQYs=",
"linux_s390x": "sha256-XP0hOM9sMJa2Yswqto6lmHwT1ikLuk8Zr52nXiy+qLk=",
"linux_x86_64": "sha256-1HEAFKO9E16x1KkUL1Cc/WHSviQuX1eFeI5AREik8/I=",
"windows_arm64": "sha256-l2lNNWRXmINRxsjw5IkPYlcZZ/Rzq+Lb61fU0Dg6L9I=",
"windows_armv6": "sha256-tL5J2j3awNTLPQGJxNHyUGpITlYL5lSXt5tG8lJn6v8=",
"windows_x86_64": "sha256-xHg40Qt2FlYL2WORrnguB6dEml8Jxt/5jxwn8mlCTmA="
}
}

ZOT_VERSIONS = {
Expand Down
2 changes: 1 addition & 1 deletion scripts/mirror_releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ REPOSITORY=${1:-"google/go-containerregistry"}
(
curl --silent \
--header "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${REPOSITORY}/releases?per_page=1 \
https://api.github.com/repos/${REPOSITORY}/releases?per_page=4 \
| jq -f $SCRIPT_DIR/filter.jq
) > $RAW

Expand Down

0 comments on commit 14c29c3

Please sign in to comment.