workflows/e2e: Use fluxcd/pkg/actions/envtest

Use fluxcd/pkg/actions/envtest to setup envtest.

Since the run-test action runs in a container, the host $PATH is not
passed to the test container. The ENV directive in actions/run-tests
Dockerfile is used to append the PATH with envtest binary path. This
helps avoid redownload of the envtest binaries when it's not found in
the path via the Makefile targets.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
Sunny 2021-07-30 19:38:18 +05:30
parent 4ce7c0d9aa
commit cb3fb3bb4e
No known key found for this signature in database
GPG Key ID: 9C5F586ACB6590EA
2 changed files with 7 additions and 7 deletions

View File

@ -17,6 +17,9 @@ RUN set -eux; \
RUN groupadd -g 116 test && \
useradd -u 1001 --gid test --shell /bin/sh --create-home test
# Set path to envtest binaries.
ENV PATH="/github/workspace/envtest:${PATH}"
# Run as test user
USER test

View File

@ -26,15 +26,16 @@ jobs:
image: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
- name: Setup Kustomize
uses: fluxcd/pkg/actions/kustomize@main
- name: Setup Kubebuilder
uses: fluxcd/pkg/actions/kubebuilder@main
- name: Setup envtest
uses: fluxcd/pkg/actions/envtest@main
with:
version: "1.19.2"
- name: Setup Helm
uses: fluxcd/pkg/actions/helm@main
- name: Run tests
uses: ./.github/actions/run-tests
env:
GOPATH: /github/home/go
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
- name: Check if working tree is dirty
run: |
if [[ $(git diff --stat) != '' ]]; then
@ -44,14 +45,10 @@ jobs:
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