Skip to content

Commit

Permalink
[kube-prometheus-stack] use gtar on mac
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Jan 15, 2025
1 parent 6844d4f commit 72562f9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
Binary file modified charts/kube-prometheus-stack/charts/crds/files/crds.tar.xz
Binary file not shown.
21 changes: 9 additions & 12 deletions charts/kube-prometheus-stack/ci/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@ set -euo pipefail

cd "${SCRIPT_DIR}/../"

cp charts/crds/files/crds.tar.xz /tmp/crds.tar.xz

./hack/update_crds.sh
if ! git diff "$GITHUB_SHA" --color=always --exit-code -- ':!*.tar.xz'; then
if ! git diff "$GITHUB_SHA" --color=always --exit-code; then
echo "Please run ./hack/update_crds.sh"
exit 1
fi

cd "${SCRIPT_DIR}/../charts/crds/crds/"
echo "Diff:"
git diff --color=always <(
strings /tmp/crds.tar.xz
) <(
strings charts/crds/files/crds.tar.xz
)

rm ./*.yaml

tar xJf "${SCRIPT_DIR}/../charts/crds/files/crds.tar.xz"

if ! git diff "$GITHUB_SHA" --color=always --exit-code -- ':!*.tar.xz'; then
echo "Suspicious crds.tar.xz. Please run ./hack/update_crds.sh"
exit 1
fi

cd "${SCRIPT_DIR}/../"

cd hack

export PIP_DISABLE_PIP_VERSION_CHECK=1
Expand Down
21 changes: 18 additions & 3 deletions charts/kube-prometheus-stack/hack/update_crds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,23 @@ for line in "${FILES[@]}"; do
fi
done

_TAR=$(which gtar 2>/dev/null || which tar 2>/dev/null)

case $($_TAR --help) in
*GNU*) ;;
*)
echo "Please install GNU tar"
echo "On macOS: brew install gnu-tar"
exit 1
;;
esac

cd "${SCRIPT_DIR}/../charts/crds/crds/"

# COPYFILE_DISABLE is used to prevent tar from including BSD metadata in the tarball
# ref: https://unix.stackexchange.com/a/282142/433641
env COPYFILE_DISABLE=1 tar cJf ../files/crds.tar.xz crd-*
$_TAR --sort=name --format=posix \
--pax-option='exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime,delete=btime,delete=mtime' \
--mtime="@0" \
--numeric-owner --owner=0 --group=0 \
--mode='go+u,go-w' \
--no-xattrs --no-acls --no-selinux \
--xz -cf ../files/crds.tar.xz crd-*.yaml

0 comments on commit 72562f9

Please sign in to comment.