name: e2e on: pull_request: push: branches: - master jobs: kind: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Restore Go cache uses: actions/cache@v1 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - name: Setup Go uses: actions/setup-go@v2-beta with: go-version: 1.14.x - name: Setup Kubernetes uses: engineerd/setup-kind@v0.3.0 - name: Setup Kustomize uses: fluxcd/pkg/actions/kustomize@master - name: Setup Kubebuilder uses: fluxcd/pkg/actions/kubebuilder@master - name: Setup Helm uses: fluxcd/pkg/actions/helm@master - name: Run tests run: make test env: KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin - name: Check if working tree is dirty run: | if [[ $(git diff --stat) != '' ]]; then git --no-pager diff echo 'run make test and commit changes' exit 1 fi - name: Build container image run: make docker-build IMG=test/source-controller:latest env: KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin - name: Load test image run: kind load docker-image test/source-controller:latest - name: Deploy controller run: make dev-deploy IMG=test/source-controller:latest env: KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin - name: Run smoke tests run: | kubectl -n source-system apply -f ./config/samples kubectl -n source-system rollout status deploy/source-controller --timeout=1m kubectl -n source-system wait gitrepository/gitrepository-sample --for=condition=ready --timeout=1m kubectl -n source-system wait helmrepository/helmrepository-sample --for=condition=ready --timeout=1m kubectl -n source-system wait helmchart/helmchart-sample --for=condition=ready --timeout=1m kubectl -n source-system delete -f ./config/samples - name: Run HelmChart values file tests run: | kubectl -n source-system apply -f ./config/testdata/helmchart-valuesfile kubectl -n source-system wait helmchart/mariadb --for=condition=ready --timeout=5m kubectl -n source-system wait helmchart/mariadb-git --for=condition=ready --timeout=5m kubectl -n source-system delete -f ./config/testdata/helmchart-valuesfile - name: Setup Minio run: | kubectl create ns minio helm repo add minio https://helm.min.io/ helm upgrade --wait -i minio minio/minio \ --namespace minio \ --set accessKey=myaccesskey \ --set secretKey=mysecretkey \ --set resources.requests.memory=128Mi \ --set persistence.enable=false kubectl -n minio port-forward svc/minio 9000:9000 &>/dev/null & sleep 2 wget -q https://dl.min.io/client/mc/release/linux-amd64/mc chmod +x mc ./mc alias set minio http://localhost:9000 myaccesskey mysecretkey --api S3v4 ./mc mb minio/podinfo ./mc cp --recursive ./config/testdata/minio/manifests minio/podinfo - name: Run S3 tests run: | kubectl -n source-system apply -f ./config/testdata/minio/source.yaml kubectl -n source-system wait bucket/podinfo --for=condition=ready --timeout=1m - name: Debug failure if: failure() run: | kubectl -n source-system get gitrepositories -oyaml kubectl -n source-system get helmrepositories -oyaml kubectl -n source-system get helmcharts -oyaml kubectl -n source-system get all kubectl -n source-system logs deploy/source-controller kubectl -n minio get all