diff --git a/.github/workflows/test-k8s-ppc64le.yml b/.github/workflows/test-k8s-ppc64le.yml new file mode 100644 index 000000000..2edfc0fd7 --- /dev/null +++ b/.github/workflows/test-k8s-ppc64le.yml @@ -0,0 +1,62 @@ +name: Execute tests on k8s - PowerPC +on: + workflow_dispatch: + +env: + K8S_VERSION: "v1.31.0" + +jobs: + ocp-e2e-ci: + runs-on: PPC64LE + + steps: + - name: Checkout the kube-burner repository + uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + architecture: 'ppc64le' + # Disable caching to avoid error : Cannot open: File exists + # https://github.com/actions/setup-go/issues/314 + cache: false + + + - name: Install bats + uses: bats-core/bats-action@2.0.0 + with: + bats-version: 1.11.0 + support-install: false + assert-install: false + detik-install: false + file-install: false + + - name: Install dependencies + run: sudo yum install git podman make wget jq -y + + - name: Download kubectl binary + run: | + wget https://dl.k8s.io/${K8S_VERSION}/bin/linux/ppc64le/kubectl -O /tmp/kubectl --no-verbose + chmod +x /tmp/kubectl + + - name: Build and install kube-burner binary. + run: | + make build + cp bin/ppc64le/kube-burner /tmp + + - name: Build container images + run: make images + env: + VERSION: snapshot + + - name: Execute tests + run: | + export PATH=${PATH}:/tmp/ + make test-k8s + env: + TERM: linux + + - name: Clean up + run: | + rm -rf ${{ github.workspace }}/* + rm -rf /tmp/tmp* + rm /tmp/kube-burner diff --git a/Makefile b/Makefile index 34316fd73..b28d45cf4 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ .PHONY: build lint clean test help images push manifest manifest-build all -ARCH ?= amd64 +ARCH ?= $(shell uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) BIN_NAME = kube-burner BIN_DIR = bin BIN_PATH = $(BIN_DIR)/$(ARCH)/$(BIN_NAME) diff --git a/test/helpers.bash b/test/helpers.bash index 5ff320b23..b6dbdfe8e 100644 --- a/test/helpers.bash +++ b/test/helpers.bash @@ -5,25 +5,35 @@ KIND_VERSION=${KIND_VERSION:-v0.19.0} K8S_VERSION=${K8S_VERSION:-v1.27.0} OCI_BIN=${OCI_BIN:-podman} +ARCH=$(uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) setup-kind() { KIND_FOLDER=$(mktemp -d) echo "Downloading kind" - curl -LsS https://github.com/kubernetes-sigs/kind/releases/download/"${KIND_VERSION}"/kind-linux-amd64 -o ${KIND_FOLDER}/kind-linux-amd64 - chmod +x ${KIND_FOLDER}/kind-linux-amd64 + # Kind is currently unavailable for ppc64le architecture, it is required that the binary is built for usage. + if [[ "$ARCH" == "ppc64le" ]] + then + git clone --single-branch --filter=tree:0 --branch ${KIND_VERSION} https://github.com/kubernetes-sigs/kind.git + make -C kind/ install INSTALL_DIR="${KIND_FOLDER}" KIND_BINARY_NAME="kind-linux-${ARCH}" + IMAGE=quay.io/powercloud/kind-node:"${K8S_VERSION}" + else + curl -LsS https://github.com/kubernetes-sigs/kind/releases/download/"${KIND_VERSION}/kind-linux-${ARCH}" -o ${KIND_FOLDER}/kind-linux-${ARCH} + chmod +x ${KIND_FOLDER}/kind-linux-${ARCH} + IMAGE=kindest/node:"${K8S_VERSION}" + fi echo "Deploying cluster" - ${KIND_FOLDER}/kind-linux-amd64 create cluster --config kind.yml --image kindest/node:"${K8S_VERSION}" --name kind --wait 300s -v=1 + "${KIND_FOLDER}/kind-linux-${ARCH}" create cluster --config kind.yml --image ${IMAGE} --name kind --wait 300s -v=1 } create_test_kubeconfig() { echo "Creating another kubeconfig" - "${KIND_FOLDER}"/kind-linux-amd64 export kubeconfig --kubeconfig "${TEST_KUBECONFIG}" + "${KIND_FOLDER}/kind-linux-${ARCH}" export kubeconfig --kubeconfig "${TEST_KUBECONFIG}" kubectl config rename-context kind-kind "${TEST_KUBECONTEXT}" --kubeconfig "${TEST_KUBECONFIG}" } destroy-kind() { - echo "Destroying kind server" - "${KIND_FOLDER}"/kind-linux-amd64 delete cluster + echo "Destroying kind cluster" + "${KIND_FOLDER}/kind-linux-${ARCH}" delete cluster } setup-prometheus() {