diff --git a/.circleci/config.yml b/.circleci/config.yml index 19775678..11443308 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,30 +1,65 @@ version: 2.1 +parameters: + machine_image: + type: string + default: ubuntu-2204:2023.04.2 + commands: + start-minikube: + steps: + - run: + name: Start minikube + command: | + KUBE_VERSION="$(jq -r .kubernetes < version.json)" + minikube start --vm-driver=docker --kubernetes-version=${KUBE_VERSION} --wait=all + + wait-for-pach: + steps: + - run: + name: Wait for pachyderm + command: | + kubectl wait --for=condition=available deployment -l app=pachd --timeout=5m deploy-pachyderm: steps: - run: name: Install dependencies command: etc/testing/circle/install.sh - run: - name: Start minikube - command: etc/testing/circle/start-minikube.sh + name: Add deps to path + command: | + echo 'export PATH=/home/circleci/project/cached-deps:$PATH' >> $BASH_ENV + - start-minikube - run: name: Deploy pachyderm - command: etc/testing/circle/deploy-pachyderm.sh + command: | + PACHYDERM_VERSION="$(jq -r .pachyderm version.json)" + helm repo add pachyderm https://pachyderm.github.io/helmchart + helm repo update + helm install pachd pachyderm/pachyderm --set deployTarget=LOCAL,proxy.service.type=NodePort --version ${PACHYDERM_VERSION} + - run: + name: Login to Pach + command: | + pachctl connect grpc://$(minikube ip):30080 install-python: parameters: version: type: string steps: + - restore_cache: + key: python-pach-pyenv-v1-<< parameters.version >> - run: name: Install python command: | git -C "/opt/circleci/.pyenv/" checkout master -q git -C "/opt/circleci/.pyenv/" pull -q - pyenv install <> + pyenv install -s <> pyenv global <> + - save_cache: + key: python-pach-pyenv-v1-<< parameters.version >> + paths: + - /opt/circleci/.pyenv/versions/<< parameters.version >> install-poetry: steps: @@ -49,7 +84,7 @@ jobs: python-version: type: string machine: - image: ubuntu-2004:202111-01 + image: << pipeline.parameters.machine_image >> steps: - checkout - deploy-pachyderm @@ -57,12 +92,13 @@ jobs: version: <> - install-poetry - create-venv + - wait-for-pach - run: name: Run unit tests command: | - pachctl port-forward & mkdir -p test-results poetry run pytest -v --junitxml=test-results/junit.xml tests + no_output_timeout: 20m - store_test_results: path: test-results - store_artifacts: @@ -77,7 +113,7 @@ jobs: python-version: type: string machine: - image: ubuntu-2004:202111-01 + image: << pipeline.parameters.machine_image >> steps: - checkout - deploy-pachyderm @@ -85,11 +121,12 @@ jobs: version: <> - install-poetry - create-venv + - wait-for-pach - run: name: Run opencv example command: | - pachctl port-forward & poetry run python ./examples/opencv/opencv.py + no_output_timeout: 20m - run: when: on_fail command: etc/testing/circle/kube_debug.sh diff --git a/etc/testing/circle/deploy-pachyderm.sh b/etc/testing/circle/deploy-pachyderm.sh deleted file mode 100755 index 8b38a10f..00000000 --- a/etc/testing/circle/deploy-pachyderm.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -ex - -export PATH=$(pwd):$(pwd)/cached-deps:$GOPATH/bin:$PATH -export PACHYDERM_VERSION="$(jq -r .pachyderm version.json)" - -helm repo add pachyderm https://pachyderm.github.io/helmchart -helm repo update -helm install pachd pachyderm/pachyderm --set deployTarget=LOCAL --version ${PACHYDERM_VERSION} - -kubectl wait --for=condition=available deployment -l app=pachd --timeout=5m -pachctl version \ No newline at end of file diff --git a/etc/testing/circle/install.sh b/etc/testing/circle/install.sh index 49355000..84c3b3a7 100755 --- a/etc/testing/circle/install.sh +++ b/etc/testing/circle/install.sh @@ -1,24 +1,19 @@ #!/bin/bash -set -ex +set -euxo pipefail + +ARCH=amd64 +if [ "$(uname -m)" = "aarch64" ]; then ARCH=arm64; fi mkdir -p cached-deps -# Install deps -sudo apt update -y -sudo apt-get install -y -qq \ - pkg-config \ - conntrack \ - pv \ - jq \ - socat - -# Install Helm -curl https://baltocdn.com/helm/signing.asc | sudo apt-key add - -sudo apt-get install apt-transport-https --yes -echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list -sudo apt-get update -sudo apt-get install helm +# Install helm +if [ ! -f cached-deps/helm ]; then + HELM_VERSION=3.5.4 + curl -L https://get.helm.sh/helm-v${HELM_VERSION}-linux-${ARCH}.tar.gz \ + | tar xzf - linux-${ARCH}/helm + mv ./linux-${ARCH}/helm cached-deps/helm +fi # Install kubectl # To get the latest kubectl version: diff --git a/etc/testing/circle/start-minikube.sh b/etc/testing/circle/start-minikube.sh deleted file mode 100755 index f476a7a9..00000000 --- a/etc/testing/circle/start-minikube.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -ex - -export PATH=$(pwd):$(pwd)/cached-deps:$GOPATH/bin:$PATH - -# Parse flags -KUBE_VERSION="$( jq -r .kubernetes <"$(git rev-parse --show-toplevel)/version.json" )" -minikube_args=( - "--vm-driver=docker" - "--kubernetes-version=${KUBE_VERSION}" -) -while getopts ":v" opt; do - case "${opt}" in - v) - KUBE_VERSION="v${OPTARG}" - ;; - \?) - echo "Invalid argument: ${opt}" - exit 1 - ;; - esac -done - -minikube start "${minikube_args[@]}" - -# Try to connect for three minutes -for _ in $(seq 36); do - if kubectl version &>/dev/null; then - exit 0 - fi - sleep 5 -done - -# Give up--kubernetes isn't coming up -minikube delete -sleep 30 # Wait for minikube to go completely down -exit 1 diff --git a/version.json b/version.json index 0570fed8..58c55904 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { "pachyderm": "2.6.0", "kubernetes": "1.22.8", - "minikube": "1.25.2" + "minikube": "1.30.1" }