-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add crust-gather collection for e2e run
Signed-off-by: Danil Grigorev <danil.grigorev@suse.com>
- Loading branch information
1 parent
d6d6c17
commit 58bb752
Showing
7 changed files
with
165 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright © 2023 - 2024 SUSE LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
if [[ "${TRACE-0}" == "1" ]]; then | ||
set -o xtrace | ||
fi | ||
|
||
# shellcheck source=./hack/utils.sh | ||
source "$(dirname "${BASH_SOURCE[0]}")/utils.sh" | ||
|
||
GOPATH_BIN="$(go env GOPATH)/bin/" | ||
MINIMUM_KUBECTL_VERSION=v1.27.0 | ||
goarch="$(go env GOARCH)" | ||
goos="$(go env GOOS)" | ||
|
||
# Ensure the kubectl tool exists and is a viable version, or installs it | ||
verify_kubectl_version() { | ||
|
||
# If kubectl is not available on the path, get it | ||
if ! [ -x "$(command -v kubectl)" ]; then | ||
if [ "$goos" == "linux" ] || [ "$goos" == "darwin" ]; then | ||
if ! [ -d "${GOPATH_BIN}" ]; then | ||
mkdir -p "${GOPATH_BIN}" | ||
fi | ||
echo 'kubectl not found, installing' | ||
curl -sLo "${GOPATH_BIN}/kubectl" "https://dl.k8s.io/release/${MINIMUM_KUBECTL_VERSION}/bin/${goos}/${goarch}/kubectl" | ||
chmod +x "${GOPATH_BIN}/kubectl" | ||
verify_gopath_bin | ||
else | ||
echo "Missing required binary in path: kubectl" | ||
return 2 | ||
fi | ||
fi | ||
|
||
local kubectl_version | ||
IFS=" " read -ra kubectl_version <<< "$(kubectl version --client)" | ||
if [[ "${MINIMUM_KUBECTL_VERSION}" != $(echo -e "${MINIMUM_KUBECTL_VERSION}\n${kubectl_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) ]]; then | ||
cat <<EOF | ||
Detected kubectl version: ${kubectl_version[2]}. | ||
Requires ${MINIMUM_KUBECTL_VERSION} or greater. | ||
Please install ${MINIMUM_KUBECTL_VERSION} or later. | ||
EOF | ||
return 2 | ||
fi | ||
} | ||
|
||
install_plugins() { | ||
( | ||
set -x; cd "$(mktemp -d)" && | ||
OS="$(uname | tr '[:upper:]' '[:lower:]')" && | ||
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && | ||
KREW="krew-${OS}_${ARCH}" && | ||
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && | ||
tar zxvf "${KREW}.tar.gz" && | ||
./"${KREW}" install krew | ||
) | ||
kubectl krew index add crust-gather https://github.com/crust-gather/crust-gather.git || true | ||
kubectl krew install crust-gather/crust-gather | ||
} | ||
|
||
verify_kubectl_version | ||
install_plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright © 2023 - 2024 SUSE LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# get_root_path returns the root path of the project source tree | ||
get_root_path() { | ||
git rev-parse --show-toplevel | ||
} | ||
|
||
# cd_root_path cds to the root path of the project source tree | ||
cd_root_path() { | ||
cd "$(get_root_path)" || exit | ||
} | ||
|
||
# ensure GOPATH/bin is in PATH as we may install binaries to that directory in | ||
# other ensure-* scripts, and expect them to be found in PATH later on | ||
verify_gopath_bin() { | ||
local gopath_bin | ||
|
||
gopath_bin="$(go env GOPATH)/bin" | ||
if ! printenv PATH | grep -q "${gopath_bin}"; then | ||
cat <<EOF | ||
error: \$GOPATH/bin=${gopath_bin} is not in your PATH. | ||
See https://go.dev/doc/gopath_code for more instructions. | ||
EOF | ||
return 2 | ||
fi | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters