diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml index b65fd6da..ffdd4731 100644 --- a/.github/workflows/test-e2e.yaml +++ b/.github/workflows/test-e2e.yaml @@ -2,11 +2,17 @@ name: E2E test on: workflow_call: + inputs: + release: + description: 'Kubeflex release to test (e.g. latest or v0.5.1)' + required: false + type: string workflow_dispatch: inputs: release: description: 'Kubeflex release to test (e.g. latest or v0.5.1)' required: false + type: string pull_request: branches: - main diff --git a/docs/contributors.md b/docs/contributors.md index 92cfbe0e..c82c584d 100644 --- a/docs/contributors.md +++ b/docs/contributors.md @@ -87,6 +87,12 @@ LATEST_TAG= make ko-build-push-cmupdate ``` Wait until goreleaser completes the release process. +1. Invoke [the E2E test workflow](../.github/workflows/test-e2e.yaml) on + the release just made (e.g, using [the GitHub web + UI](https://github.com/kubestellar/kubeflex/actions/workflows/test-e2e.yaml)). See + if it succeeds. If not then there is a problem that needs to be + remedied and a newer release made. + 1. The goreleaser workflow will also create a branch named `brew` with some changes (to the homebrew instsall script) that need to get merged into `main`. Make a PR to merge `brew` into `main`, and get it approved and merged. 1. To avoid leaving a time bomb, delete that `brew` branch after it was merged into `main` (the goreleaser will fail to create the new `brew` branch if one already exists). diff --git a/test/e2e/README.md b/test/e2e/README.md index 704bd868..c571a29b 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -1,23 +1,18 @@ KubeFlex provides an end-to-end (E2E) test suite that validates full system behavior in a Kubernetes environment. -End-to-end tests that can be used manually by a contributor or be triggered by CI. +The end-to-end test suite can be used manually by a contributor and also is used in CI. + +The end-to-end test suite can either test the local sources or a given release. ## Prerequisites `kind`,`jq` and `kubectl` are required to run the test. ## Run E2E tests manually - #### The E2E test suite can be run in the following modes: - - local source builds - - a released KubeFlex version, specified with the `--release` option - -When a release is specified, the tests install KubeFlex from a published Helm chart. -The special value `latest` installs the most recent released version, while a literal -version installs that specific release. -From the root directory of this git repository, you can run: +From the root directory of this git repository, you can run any of the following commands. ```shell test/e2e/run.sh # Run E2E tests against local source test/e2e/run.sh --release latest # Run E2E tests against the latest released version -test/e2e/run.sh --release v0.9.2 # Run E2E tests against a specific release +test/e2e/run.sh --release v0.9.1 # Run E2E tests against a specific release ``` diff --git a/test/e2e/setup-kubeflex.sh b/test/e2e/setup-kubeflex.sh index 27be51ef..84ce6fbe 100755 --- a/test/e2e/setup-kubeflex.sh +++ b/test/e2e/setup-kubeflex.sh @@ -19,17 +19,17 @@ release="" while [[ $# -gt 0 ]]; do case "$1" in --release) - if [[ $# -lt 2 ]]; then - echo "Error: --release requires a value (e.g. v0.9.2 or latest)" - exit 1 - fi - release="$2" - shift 2 - ;; - *) - echo "Unknown argument: $1" - exit 1 - ;; + if [[ $# -lt 2 ]]; then + echo "Error: --release requires a value (e.g. v0.9.2 or latest)" + exit 1 + fi + release="$2" + shift 2 + ;; + *) + echo "Unknown argument: $1" + exit 1 + ;; esac done SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) @@ -46,30 +46,27 @@ kubectl -n ingress-nginx patch deployment/ingress-nginx-controller --patch-file= : : ------------------------------------------------------------------------- if [[ -z "${release}" ]]; then -echo "Installing kubeflex from local source" -: Compile binaries -: -make build + echo "Installing kubeflex from local source" + : Compile binaries + : + make build -: -: ------------------------------------------------------------------------- -: Build the OCI image for the kubeflex controller manager and load it in the local docker registry -: -: -make ko-local-build + : + : ------------------------------------------------------------------------- + : Build the OCI image for the kubeflex controller manager and load it in the local docker registry + : + : + make ko-local-build -: -: ------------------------------------------------------------------------- -: Load the local image in kind, re-generate manifests and helm chart, and install the helm chart: -: -: -make install-local-chart -: -: + : + : ------------------------------------------------------------------------- + : Load the local image in kind, re-generate manifests and helm chart, and install the helm chart: + : + : + make install-local-chart + : + : else - echo "Installing kubeflex release: ${release}" - kubectl create namespace kubeflex-system --dry-run=client -o yaml | kubectl apply -f - - if [[ "${release}" == "latest" ]]; then echo "Resolving latest kubeflex release from GitHub" release="$(curl -fsSL https://api.github.com/repos/kubestellar/kubeflex/releases/latest \ @@ -82,11 +79,22 @@ else echo "Resolved latest release to ${release}" fi - echo "Installing kubeflex release ${release}" - helm install kubeflex \ - oci://ghcr.io/kubestellar/kubeflex/chart/kubeflex-operator \ - --version "${release}" + + bash <(curl -s https://raw.githubusercontent.com/kubestellar/kubeflex/refs/tags/${release}/scripts/install-kubeflex.sh) --version $release --ensure-folder bin --strip-bin -X + + if [ "$( { echo v0.9.2; echo "$release"; } | sort -V | head -1)" == v0.9.2 ]; then + helm install kubeflex-operator \ + oci://ghcr.io/kubestellar/kubeflex/chart/kubeflex-operator \ + --version "${release}" + else + kubectl create namespace kubeflex-system --dry-run=client -o yaml | kubectl apply -f - + helm install kubeflex-operator \ + oci://ghcr.io/kubestellar/kubeflex/chart/kubeflex-operator \ + --namespace kubeflex-system \ + --version "${release}" + fi + fi : : ------------------------------------------------------------------------- @@ -144,4 +152,4 @@ EOF : Wait for kubeflex-controller-manager ready : -kubectl wait --for=condition=available --timeout=300s -n kubeflex-system deployment/kubeflex-controller-manager \ No newline at end of file +kubectl wait --for=condition=available --timeout=300s -n kubeflex-system deployment/kubeflex-controller-manager