Skip to content

Commit

Permalink
Run end2end tests on PRs (flyteorg#136)
Browse files Browse the repository at this point in the history
This is an initial release that enables End2end tests on any PR as well as merges to master. It's also possible for any fork to run the same CI steps.

This adds two additional github actions steps:
- Setup a [KinD](https://kind.sigs.k8s.io/) cluster (Kubernetes in Docker)
- Run `end2end_execute`:
   - Clone flyte repo master
   - Replace propeller image with git sha's image
   - Run `make end2end_execute` from flyte repo. This deploys `flyte` manifests and run `endtoend.yaml` pod and waits for all workflows to finish executing as expected.
  • Loading branch information
EngHabu committed May 27, 2020
1 parent 5e69329 commit 7f40317
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,14 @@ jobs:
push_git_tag: true
registry: docker.pkg.github.com
build_extra_args: "--compress=true"
- uses: engineerd/[email protected]
- name: End2End
env:
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: "${{ secrets.GITHUB_TOKEN }}"
run: |
kubectl cluster-info
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
PROPELLER=${{ secrets.flytegithub_repo }}/operator:${{ github.sha }} make end2end_execute
15 changes: 15 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
go-version: [1.13]
steps:
- uses: actions/checkout@v1
- name: Push Docker Image to Github Registry
Expand All @@ -17,3 +21,14 @@ jobs:
image_tag: ${{ github.sha }}
push_git_tag: true
registry: docker.pkg.github.com
- uses: engineerd/[email protected]
- name: End2End
env:
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: "${{ secrets.GITHUB_TOKEN }}"
run: |
kubectl cluster-info
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
PROPELLER=${{ secrets.flytegithub_repo }}/operator:${{ github.sha }} make end2end_execute
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ vendor
bin
.DS_Store
_test
boilerplate/lyft/end2end/tmp
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export REPOSITORY=flytepropeller
include boilerplate/lyft/docker_build/Makefile
include boilerplate/lyft/golang_test_targets/Makefile
include boilerplate/lyft/end2end/Makefile

.PHONY: update_boilerplate
update_boilerplate:
Expand Down
8 changes: 8 additions & 0 deletions boilerplate/lyft/end2end/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst

.PHONY: end2end_execute
end2end_execute:
./boilerplate/lyft/end2end/end2end.sh
28 changes: 28 additions & 0 deletions boilerplate/lyft/end2end/end2end.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES.
# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY:
#
# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst

set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

OUT="${DIR}/tmp"
rm -rf ${OUT}
git clone https://github.com/lyft/flyte.git "${OUT}"

# TODO: load all images
echo "Loading github docker images into 'kind' cluster to workaround this issue: https://github.com/containerd/containerd/issues/3291#issuecomment-631746985"
docker login --username ${DOCKER_USERNAME} --password ${DOCKER_PASSWORD} docker.pkg.github.com
docker pull docker.pkg.github.com/${PROPELLER}
kind load docker-image docker.pkg.github.com/${PROPELLER}

pushd ${OUT}
# TODO: Only replace propeller if it's passed in
# TODO: Support replacing other images too
sed -i.bak -e "s_docker.io/lyft/flytepropeller:.*_docker.pkg.github.com/${PROPELLER}_g" ${OUT}/kustomize/base/propeller/deployment.yaml
make kustomize
make end2end_execute
popd

0 comments on commit 7f40317

Please sign in to comment.