diff --git a/.github/workflows/functional-test.yaml b/.github/workflows/functional-test.yaml new file mode 100644 index 0000000000..2e82553a09 --- /dev/null +++ b/.github/workflows/functional-test.yaml @@ -0,0 +1,60 @@ +name: Functional test for sandbox image + +on: + pull_request: + paths: + - docker/** + - charts/** + +defaults: + run: + # https://github.com/actions/runner/issues/241#issuecomment-577360161 + shell: 'script -q -e -c "bash {0}"' + +jobs: + run-tests: + name: Functional test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - uses: whoan/docker-build-with-cache-action@v5.11.0 + with: + image_name: flyteorg/flyte-sandbox + image_tag: local + registry: ghcr.io + build_extra_args: --target=dind --compress=true --build-arg=FLYTE_TEST=local + context: ./ + dockerfile: docker/sandbox/Dockerfile + push_image_and_stages: false + - uses: unionai/flytectl-setup-action@v0.0.1 + - name: Setup sandbox + run: | + flytectl sandbox start --image ghcr.io/flyteorg/flyte-sandbox:local --imagePullPolicy Never + flytectl config init + - name: Register examples + uses: unionai/flyte-register-action@v0.0.2 + with: + flytesnacks: true + project: flytesnacks + version: "latest" + domain: development + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + pip install flytekit + pip freeze + - 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} + # launch flyte end2end + make end2end_execute + diff --git a/.github/workflows/sandbox.yml b/.github/workflows/sandbox.yml index 3f6d6ca467..11c7e1d824 100644 --- a/.github/workflows/sandbox.yml +++ b/.github/workflows/sandbox.yml @@ -2,6 +2,10 @@ name: Build & Push Sandbox Docker Image on: pull_request: + paths: + - docker/** + - charts/** + - .github/workflows/sandbox.yml release: types: [published] @@ -31,16 +35,6 @@ jobs: tags: | latest type=sha,format=long - - name: Prepare DIND Image Names - id: dind-names - uses: docker/metadata-action@v3 - with: - # list of Docker images to use as base name for tags - images: | - ghcr.io/${{ github.repository_owner }}/flyte-sandbox - tags: | - dind - type=sha,format=long, prefix=dind- - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx @@ -72,6 +66,58 @@ jobs: file: docker/sandbox/Dockerfile cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + - # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + sandbox-build-dind: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: "0" + - name: Set flyte version to release + id: set_version + run: | + if [ ${{ github.event_name}} = "release" ]; then + echo ::set-output name=flyte_version::$(echo ${{ github.event.release.tag_name }}) + else + echo ::set-output name=flyte_version::latest + fi + - name: Prepare DIND Image Names + id: dind-names + uses: docker/metadata-action@v3 + with: + # list of Docker images to use as base name for tags + images: | + ghcr.io/${{ github.repository_owner }}/flyte-sandbox + tags: | + dind + type=sha,format=long, prefix=dind- + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-single-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-single-buildx + - name: Login to GitHub Container Registry + if: ${{ github.event_name == 'release' }} + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: "${{ secrets.FLYTE_BOT_USERNAME }}" + password: "${{ secrets.FLYTE_BOT_PAT }}" - name: Build and push DIND Image uses: docker/build-push-action@v2 with: diff --git a/README.md b/README.md index 6107a4b107..0423140aa8 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,7 @@ Live roadmap for the project can be found @[Github Live Roadmap](https://github. ## Functional Tests Matrix -We run a suite of tests (defined in https://github.com/flyteorg/flytesnacks/blob/master/cookbook/flyte_tests_manifest.json) to ensure that basic functionality and a subset of the integrations work across a variety of release versions. Those tests are run in a cluster where specific versions of the flyte components, such as console, flyteadmin, datacatalog, and flytepropeller, are installed. The table below has different release versions as the columns and the result of each test suite as rows. +We run a suite of tests (defined in https://github.com/flyteorg/flytesnacks/blob/master/cookbook/flyte_tests_manifest.json) to ensure that basic functionality, and a subset of the integrations work across a variety of release versions. Those tests are run in a cluster where specific versions of the flyte components, such as console, flyteadmin, datacatalog, and flytepropeller, are installed. The table below has different release versions as the columns and the result of each test suite as rows.
diff --git a/docker/sandbox/Dockerfile b/docker/sandbox/Dockerfile index e3b30ed6e1..dc38b711f4 100644 --- a/docker/sandbox/Dockerfile +++ b/docker/sandbox/Dockerfile @@ -51,6 +51,7 @@ COPY --from=go_builder_ /install/linux/ /flyteorg/bin/ # Copy flyte chart COPY charts/flyte/ /flyteorg/share/flyte +COPY charts/flyte-core/ /flyteorg/share/flyte-core # Copy scripts COPY docker/sandbox/kubectl docker/sandbox/cgroup-v2-hack.sh docker/sandbox/wait-for-flyte.sh /flyteorg/bin/ @@ -68,6 +69,9 @@ COPY docker/sandbox/bashrc /root/.bashrc ARG FLYTE_VERSION="latest" ENV FLYTE_VERSION "${FLYTE_VERSION}" +ARG FLYTE_TEST="release" +ENV FLYTE_TEST "${FLYTE_TEST}" + # Update PATH variable ENV PATH "/flyteorg/bin:${PATH}" @@ -97,6 +101,9 @@ COPY docker/sandbox/flyte-entrypoint-dind.sh /flyteorg/bin/flyte-entrypoint.sh ARG FLYTE_VERSION="latest" ENV FLYTE_VERSION "${FLYTE_VERSION}" +ARG FLYTE_TEST="release" +ENV FLYTE_TEST "${FLYTE_TEST}" + # Update PATH variable ENV PATH "/flyteorg/bin:${PATH}" diff --git a/docker/sandbox/bashrc b/docker/sandbox/bashrc index 550a1d4e9e..357f25d8cc 100644 --- a/docker/sandbox/bashrc +++ b/docker/sandbox/bashrc @@ -5,3 +5,4 @@ export PS1="\e[0;35m\u@flyte-sandbox \w> \e[m" alias k="kubectl" alias kf="kubectl -n flyte" alias l="ls -lthra" +alias f="flytectl" diff --git a/docker/sandbox/flyte-entrypoint-default.sh b/docker/sandbox/flyte-entrypoint-default.sh index c91b75705a..9382b0b5c1 100755 --- a/docker/sandbox/flyte-entrypoint-default.sh +++ b/docker/sandbox/flyte-entrypoint-default.sh @@ -23,10 +23,24 @@ fi # Deploy flyte echo "Deploying Flyte..." -helm repo add flyteorg https://flyteorg.github.io/flyte -helm repo update -helm fetch flyteorg/flyte --version=$FLYTE_VERSION -helm upgrade -n flyte --create-namespace flyte flyteorg/flyte --kubeconfig /etc/rancher/k3s/k3s.yaml --install --version $FLYTE_VERSION + +version="" +charts="/flyteorg/share/flyte" + +if [[ $FLYTE_TEST = "release" ]] +then + helm repo add flyteorg https://flyteorg.github.io/flyte + helm fetch flyteorg/flyte --version=$FLYTE_VERSION + version="--version $FLYTE_VERSION" + charts="flyteorg/flyte" +fi + +if [[ $FLYTE_TEST = "local" ]] +then + helm dep update $charts +fi + +helm upgrade -n flyte --create-namespace flyte $charts --kubeconfig /etc/rancher/k3s/k3s.yaml --install $version wait-for-flyte.sh diff --git a/docker/sandbox/flyte-entrypoint-dind.sh b/docker/sandbox/flyte-entrypoint-dind.sh index d1e83547fa..c3c9aa0e5a 100755 --- a/docker/sandbox/flyte-entrypoint-dind.sh +++ b/docker/sandbox/flyte-entrypoint-dind.sh @@ -40,10 +40,23 @@ fi # Deploy flyte echo "Deploying Flyte..." -helm repo add flyteorg https://flyteorg.github.io/flyte -helm repo update -helm fetch flyteorg/flyte --version=$FLYTE_VERSION -helm upgrade -n flyte --create-namespace flyte flyteorg/flyte --kubeconfig /etc/rancher/k3s/k3s.yaml --install --version $FLYTE_VERSION +version="" +charts="/flyteorg/share/flyte" + +if [[ $FLYTE_TEST = "release" ]] +then + helm repo add flyteorg https://flyteorg.github.io/flyte + helm fetch flyteorg/flyte --version=$FLYTE_VERSION + version="--version $FLYTE_VERSION" + charts="flyteorg/flyte" +fi + +if [[ $FLYTE_TEST = "local" ]] +then + helm dep update $charts +fi + +helm upgrade -n flyte --create-namespace flyte $charts --kubeconfig /etc/rancher/k3s/k3s.yaml --install $version wait-for-flyte.sh