Skip to content

Commit 7279ffd

Browse files
authored
feat: Add setup-tools and setup-k8s-tools actions (#69)
* feat: Add setup-tools and setup-k8s-tools actions * refactor(run-integration-test): Use new actions to install tools * chore: Rename smoke build workflow
1 parent 075e2bb commit 7279ffd

File tree

7 files changed

+224
-88
lines changed

7 files changed

+224
-88
lines changed

.github/workflows/pr_actions-smoke-test.yml renamed to .github/workflows/smoke-build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
name: actions-smoke-test
2+
name: smoke-build
33

44
on:
55
workflow_dispatch:
66
pull_request:
77
paths:
8-
- .github/workflows/pr_actions-smoke-test.yml
8+
- .github/workflows/smoke-build.yaml
99
- build-container-image/action.yaml
1010
- build-product-image/action.yaml
1111
- free-disk-space/action.yaml

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ particular step in a workflow.
2828
- [run-integration-test](./run-integration-test/README.md)
2929
- [run-pre-commit](./run-pre-commit/README.md)
3030
- [send-slack-notification](./send-slack-notification/README.md)
31+
- [setup-k8s-tools](./setup-k8s-tools/README.md)
32+
- [setup-tools](./setup-tools/README.md)
3133
- [shard](./shard/README.md)
3234
<!-- end:links -->

run-integration-test/action.yaml

Lines changed: 16 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,16 @@ outputs:
5959
runs:
6060
using: composite
6161
steps:
62+
- name: Install interu
63+
uses: stackabletech/actions/setup-tools
64+
with:
65+
interu-version: ${{ inputs.interu-version }}
6266
- name: Extract Test and Instance Configuration
6367
env:
6468
TEST_MODE_INPUT: ${{ inputs.test-mode-input }}
6569
TEST_SUITE: ${{ inputs.test-suite }}
6670
TEST_MODE: ${{ inputs.test-mode }}
6771
TEST: ${{ inputs.test }}
68-
INTERU_VERSION: ${{ inputs.interu-version }}
6972
GITHUB_DEBUG: ${{ runner.debug }}
7073
GITHUB_REPOSITORY: ${{ github.repository }}
7174
GITHUB_RUN_ID: ${{ github.run_id }}"
@@ -74,10 +77,6 @@ runs:
7477
set -euo pipefail
7578
[ -n "$GITHUB_DEBUG" ] && set -x
7679
77-
# Download interu
78-
curl -fsSL -o /tmp/interu "https://github.com/stackabletech/actions/releases/download/interu-$INTERU_VERSION/interu-x86_64-unknown-linux-gnu"
79-
sudo install -m 755 -t /usr/local/bin /tmp/interu
80-
8180
# Generate the cluster name
8281
echo "KUBERNETES_CLUSTER_NAME=integration-test-${GITHUB_REPOSITORY}-${GITHUB_RUN_ID}" | tee -a "$GITHUB_ENV"
8382
@@ -97,93 +96,24 @@ runs:
9796
# Install all tools BEFORE creating the cluster, because if some of the tools fail to download
9897
# and are therefore not available, there is no need to create the cluster or run the tests,
9998
# because the tests can never run in the first place.
100-
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.
103-
# 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 --client
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 --short
150-
echo "::endgroup::"
151-
152-
- name: Install kubectl-kuttl
153-
env:
154-
KUTTL_VERSION: ${{ inputs.kuttl-version }}
155-
GITHUB_DEBUG: ${{ runner.debug }}
156-
shell: bash
157-
run: |
158-
set -euo pipefail
159-
[ -n "$GITHUB_DEBUG" ] && set -x
160-
161-
curl -fsSL -o /tmp/kubectl-kuttl "https://github.com/kudobuilder/kuttl/releases/download/v$KUTTL_VERSION/kubectl-kuttl_${KUTTL_VERSION}_linux_x86_64"
162-
sudo install -m 755 -t /usr/local/bin /tmp/kubectl-kuttl
99+
- name: Install kubectl, kubectl-kuttl, and helm
100+
uses: stackablectl/actions/setup-k8s-tools
101+
with:
102+
kubectl-version: ${{ inputs.kubectl-version }}
103+
kuttl-version: ${{ inputs.kuttl-version }}
104+
helm-version: ${{ inputs.helm-version }}
163105

164106
# Python3 is already installed, if we ever need to specify the version, we can use the
165107
# setup-python action.
166108
# See https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/install-python.sh
167-
- name: Install beku
168-
env:
169-
BEKU_VERSION: ${{ inputs.beku-version }}
170-
shell: bash
171-
run: |
172-
set -euo pipefail
173-
pip install "beku-stackabletech==$BEKU_VERSION"
174-
109+
#
175110
# mikefarah/yq is already installed on the runner
176111
# See https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/install-yq.sh
177-
178-
- name: Install stackablectl
179-
env:
180-
STACKABLECTL_VERSION: ${{ inputs.stackablectl-version }}
181-
shell: bash
182-
run: |
183-
set -euo pipefail
184-
185-
curl -fsSL -o /tmp/stackablectl "https://github.com/stackabletech/stackable-cockpit/releases/download/stackablectl-$STACKABLECTL_VERSION/stackablectl-x86_64-unknown-linux-gnu"
186-
sudo install -m 755 -t /usr/local/bin /tmp/stackablectl
112+
- name: Install stackablectl and beku
113+
uses: stackabletech/actions/setup-tools
114+
with:
115+
stackablectl-version: ${{ inputs.stackablectl-version }}
116+
beku-version: ${{ inputs.beku-version }}
187117

188118
- name: Install apt packages
189119
shell: bash

setup-k8s-tools/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# `setup-k8s-tools`
2+
3+
> Manifest: [setup-k8s-tools/action.yml][setup-k8s-tools]
4+
5+
This action downloads and installs Kubernetes tools.
6+
7+
## Inputs and Outputs
8+
9+
> [!TIP]
10+
> For descriptions of the inputs and outputs, see the complete [setup-k8s-tools] action.
11+
12+
### Inputs
13+
14+
| Input | Required | Description |
15+
| ----------------- | -------- | ----------------------------- |
16+
| `kubectl-version` | No | The version of kubectl* |
17+
| `kuttl-version` | No | The version of kubectl-kuttl* |
18+
| `helm-version` | No | The version of helm* |
19+
20+
\* If no input is set, the tool won't be installed.
21+
22+
### Outputs
23+
24+
None.
25+
26+
[setup-k8s-tools]: ./action.yaml

setup-k8s-tools/action.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
name: Setup Kubernetes Tools
3+
description: This action sets up Kubernetes tools
4+
inputs:
5+
kubectl-version:
6+
description: The version of kubectl
7+
kuttl-version:
8+
description: The version of kubectl-kuttl
9+
helm-version:
10+
description: The version of helm
11+
runs:
12+
using: composite
13+
steps:
14+
# We technically don't need to install kubectl, kind or helm because it is already part of the installed
15+
# tools of the runner image, but we at least install kubectl and helm explicitly, to be able to pin the versions.
16+
# See https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/install-kubernetes-tools.sh
17+
- name: Install kubectl
18+
if: inputs.kubectl-version
19+
env:
20+
KUBECTL_VERSION: ${{ inputs.kubectl-version }}
21+
GITHUB_DEBUG: ${{ runner.debug }}
22+
shell: bash
23+
run: |
24+
set -euo pipefail
25+
[ -n "$GITHUB_DEBUG" ] && set -x
26+
27+
ARCH=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_architecture.sh")
28+
29+
echo "::group::Install kubectl"
30+
curl -fsSL -o /tmp/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl"
31+
# Overwrite the existing binary
32+
sudo install -m 755 -t /usr/local/bin /tmp/kubectl
33+
34+
kubectl version --client
35+
echo "::endgroup::"
36+
37+
- name: Install kubectl-kuttl
38+
if: inputs.kuttl-version
39+
env:
40+
KUTTL_VERSION: ${{ inputs.kuttl-version }}
41+
GITHUB_DEBUG: ${{ runner.debug }}
42+
shell: bash
43+
run: |
44+
set -euo pipefail
45+
[ -n "$GITHUB_DEBUG" ] && set -x
46+
47+
echo "::group::Install kubectl-kuttl"
48+
curl -fsSL -o /tmp/kubectl-kuttl "https://github.com/kudobuilder/kuttl/releases/download/v$KUTTL_VERSION/kubectl-kuttl_${KUTTL_VERSION}_linux_x86_64"
49+
sudo install -m 755 -t /usr/local/bin /tmp/kubectl-kuttl
50+
echo "::endgroup::"
51+
52+
- name: Install Helm
53+
if: inputs.helm-version
54+
env:
55+
HELM_VERSION: ${{ inputs.helm-version }}
56+
GITHUB_DEBUG: ${{ runner.debug }}
57+
shell: bash
58+
run: |
59+
set -euo pipefail
60+
[ -n "$GITHUB_DEBUG" ] && set -x
61+
62+
PLATFORM=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_platform.sh")
63+
ARCH=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_architecture.sh")
64+
65+
FILENAME="helm-${HELM_VERSION}-${PLATFORM}-${ARCH}.tar.gz"
66+
67+
echo "::group::Install helm"
68+
mkdir /tmp/helm
69+
curl -fsSL -o /tmp/helm/helm.tar.gz "https://get.helm.sh/${FILENAME}"
70+
curl -fsSL -o /tmp/helm/helm.tar.gz.asc "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${FILENAME}.asc"
71+
72+
curl https://keybase.io/mattfarina/pgp_keys.asc | gpg --import
73+
gpg --verify /tmp/helm/helm.tar.gz.asc /tmp/helm/helm.tar.gz
74+
75+
tar --directory="/tmp/helm" --strip-components=1 -zxvf /tmp/helm/helm.tar.gz "${PLATFORM}-${ARCH}"
76+
# Overwrite the existing binary
77+
sudo install -m 755 -t /usr/local/bin /tmp/helm/helm
78+
79+
helm version --short
80+
echo "::endgroup::"

setup-tools/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# `setup-tools`
2+
3+
> Manifest: [setup-tools/action.yml][setup-tools]
4+
5+
This action downloads and installs Stackable tools.
6+
7+
## Inputs and Outputs
8+
9+
> [!TIP]
10+
> For descriptions of the inputs and outputs, see the complete [setup-tools] action.
11+
12+
### Inputs
13+
14+
| Input | Required | Description |
15+
| ---------------------- | -------- | ---------------------------- |
16+
| `boil-version` | No | The version of boil* |
17+
| `stackablectl-version` | No | The version of stackablectl* |
18+
| `interu-version` | No | The version of interu* |
19+
| `beku-version` | No | The version of beku* |
20+
21+
\* If no input is set, the tool won't be installed.
22+
23+
### Outputs
24+
25+
None.
26+
27+
[setup-tools]: ./action.yaml

setup-tools/action.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: Setup Stackable Tools
3+
description: This action sets up Stackable tools
4+
inputs:
5+
boil-version:
6+
description: The version of boil
7+
stackablectl-version:
8+
description: The version of stackablectl
9+
interu-version:
10+
description: The version of interu
11+
beku-version:
12+
description: The version of beku
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Install boil
17+
if: inputs.boil-version
18+
env:
19+
BOIL_VERSION: ${{ inputs.boil-version }}
20+
GITHUB_DEBUG: ${{ runner.debug }}
21+
shell: bash
22+
run: |
23+
set -euo pipefail
24+
[ -n "$GITHUB_DEBUG" ] && set -x
25+
26+
ARCH=$(uname -m)
27+
28+
curl -fsSL -o /tmp/boil "https://github.com/stackabletech/docker-images/releases/download/boil-${BOIL_VERSION}/boil-${ARCH}-unknown-linux-gnu"
29+
sudo install -m 755 -t /usr/local/bin /tmp/boil
30+
31+
- name: Install stackablectl
32+
if: inputs.stackablectl-version
33+
env:
34+
STACKABLECTL_VERSION: ${{ inputs.stackablectl-version }}
35+
GITHUB_DEBUG: ${{ runner.debug }}
36+
shell: bash
37+
run: |
38+
set -euo pipefail
39+
[ -n "$GITHUB_DEBUG" ] && set -x
40+
41+
ARCH=$(uname -m)
42+
43+
curl -fsSL -o /tmp/stackablectl "https://github.com/stackabletech/stackable-cockpit/releases/download/stackablectl-${STACKABLECTL_VERSION}/stackablectl-${ARCH}-unknown-linux-gnu"
44+
sudo install -m 755 -t /usr/local/bin /tmp/stackablectl
45+
46+
- name: Install interu
47+
if: inputs.interu-version
48+
env:
49+
INTERU_VERSION: ${{ inputs.interu-version }}
50+
GITHUB_DEBUG: ${{ runner.debug }}
51+
shell: bash
52+
run: |
53+
set -euo pipefail
54+
[ -n "$GITHUB_DEBUG" ] && set -x
55+
56+
ARCH=$(uname -m)
57+
58+
curl -fsSL -o /tmp/interu "https://github.com/stackabletech/actions/releases/download/interu-${INTERU_VERSION}/interu-${ARCH}-unknown-linux-gnu"
59+
sudo install -m 755 -t /usr/local/bin /tmp/interu
60+
61+
- name: Install beku
62+
if: inputs.beku-version
63+
env:
64+
BEKU_VERSION: ${{ inputs.beku-version }}
65+
GITHUB_DEBUG: ${{ runner.debug }}
66+
shell: bash
67+
run: |
68+
set -euo pipefail
69+
[ -n "$GITHUB_DEBUG" ] && set -x
70+
71+
pip install "beku-stackabletech==$BEKU_VERSION"

0 commit comments

Comments
 (0)