From 4e8bfb8ac66cae59d4e6c9b01c4ea2c23189563f Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Tue, 6 Aug 2024 08:52:02 +0200 Subject: [PATCH] Trust that docker is installed and use a Minikube cluster. This PR relies on that Docker is preinstalled on all platforms, and uses a Minikube cluster instead of kubeception. This removes the need for a special proprietary kubeception token when running the integration tests, and also opens up for running tests that require Docker on all platforms. Docker is not installed on macOS by default. The Silicon chip lacks support for nested virtualization. This will be remedied shortly, but for now, the macOS tests will run on amd64 only, and use a special action to install Docker. Signed-off-by: Thomas Hallgren --- .github/workflows/dev.yaml | 108 +++++++++---------------------------- 1 file changed, 26 insertions(+), 82 deletions(-) diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml index 5ab52cfe3e..dd3145a6fa 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/dev.yaml @@ -4,112 +4,56 @@ on: types: - labeled -env: - KUBECONFIG: ${{ github.workspace }}/kubeconfig.yaml - DTEST_KUBECONFIG: ${{ github.workspace }}/kubeconfig.yaml - TELEPRESENCE_REGISTRY: localhost:5000 - DTEST_REGISTRY: localhost:5000 - SCOUT_DISABLE: "1" - jobs: - build_image: - if: ${{ github.event.label.name == 'ok to test' }} - runs-on: ubuntu-latest - outputs: - telepresenceVersion: ${{ steps.build.outputs.version }} - steps: - - name: Remove label - uses: buildsville/add-remove-label@v2.0.1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - labels: ok to test - type: remove - - uses: actions/checkout@v4 - with: - ref: "${{ github.event.pull_request.head.sha }}" - fetch-depth: 0 - show-progress: false - - uses: actions/setup-go@v5 - with: - go-version: stable - - name: Build dev image - id: build - run: | - make save-tel2-image - echo "version=$(cat build-output/version.txt)" >> $GITHUB_OUTPUT - - name: Upload image - uses: actions/upload-artifact@v3 - with: - name: image - path: build-output/tel2-image.tar run_tests: strategy: fail-fast: false matrix: runners: - ubuntu-latest - - ubuntu-arm64 - - macos-latest # this runner uses arm64 + - macos-13 # Ensure amd64 (see https://github.com/marketplace/actions/setup-docker-on-macos) - windows-latest - clusters: - - distribution: Kubeception - version: "1.29" runs-on: ${{ matrix.runners }} - needs: build_image steps: + - name: Remove label + if: runner.os == Linux && github.event.label.name == 'ok to test' + uses: buildsville/add-remove-label@v2.0.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + labels: ok to test + type: remove - uses: actions/checkout@v4 with: fetch-depth: 0 ref: "${{ github.event.pull_request.head.sha }}" - name: install dependencies uses: ./.github/actions/install-dependencies - - name: install dependencies for arm64 - if: runner.os == 'Linux' && runner.arch == 'arm64' + - name: Get Telepresence Version + id: version run: | - sudo rm -f /etc/apt/sources.list.d/google-chrome.list - sudo apt-get update -y - sudo apt-get install -y socat gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu make jq uidmap - - name: install docker for arm64 - if: runner.os == 'Linux' && runner.arch == 'arm64' - run: | - curl -fsSL https://get.docker.com -o get-docker.sh - sudo sh get-docker.sh - dockerd-rootless-setuptool.sh install + make setup-build-dir + echo "TELEPRESENCE_VERSION=$(cat build-output/version.txt)" >> $GITHUB_OUTPUT - name: Build client - env: - TELEPRESENCE_VERSION: ${{needs.build_image.outputs.telepresenceVersion}} run: make build + - if: runner.os == 'macOS' # remove once docker is pre-installed on macOS images + uses: douglascamata/setup-docker-macos-action@v1-alpha - name: Build client image - if: runner.os == 'Linux' - env: - TELEPRESENCE_VERSION: ${{needs.build_image.outputs.telepresenceVersion}} run: make client-image - - name: Create cluster - uses: datawire/infra-actions/provision-cluster@v0.2.7 - with: - kubeconfig: ${{ env.KUBECONFIG }} - kubeceptionToken: ${{ secrets.DEV_TELEPRESENCE_KUBECEPTION_TOKEN }} - kubeceptionProfile: small - lifespan: 7200 - distribution: ${{ matrix.clusters.distribution }} - version: ${{ matrix.clusters.version }} - gkeCredentials: '{"project_id": "foo"}' # See https://github.com/datawire/infra-actions/issues/66 - - name: Download prebuilt docker image - uses: actions/download-artifact@v3 - with: - name: image - - name: Upload docker image to cluster - shell: bash + - name: Start minikube + uses: medyagh/setup-minikube@latest + - name: Build tel2 image + env: + TELEPRESENCE_REGISTRY: local run: | - kubectl apply -f build-aux/image-importer.yaml - kubectl rollout status -w deployment/image-importer - POD_NAME=$(kubectl get pod -ojsonpath='{.items[0].metadata.name}' -l app=image-importer) - kubectl cp tel2-image.tar "$POD_NAME:/tmp/image.tar" - kubectl exec $POD_NAME -- //hostbin/ctr images import //tmp/image.tar + eval $(minikube docker-env) + make tel2-image - name: Run integration tests env: - DEV_TELEPRESENCE_VERSION: ${{needs.build_image.outputs.telepresenceVersion}} - TELEPRESENCE_VERSION: ${{needs.build_image.outputs.telepresenceVersion}} + DEV_TELEPRESENCE_VERSION: ${{ env.TELEPRESENCE_VERSION }} + TELEPRESENCE_REGISTRY: local + DTEST_KUBECONFIG: ${{ env.HOME }}/.kube/config + DTEST_REGISTRY: local + SCOUT_DISABLE: "1" uses: nick-fields/retry/@v3 with: max_attempts: 3