Skip to content

Commit 6cc3437

Browse files
feat(run-integration-test): Support pinned kubectl and helm versions (#65)
Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>
1 parent 720110f commit 6cc3437

3 files changed

Lines changed: 70 additions & 2 deletions

File tree

.scripts/actions/get_platform.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
# Get the platform/system as a lowercase string
4+
uname -s | tr '[:upper:]' '[:lower:]'

run-integration-test/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ profiles:
100100
| `test` | No | The name of the BeKu test (only used if running a `custom` test) |
101101
| `interu-version` | No | The interu version used by the action |
102102
| `beku-version` | No | The beku version used by the action |
103+
| `kubectl-version` | No | The kubectl version used by the action |
103104
| `kuttl-version` | No | The kubectl-kuttl version used by the action |
105+
| `helm-version` | No | The helm version used by the action |
104106
| `stackablectl-version` | No | The stackablectl version used by the action |
105107

106108
### Outputs

run-integration-test/action.yaml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,27 @@ inputs:
2121
# Tool versions
2222
interu-version:
2323
description: Version of interu
24+
# See https://github.com/stackabletech/actions/releases for latest version
2425
default: 0.2.0
2526
beku-version:
2627
description: Version of beku
28+
# See https://github.com/stackabletech/beku.py/releases for latest version
2729
default: 0.0.10
30+
kubectl-version:
31+
description: Version of kubectl
32+
# See https://dl.k8s.io/release/stable.txt for latest version
33+
default: v1.33.4
2834
kuttl-version:
2935
description: Version of kubectl-kuttl
36+
# See https://github.com/kudobuilder/kuttl/releases for latest version
3037
default: 0.22.0
38+
helm-version:
39+
description: Version of helm
40+
# See https://github.com/helm/helm/releases for latest version
41+
default: v3.18.6
3142
stackablectl-version:
3243
description: Version of stackablectl
44+
# See https://github.com/stackabletech/stackable-cockpit/releases for latest version
3345
default: 1.1.0
3446
outputs:
3547
start-time:
@@ -86,15 +98,65 @@ runs:
8698
# and are therefore not available, there is no need to create the cluster or run the tests,
8799
# because the tests can never run in the first place.
88100

89-
# We don't need to install kubectl, kind or helm because it is already part of the installed
90-
# tools of the runner image.
101+
# We technically don't need to install kubectl, kind or helm because it is already part of the installed
102+
# tools of the runner image, but we at least install kubectl and helm explicitly, to be able to pin the versions.
91103
# See https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/install-kubernetes-tools.sh
104+
- name: Install kubectl
105+
env:
106+
KUBECTL_VERSION: ${{ inputs.kubectl-version }}
107+
GITHUB_DEBUG: ${{ runner.debug }}
108+
shell: bash
109+
run: |
110+
set -euo pipefail
111+
[ -n "$GITHUB_DEBUG" ] && set -x
112+
113+
ARCH=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_architecture.sh")
114+
115+
echo "::group::Install kubectl"
116+
curl -fsSL -o /tmp/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl"
117+
# Overwrite the existing binary
118+
sudo install -m 755 -t /usr/local/bin /tmp/kubectl
119+
120+
kubectl version
121+
echo "::endgroup::"
122+
123+
- name: Install Helm
124+
env:
125+
HELM_VERSION: ${{ inputs.helm-version }}
126+
GITHUB_DEBUG: ${{ runner.debug }}
127+
shell: bash
128+
run: |
129+
set -euo pipefail
130+
[ -n "$GITHUB_DEBUG" ] && set -x
131+
132+
PLATFORM=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_platform.sh")
133+
ARCH=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_architecture.sh")
134+
135+
FILENAME="helm-${HELM_VERSION}-${PLATFORM}-${ARCH}.tar.gz"
136+
137+
echo "::group::Install helm"
138+
mkdir /tmp/helm
139+
curl -fsSL -o /tmp/helm/helm.tar.gz "https://get.helm.sh/${FILENAME}"
140+
curl -fsSL -o /tmp/helm/helm.tar.gz.asc "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${FILENAME}.asc"
141+
142+
curl https://keybase.io/mattfarina/pgp_keys.asc | gpg --import
143+
gpg --verify /tmp/helm/helm.tar.gz.asc /tmp/helm/helm.tar.gz
144+
145+
tar --directory="/tmp/helm" --strip-components=1 -zxvf /tmp/helm/helm.tar.gz "${PLATFORM}-${ARCH}"
146+
# Overwrite the existing binary
147+
sudo install -m 755 -t /usr/local/bin /tmp/helm/helm
148+
149+
helm version
150+
echo "::endgroup::"
151+
92152
- name: Install kubectl-kuttl
93153
env:
94154
KUTTL_VERSION: ${{ inputs.kuttl-version }}
155+
GITHUB_DEBUG: ${{ runner.debug }}
95156
shell: bash
96157
run: |
97158
set -euo pipefail
159+
[ -n "$GITHUB_DEBUG" ] && set -x
98160
99161
curl -fsSL -o /tmp/kubectl-kuttl "https://github.com/kudobuilder/kuttl/releases/download/v$KUTTL_VERSION/kubectl-kuttl_${KUTTL_VERSION}_linux_x86_64"
100162
sudo install -m 755 -t /usr/local/bin /tmp/kubectl-kuttl

0 commit comments

Comments
 (0)