Skip to content

Commit

Permalink
Added test for sandbox image (flyteorg#1861)
Browse files Browse the repository at this point in the history
* Added test for sandbox image

Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
yindia authored Dec 8, 2021
1 parent 6cfd20d commit bfbd0f3
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 19 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/functional-test.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
- name: Setup sandbox
run: |
flytectl sandbox start --image ghcr.io/flyteorg/flyte-sandbox:local --imagePullPolicy Never
flytectl config init
- name: Register examples
uses: unionai/[email protected]
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
66 changes: 56 additions & 10 deletions .github/workflows/sandbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Build & Push Sandbox Docker Image

on:
pull_request:
paths:
- docker/**
- charts/**
- .github/workflows/sandbox.yml
release:
types: [published]

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<details>
<center>
Expand Down
7 changes: 7 additions & 0 deletions docker/sandbox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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}"

Expand Down Expand Up @@ -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}"

Expand Down
1 change: 1 addition & 0 deletions docker/sandbox/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
22 changes: 18 additions & 4 deletions docker/sandbox/flyte-entrypoint-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 17 additions & 4 deletions docker/sandbox/flyte-entrypoint-dind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bfbd0f3

Please sign in to comment.