Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: helm/kind-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.7.0
Choose a base ref
...
head repository: helm/kind-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.8.0
Choose a head ref
  • 3 commits
  • 6 files changed
  • 3 contributors

Commits on Jun 12, 2023

  1. Bump actions/checkout from 3.5.2 to 3.5.3 (#87)

    Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.2 to 3.5.3.
    - [Release notes](https://github.com/actions/checkout/releases)
    - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
    - [Commits](actions/checkout@8e5e7e5...c85c95e)
    
    ---
    updated-dependencies:
    - dependency-name: actions/checkout
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jun 12, 2023
    Copy the full SHA
    1307bb2 View commit details

Commits on Jul 11, 2023

  1. #54 ignore the occasional post delete cluster (#79)

    Signed-off-by: Jerry Chen <[email protected]>
    jerry153fish authored Jul 11, 2023
    Copy the full SHA
    a2c862b View commit details
  2. bump kind to v0.20.0 and script cleanup (#88)

    Signed-off-by: cpanato <[email protected]>
    cpanato authored Jul 11, 2023
    2
    Copy the full SHA
    dda0770 View commit details
Showing with 64 additions and 42 deletions.
  1. +23 −6 .github/workflows/test.yaml
  2. +3 −2 README.md
  3. +5 −1 action.yml
  4. +1 −1 cleanup.sh
  5. +31 −31 kind.sh
  6. +1 −1 main.sh
29 changes: 23 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Create kind cluster
uses: ./
@@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Create kind cluster with custom verbosity
uses: ./
@@ -42,7 +42,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Create kind cluster with custom name
uses: ./
@@ -58,7 +58,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Only install kind without starting a cluster
uses: ./
@@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Create kind cluster with custom name
uses: ./
@@ -89,7 +89,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Create kind cluster with custom name
uses: ./
@@ -100,3 +100,20 @@ jobs:
run: |
kubectl cluster-info
kubectl get nodes
test-with-ignore-failed-clean:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0

- name: Create kind cluster with custom name
uses: ./
with:
kubectl_version: "v1.24.6"
ignore_failed_clean: true

- name: Test
run: |
kubectl cluster-info
kubectl get nodes
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -15,14 +15,15 @@ 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`)
- `wait`: The duration to wait for the control plane to become ready (default: `60s`)
- `verbosity`: info log verbosity, higher value produces more output
- `kubectl_version`: The kubectl version to use (default: v1.26.4)
- `install_only`: Skips cluster creation, only install kind (default: false)
- `ignore_failed_clean`: Whether to ignore the post delete cluster action failing (default: false)

### Example Workflow

@@ -38,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.
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -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
@@ -34,6 +34,10 @@ inputs:
install_only:
description: "Skips cluster creation, only install kind (default: false)"
required: false
ignore_failed_clean:
description: "Whether to ignore the post-delete the cluster (default: false)"
default: false
required: false
runs:
using: "node16"
main: "main.js"
2 changes: 1 addition & 1 deletion cleanup.sh
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ main() {
args+=(--name "${DEFAULT_CLUSTER_NAME}")
fi

kind delete cluster "${args[@]}"
kind delete cluster "${args[@]}" || "${INPUT_IGNORE_FAILED_CLEAN}"
}

main
62 changes: 31 additions & 31 deletions kind.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
2 changes: 1 addition & 1 deletion main.sh
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ main() {
args+=(--install-only)
fi

"$SCRIPT_DIR/kind.sh" ${args[@]+"${args[@]}"}
"${SCRIPT_DIR}/kind.sh" ${args[@]+"${args[@]}"}
}

main