Skip to content

Commit cb3fb3b

Browse files
committed
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>
1 parent 4ce7c0d commit cb3fb3b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

.github/actions/run-tests/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ RUN set -eux; \
1717
RUN groupadd -g 116 test && \
1818
useradd -u 1001 --gid test --shell /bin/sh --create-home test
1919

20+
# Set path to envtest binaries.
21+
ENV PATH="/github/workspace/envtest:${PATH}"
22+
2023
# Run as test user
2124
USER test
2225

.github/workflows/e2e.yaml

+4-7
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ jobs:
2626
image: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
2727
- name: Setup Kustomize
2828
uses: fluxcd/pkg/actions/kustomize@main
29-
- name: Setup Kubebuilder
30-
uses: fluxcd/pkg/actions/kubebuilder@main
29+
- name: Setup envtest
30+
uses: fluxcd/pkg/actions/envtest@main
31+
with:
32+
version: "1.19.2"
3133
- name: Setup Helm
3234
uses: fluxcd/pkg/actions/helm@main
3335
- name: Run tests
3436
uses: ./.github/actions/run-tests
3537
env:
3638
GOPATH: /github/home/go
37-
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
3839
- name: Check if working tree is dirty
3940
run: |
4041
if [[ $(git diff --stat) != '' ]]; then
@@ -44,14 +45,10 @@ jobs:
4445
fi
4546
- name: Build container image
4647
run: make docker-build IMG=test/source-controller:latest
47-
env:
48-
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
4948
- name: Load test image
5049
run: kind load docker-image test/source-controller:latest
5150
- name: Deploy controller
5251
run: make dev-deploy IMG=test/source-controller:latest
53-
env:
54-
KUBEBUILDER_ASSETS: ${{ github.workspace }}/kubebuilder/bin
5552
- name: Run smoke tests
5653
run: |
5754
kubectl -n source-system apply -f ./config/samples

0 commit comments

Comments
 (0)