From 309fd86b4584be8f4534747f4792babae17504a3 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Wed, 8 Dec 2021 15:50:42 +0200 Subject: [PATCH] Run ARM64 e2e tests on Equinix hardware Signed-off-by: Stefan Prodan --- .github/runners/README.md | 74 +++++++++++++++++-------- .github/runners/{arm64.sh => prereq.sh} | 16 +----- .github/runners/runner-setup.sh | 37 +++++++++++++ .github/workflows/e2e-arm64.yaml | 9 ++- 4 files changed, 95 insertions(+), 41 deletions(-) rename .github/runners/{arm64.sh => prereq.sh} (82%) create mode 100755 .github/runners/runner-setup.sh diff --git a/.github/runners/README.md b/.github/runners/README.md index 29caf855..a7964234 100644 --- a/.github/runners/README.md +++ b/.github/runners/README.md @@ -1,42 +1,72 @@ -# Flux GitHub runners +# Flux ARM64 GitHub runners -How to provision GitHub Actions self-hosted runners for Flux conformance testing. +The Flux ARM64 end-to-end tests run on Equinix instances provisioned with Docker and GitHub self-hosted runners. -## ARM64 Instance specs +## Current instances -In order to add a new runner to the GitHub Actions pool, -first create an instance on Oracle Cloud with the following configuration: -- OS: Canonical Ubuntu 20.04 -- Shape: VM.Standard.A1.Flex -- OCPU Count: 2 -- Memory (GB): 12 -- Network Bandwidth (Gbps): 2 -- Local Disk: Block Storage Only +| Runner | Instance | Region | +|---------------|---------------------|--------| +| equinix-arm-1 | flux-equinix-arm-01 | AMS1 | +| equinix-arm-2 | flux-equinix-arm-01 | AMS1 | +| equinix-arm-3 | flux-equinix-arm-01 | AMS1 | +| equinix-arm-4 | flux-equinix-arm-02 | DFW2 | +| equinix-arm-5 | flux-equinix-arm-02 | DFW2 | +| equinix-arm-6 | flux-equinix-arm-02 | DFW2 | + +## Instance setup -Note that the instance image source must be **Canonical Ubuntu** instead of the default Oracle Linux. +In order to add a new runner to the GitHub Actions pool, +first create a server on Equinix with the following configuration: +- Type: c2.large.arm +- OS: Ubuntu 20.04 -## ARM64 Instance setup +### Install prerequisites - SSH into a newly created instance ```shell -ssh ubuntu@ +ssh root@ ``` -- Create the action runner dir + +- Create the ubuntu user +```shell +adduser ubuntu +usermod -aG sudo ubuntu +su - ubuntu +``` + +- Create the prerequisites dir ```shell -mkdir -p actions-runner && cd actions-runner +mkdir -p prereq && cd prereq ``` -- Download the provisioning script + +- Download the prerequisites script ```shell -curl -sL https://raw.githubusercontent.com/fluxcd/flux2/main/.github/runners/arm64.sh > arm64.sh \ - && chmod +x ./arm64.sh +curl -sL https://raw.githubusercontent.com/fluxcd/flux2/main/.github/runners/prereq.sh > prereq.sh \ + && chmod +x ./prereq.sh ``` + +- Install the prerequisites +```shell +sudo ./prereq.sh +``` + +### Install runners + - Retrieve the GitHub runner token from the repository [settings page](https://github.com/fluxcd/flux2/settings/actions/runners/new?arch=arm64&os=linux) -- Run the provisioning script passing the token as the first argument + +- Create 3 directories `runner1`, `runner2`, `runner3` + +- In each dir run: ```shell -sudo ./arm64.sh +curl -sL https://raw.githubusercontent.com/fluxcd/flux2/main/.github/runners/runner-setup.sh > runner-setup.sh \ + && chmod +x ./runner-setup.sh + +./runner-setup.sh equinix-arm- ``` + - Reboot the instance ```shell sudo reboot -``` +``` + - Navigate to the GitHub repository [runners page](https://github.com/fluxcd/flux2/settings/actions/runners) and check the runner status diff --git a/.github/runners/arm64.sh b/.github/runners/prereq.sh similarity index 82% rename from .github/runners/arm64.sh rename to .github/runners/prereq.sh index 2cc1026a..08854da0 100755 --- a/.github/runners/arm64.sh +++ b/.github/runners/prereq.sh @@ -14,19 +14,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script is meant to be run locally and in CI to validate the Kubernetes -# manifests (including Flux custom resources) before changes are merged into -# the branch synced by Flux in-cluster. +# This script installs the prerequisites for running Flux end-to-end tests with Docker and GitHub self-hosted runners. set -eu -REPOSITORY_TOKEN=$1 -REPOSITORY_URL=${2:-https://github.com/fluxcd/flux2} - KIND_VERSION=0.11.1 KUBECTL_VERSION=1.21.2 KUSTOMIZE_VERSION=4.1.3 -GITHUB_RUNNER_VERSION=2.278.0 +GITHUB_RUNNER_VERSION=2.285.1 PACKAGES="apt-transport-https ca-certificates software-properties-common build-essential libssl-dev gnupg lsb-release jq" # install prerequisites @@ -64,10 +59,3 @@ curl -o actions-runner-linux-arm64.tar.gz -L https://github.com/actions/runner/r # install runner dependencies ./bin/installdependencies.sh - -# register runner with GitHub -sudo -u ubuntu ./config.sh --unattended --url ${REPOSITORY_URL} --token ${REPOSITORY_TOKEN} - -# start runner -./svc.sh install -./svc.sh start diff --git a/.github/runners/runner-setup.sh b/.github/runners/runner-setup.sh new file mode 100755 index 00000000..cef53faf --- /dev/null +++ b/.github/runners/runner-setup.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Copyright 2021 The Flux authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script installs a GitHub self-hosted ARM64 runner for running Flux end-to-end tests. + +set -eu + +RUNNER_NAME=$1 +REPOSITORY_TOKEN=$2 +REPOSITORY_URL=${3:-https://github.com/fluxcd/flux2} + +GITHUB_RUNNER_VERSION=2.285.1 + +# download runner +curl -o actions-runner-linux-arm64.tar.gz -L https://github.com/actions/runner/releases/download/v${GITHUB_RUNNER_VERSION}/actions-runner-linux-arm64-${GITHUB_RUNNER_VERSION}.tar.gz \ + && tar xzf actions-runner-linux-arm64.tar.gz \ + && rm actions-runner-linux-arm64.tar.gz + +# register runner with GitHub +./config.sh --unattended --url ${REPOSITORY_URL} --token ${REPOSITORY_TOKEN} --name ${RUNNER_NAME} + +# start runner +sudo ./svc.sh install +sudo ./svc.sh start diff --git a/.github/workflows/e2e-arm64.yaml b/.github/workflows/e2e-arm64.yaml index a582f6f6..8f219adc 100644 --- a/.github/workflows/e2e-arm64.yaml +++ b/.github/workflows/e2e-arm64.yaml @@ -3,14 +3,13 @@ name: e2e-arm64 on: workflow_dispatch: push: - branches: [ main, update-components, arm64-e2e ] + branches: [ main, update-components, equinix-runners ] jobs: - ampere: - # Runner info - # Owner: Stefan Prodan + test: + # Hosted on Equinix # Docs: https://github.com/fluxcd/flux2/tree/main/.github/runners - runs-on: [self-hosted, Linux, ARM64] + runs-on: [self-hosted, Linux, ARM64, equinix] steps: - name: Checkout uses: actions/checkout@v2