From a0066622049180e948bb66a487d99fd71df15237 Mon Sep 17 00:00:00 2001 From: Yuvraj Date: Wed, 24 Nov 2021 05:17:29 +0530 Subject: [PATCH] Run endtoend tests in PRs against sandbox releases (#350) * Added flytectl in sandbox Signed-off-by: Yuvraj * wip: Added manual change in boilerplate script Signed-off-by: Yuvraj * flytectl config fix Signed-off-by: Yuvraj * Revert registry name in ci Signed-off-by: Yuvraj --- .github/workflows/master.yml | 25 +++++++++++------ .github/workflows/pull_request.yml | 41 ++++++++++++++++++++-------- boilerplate/flyte/end2end/end2end.sh | 18 ------------ data-config.yaml | 17 ------------ config.yaml => propeller-config.yaml | 0 5 files changed, 47 insertions(+), 54 deletions(-) delete mode 100644 data-config.yaml rename config.yaml => propeller-config.yaml (100%) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index f63a8964f6..9396bd624d 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -26,11 +26,11 @@ jobs: run: (docker load -i /tmp/tmp/docker-images/snapshot-builder.tar || true) && (docker load -i /tmp/tmp/docker-images/snapshot.tar || true) - name: Build dockerfile run: | - docker build -t lyft/${{ github.event.repository.name }}:builder --target builder --cache-from=lyft/${{ github.event.repository.name }}:builder . - docker build -t lyft/${{ github.event.repository.name }}:latest --cache-from=lyft/${{ github.event.repository.name }}:builder . + docker build -t flyteorg/${{ github.event.repository.name }}:builder --target builder --cache-from=flyteorg/${{ github.event.repository.name }}:builder . + docker build -t flyteorg/${{ github.event.repository.name }}:latest --cache-from=flyteorg/${{ github.event.repository.name }}:builder . - name: Tag and cache docker image - run: mkdir -p /tmp/tmp/docker-images && docker save lyft/${{ github.event.repository.name }}:builder -o /tmp/tmp/docker-images/snapshot-builder.tar && docker save lyft/${{ github.event.repository.name }}:latest -o /tmp/tmp/docker-images/snapshot.tar + run: mkdir -p /tmp/tmp/docker-images && docker save flyteorg/${{ github.event.repository.name }}:builder -o /tmp/tmp/docker-images/snapshot-builder.tar && docker save flyteorg/${{ github.event.repository.name }}:latest -o /tmp/tmp/docker-images/snapshot.tar # Duplicated from pull request workflow because sharing is not yet supported endtoend: @@ -40,24 +40,33 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - uses: unionai/flytectl-setup-action@v0.0.1 + name: Setup flytectl - id: load-docker-cache name: Load Docker Cache uses: actions/cache@v1 with: path: /tmp/tmp/docker-images key: /tmp/docker-images-${{ github.event.after }} + - name: Create Sandbox Cluster + run: | + cp /tmp/tmp/docker-images/snapshot.tar snapshot.tar + flytectl sandbox start --source=$(pwd) + flytectl config init - name: Prime docker cache - run: docker load -i /tmp/tmp/docker-images/snapshot.tar || true - - uses: engineerd/setup-kind@v0.5.0 - with: - version: "v0.11.1" + run: | + flytectl sandbox exec -- docker load -i /root/snapshot.tar + - name: Upgrade Helm charts + run: flytectl sandbox exec -- helm upgrade flyte -n flyte --kubeconfig=/etc/rancher/k3s/k3s.yaml /flyteorg/share/flyte -f /flyteorg/share/flyte/values-sandbox.yaml --set flytepropeller.image.repository=flyteorg/${{ github.event.repository.name }},flytepropeller.image.tag=latest - name: End2End + env: + KUBECONFIG: /home/runner/.flyte/k3s/k3s.yaml run: | kubectl cluster-info kubectl get pods -n kube-system echo "current-context:" $(kubectl config current-context) echo "environment-kubeconfig:" ${KUBECONFIG} - IMAGE_NAME=${{ github.event.repository.name }} IMAGE=lyft/${{ github.event.repository.name }}:latest make end2end_execute + make end2end_execute bump-version: name: Bump Version diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a915ff1dfc..b5cc546af4 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -23,11 +23,11 @@ jobs: run: (docker load -i /tmp/tmp/docker-images/snapshot-builder.tar || true) && (docker load -i /tmp/tmp/docker-images/snapshot.tar || true) - name: Build dockerfile run: | - docker build -t lyft/${{ github.event.repository.name }}:builder --target builder --cache-from=lyft/${{ github.event.repository.name }}:builder . - docker build -t lyft/${{ github.event.repository.name }}:latest --cache-from=lyft/${{ github.event.repository.name }}:builder . + docker build -t flyteorg/${{ github.event.repository.name }}:builder --target builder --cache-from=flyteorg/${{ github.event.repository.name }}:builder . + docker build -t flyteorg/${{ github.event.repository.name }}:latest --cache-from=flyteorg/${{ github.event.repository.name }}:builder . - name: Tag and cache docker image - run: mkdir -p /tmp/tmp/docker-images && docker save lyft/${{ github.event.repository.name }}:builder -o /tmp/tmp/docker-images/snapshot-builder.tar && docker save lyft/${{ github.event.repository.name }}:latest -o /tmp/tmp/docker-images/snapshot.tar + run: mkdir -p /tmp/tmp/docker-images && docker save flyteorg/${{ github.event.repository.name }}:builder -o /tmp/tmp/docker-images/snapshot-builder.tar && docker save flyteorg/${{ github.event.repository.name }}:latest -o /tmp/tmp/docker-images/snapshot.tar endtoend: name: End to End tests @@ -36,24 +36,34 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - uses: unionai/flytectl-setup-action@v0.0.1 + name: Setup flytectl - id: load-docker-cache name: Load Docker Cache uses: actions/cache@v1 with: path: /tmp/tmp/docker-images key: /tmp/docker-images-${{ github.event.after }} + - name: Create Sandbox Cluster + run: | + cp /tmp/tmp/docker-images/snapshot.tar snapshot.tar + flytectl sandbox start --source=$(pwd) + flytectl config init - name: Prime docker cache - run: docker load -i /tmp/tmp/docker-images/snapshot.tar || true - - uses: engineerd/setup-kind@v0.5.0 - with: - version: "v0.11.1" + run: | + flytectl sandbox exec -- docker load -i /root/snapshot.tar + - name: Upgrade Helm charts + run: flytectl sandbox exec -- helm upgrade flyte -n flyte --kubeconfig=/etc/rancher/k3s/k3s.yaml /flyteorg/share/flyte -f /flyteorg/share/flyte/values-sandbox.yaml --set flytepropeller.image.repository=flyteorg/${{ github.event.repository.name }},flytepropeller.image.tag=latest - name: End2End + env: + KUBECONFIG: /home/runner/.flyte/k3s/k3s.yaml run: | kubectl cluster-info kubectl get pods -n kube-system echo "current-context:" $(kubectl config current-context) echo "environment-kubeconfig:" ${KUBECONFIG} - IMAGE_NAME=${{ github.event.repository.name }} IMAGE=lyft/${{ github.event.repository.name }}:latest make end2end_execute + kubectl get pods -n flyte -oyaml + make end2end_execute integration: name: Integration tests @@ -62,22 +72,31 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - uses: unionai/flytectl-setup-action@v0.0.1 - id: load-docker-cache name: Load Docker Cache uses: actions/cache@v1 with: path: /tmp/tmp/docker-images key: /tmp/docker-images-${{ github.event.after }} + - name: Create Sandbox Cluster + run: | + cp /tmp/tmp/docker-images/snapshot-builder.tar snapshot.tar + flytectl sandbox start --source=$(pwd) + flytectl config init - name: Prime docker cache - run: docker load -i /tmp/tmp/docker-images/snapshot-builder.tar || true - - uses: engineerd/setup-kind@v0.5.0 + run: flytectl sandbox exec -- docker load -i /root/snapshot.tar + - name: Upgrade Helm charts + run: flytectl sandbox exec -- helm upgrade flyte -n flyte --kubeconfig=/etc/rancher/k3s/k3s.yaml /flyteorg/share/flyte -f /flyteorg/share/flyte/values-sandbox.yaml --set flytepropeller.image.repository=flyteorg/${{ github.event.repository.name }},flytepropeller.image.tag=builder - name: Integration + env: + KUBECONFIG: /home/runner/.flyte/k3s/k3s.yaml run: | kubectl cluster-info kubectl get pods -n kube-system echo "current-context:" $(kubectl config current-context) echo "environment-kubeconfig:" ${KUBECONFIG} - IMAGE_NAME=${{ github.event.repository.name }} IMAGE=lyft/${{ github.event.repository.name }}:builder make k8s_integration_execute + make k8s_integration_execute tests-lint: name: Run tests and lint diff --git a/boilerplate/flyte/end2end/end2end.sh b/boilerplate/flyte/end2end/end2end.sh index 45877e4155..cd888b964c 100755 --- a/boilerplate/flyte/end2end/end2end.sh +++ b/boilerplate/flyte/end2end/end2end.sh @@ -12,25 +12,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" OUT="${DIR}/tmp" rm -rf ${OUT} git clone https://github.com/flyteorg/flyte.git "${OUT}" - pushd ${OUT} -if [ ! -z "$IMAGE" ]; -then - kind load docker-image ${IMAGE} - if [ "${IMAGE_NAME}" == "flytepropeller" ] - then - sed -i.bak -e "s_${IMAGE_NAME}:.*_${IMAGE}_g" "${OUT}"/kustomize/base/propeller/deployment.yaml - fi - - if [ "${IMAGE_NAME}" == "flyteadmin" ] - then - sed -i.bak -e "s_${IMAGE_NAME}:.*_${IMAGE}_g" "${OUT}"/kustomize/base/admindeployment/deployment.yaml - fi -fi - -make kustomize -# launch flyte end2end -kubectl apply -f "${OUT}/deployment/test/flyte_generated.yaml" make end2end_execute popd diff --git a/data-config.yaml b/data-config.yaml deleted file mode 100644 index fc2304d990..0000000000 --- a/data-config.yaml +++ /dev/null @@ -1,17 +0,0 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: flyte-data-config -data: - config.yaml: | - storage: - connection: - access-key: minio - auth-type: accesskey - disable-ssl: true - endpoint: http://minio.flyte.svc.cluster.local:9000 - region: us-east-1 - secret-key: miniostorage - type: minio - container: my-s3-bucket - enable-multicontainer: true diff --git a/config.yaml b/propeller-config.yaml similarity index 100% rename from config.yaml rename to propeller-config.yaml