From dda0770415bac9fc20092cacbc54aa298604d140 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Tue, 11 Jul 2023 14:17:59 +0200 Subject: [PATCH] bump kind to v0.20.0 and script cleanup (#88) Signed-off-by: cpanato --- README.md | 4 ++-- action.yml | 2 +- kind.sh | 62 +++++++++++++++++++++++++++--------------------------- main.sh | 2 +- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 95bddde..5fa875a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ For more information, reference the GitHub Help Documentation for [Creating a wo For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input) -- `version`: The kind version to use (default: `v0.19.0`) +- `version`: The kind version to use (default: `v0.20.0`) - `config`: The path to the kind config file - `node_image`: The Docker image for the cluster nodes - `cluster_name`: The name of the cluster to create (default: `chart-testing`) @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Create k8s Kind Cluster - uses: helm/kind-action@v1.4.0 + uses: helm/kind-action@v1.5.0 ``` This uses [@helm/kind-action](https://www.github.com/helm/kind-action) GitHub Action to spin up a [kind](https://kind.sigs.k8s.io/) Kubernetes cluster on every Pull Request. diff --git a/action.yml b/action.yml index f953147..707d74c 100644 --- a/action.yml +++ b/action.yml @@ -8,7 +8,7 @@ inputs: version: description: "The kind version to use (default: v0.19.0)" required: false - default: "v0.19.0" + default: "v0.20.0" config: description: "The path to the kind config file" required: false diff --git a/kind.sh b/kind.sh index 60677fe..915d6b7 100755 --- a/kind.sh +++ b/kind.sh @@ -18,9 +18,9 @@ set -o errexit set -o nounset set -o pipefail -DEFAULT_KIND_VERSION=v0.19.0 +DEFAULT_KIND_VERSION=v0.20.0 DEFAULT_CLUSTER_NAME=chart-testing -DEFAULT_KUBECTL_VERSION=v1.26.4 +DEFAULT_KUBECTL_VERSION=v1.26.6 show_help() { cat << EOF @@ -40,19 +40,19 @@ EOF } main() { - local version="$DEFAULT_KIND_VERSION" + local version="${DEFAULT_KIND_VERSION}" local config= local node_image= - local cluster_name="$DEFAULT_CLUSTER_NAME" + local cluster_name="${DEFAULT_CLUSTER_NAME}" local wait=60s local verbosity= - local kubectl_version="$DEFAULT_KUBECTL_VERSION" + local kubectl_version="${DEFAULT_KUBECTL_VERSION}" local install_only=false parse_command_line "$@" - if [[ ! -d "$RUNNER_TOOL_CACHE" ]]; then - echo "Cache directory '$RUNNER_TOOL_CACHE' does not exist" >&2 + if [[ ! -d "${RUNNER_TOOL_CACHE}" ]]; then + echo "Cache directory '${RUNNER_TOOL_CACHE}' does not exist" >&2 exit 1 fi @@ -63,28 +63,28 @@ main() { x86_64) arch="amd64" ;; arm|aarch64) dpkg --print-architecture | grep -q "arm64" && arch="arm64" || arch="arm" ;; esac - local cache_dir="$RUNNER_TOOL_CACHE/kind/$version/$arch" + local cache_dir="${RUNNER_TOOL_CACHE}/kind/${version}/${arch}" - local kind_dir="$cache_dir/kind/bin/" - if [[ ! -x "$kind_dir/kind" ]]; then + local kind_dir="${cache_dir}/kind/bin/" + if [[ ! -x "${kind_dir}/kind" ]]; then install_kind fi echo 'Adding kind directory to PATH...' - echo "$kind_dir" >> "$GITHUB_PATH" + echo "${kind_dir}" >> "${GITHUB_PATH}" - local kubectl_dir="$cache_dir/kubectl/bin/" - if [[ ! -x "$kubectl_dir/kubectl" ]]; then + local kubectl_dir="${cache_dir}/kubectl/bin/" + if [[ ! -x "${kubectl_dir}/kubectl" ]]; then install_kubectl fi echo 'Adding kubectl directory to PATH...' - echo "$kubectl_dir" >> "$GITHUB_PATH" + echo "${kubectl_dir}" >> "${GITHUB_PATH}" - "$kind_dir/kind" version - "$kubectl_dir/kubectl" version --client=true + "${kind_dir}/kind" version + "${kubectl_dir}/kubectl" version --client=true - if [[ "$install_only" == false ]]; then + if [[ "${install_only}" == false ]]; then create_kind_cluster fi } @@ -186,38 +186,38 @@ parse_command_line() { install_kind() { echo 'Installing kind...' - mkdir -p "$kind_dir" + mkdir -p "${kind_dir}" - curl -sSLo "$kind_dir/kind" "https://github.com/kubernetes-sigs/kind/releases/download/$version/kind-linux-$arch" - chmod +x "$kind_dir/kind" + curl -sSLo "${kind_dir}/kind" "https://github.com/kubernetes-sigs/kind/releases/download/${version}/kind-linux-${arch}" + chmod +x "${kind_dir}/kind" } install_kubectl() { echo 'Installing kubectl...' - mkdir -p "$kubectl_dir" + mkdir -p "${kubectl_dir}" - curl -sSLo "$kubectl_dir/kubectl" "https://storage.googleapis.com/kubernetes-release/release/$kubectl_version/bin/linux/$arch/kubectl" - chmod +x "$kubectl_dir/kubectl" + curl -sSLo "${kubectl_dir}/kubectl" "https://storage.googleapis.com/kubernetes-release/release/${kubectl_version}/bin/linux/${arch}/kubectl" + chmod +x "${kubectl_dir}/kubectl" } create_kind_cluster() { echo 'Creating kind cluster...' - local args=(create cluster "--name=$cluster_name" "--wait=$wait") + local args=(create cluster "--name=${cluster_name}" "--wait=${wait}") - if [[ -n "$node_image" ]]; then - args+=("--image=$node_image") + if [[ -n "${node_image}" ]]; then + args+=("--image=${node_image}") fi - if [[ -n "$config" ]]; then - args+=("--config=$config") + if [[ -n "${config}" ]]; then + args+=("--config=${config}") fi - if [[ -n "$verbosity" ]]; then - args+=("--verbosity=$verbosity") + if [[ -n "${verbosity}" ]]; then + args+=("--verbosity=${verbosity}") fi - "$kind_dir/kind" "${args[@]}" + "${kind_dir}/kind" "${args[@]}" } main "$@" diff --git a/main.sh b/main.sh index 6fa5185..ff1a021 100755 --- a/main.sh +++ b/main.sh @@ -55,7 +55,7 @@ main() { args+=(--install-only) fi - "$SCRIPT_DIR/kind.sh" ${args[@]+"${args[@]}"} + "${SCRIPT_DIR}/kind.sh" ${args[@]+"${args[@]}"} } main