Skip to content

Commit 724fd32

Browse files
committed
Automate Helm tests with Gradle
This PR automates Helm tests and make them executable as part of the Gradle build.
1 parent 1a5c5a8 commit 724fd32

File tree

8 files changed

+367
-22
lines changed

8 files changed

+367
-22
lines changed

.github/workflows/gradle.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ jobs:
6666
./gradlew check sourceTarball distTar distZip publishToMavenLocal \
6767
-x :polaris-runtime-service:test \
6868
-x :polaris-admin:test \
69-
-x intTest --continue
69+
-x intTest \
70+
-x :polaris-helm:check \
71+
--continue
7072
- name: Save partial Gradle build cache
7173
uses: ./.github/actions/ci-incr-build-cache-save
7274
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
@@ -213,6 +215,7 @@ jobs:
213215
./gradlew \
214216
intTest \
215217
-x :polaris-runtime-service:intTest \
218+
-x :polaris-helm:intTest \
216219
--continue
217220
env:
218221
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}

.github/workflows/helm.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ jobs:
9898
./gradlew \
9999
:polaris-server:assemble \
100100
:polaris-server:quarkusAppPartsBuild --rerun \
101-
:polaris-admin:assemble \
102-
:polaris-admin:quarkusAppPartsBuild --rerun \
103101
-Dquarkus.container-image.build=true
104102
minikube image ls
105103

CONTRIBUTING.md

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,82 @@ Tips:
119119
* Keep in mind that the Git commit subject and message is going to be read by other people, potentially even after years. The Git commit subject and message will appear "as is" in release notes.
120120
* Make sure the subject and message are properly formatted and contains a concise description of the changes in way that someone who has no prior knowledge can understand the rationale of the change and the change itself. Remove information that's of no use for someone reading the Git commit log, for example single intermediate commit messages like `formatting` or `fix test`.
121121

122-
## Java version requirements
122+
## Build Prerequisites and Required Tools
123123

124-
The Apache Polaris build currently requires Java 21 or later. There are a few tools that help you running the right Java version:
124+
Apache Polaris (incubating) requires several tools to run a full build, including tests and documentation generation.
125125

126-
* [SDKMAN!](https://sdkman.io/) follow the installation instructions, then run `sdk list java` to see the available distributions and versions, then run `sdk install java <identifier from list>` using the identifier for the distribution and version (>= 21) of your choice.
127-
* [jenv](https://www.jenv.be/) If on a Mac you can use jenv to set the appropriate SDK.
126+
### Core Build Requirements
127+
128+
These tools are required for basic building and testing:
129+
130+
* **Git**: Required for cloning the repository and version control.
131+
132+
* **Java 21+**: The build requires Java 21 or later. Suggested installers:
133+
* [SDKMAN!](https://sdkman.io/) - Run `sdk list java` to see available distributions, then `sdk install java <identifier>` to install.
134+
* [jEnv](https://www.jenv.be/) - You can also use jEnv to manage Java versions.
135+
136+
* **Docker**: Required for integration tests and building container images.
137+
138+
### Helm Chart Testing Requirements
139+
140+
These tools are required to run Helm chart tests (part of `./gradlew test` and `./gradlew intTest`):
141+
142+
* **Helm**: Kubernetes package manager, required for template validation and unit tests.
143+
* macOS: `brew install helm`
144+
* See [Helm installation instructions](https://helm.sh/docs/intro/install/)
145+
146+
* **Helm Unittest Plugin**: Required for running Helm unit tests.
147+
* Install: `helm plugin install https://github.com/helm-unittest/helm-unittest.git`
148+
149+
* **helm-docs**: Required for generating Helm chart documentation.
150+
* macOS: `brew install norwoodj/tap/helm-docs`
151+
* See [helm-docs installation instructions](https://github.com/norwoodj/helm-docs)
152+
153+
* **chart-testing (ct)**: Required for linting and testing Helm charts.
154+
* macOS: `brew install chart-testing`
155+
* See [chart-testing installation instructions](https://github.com/helm/chart-testing)
156+
157+
* **Minikube**: Required for running Helm chart integration tests.
158+
* macOS: `brew install minikube`
159+
* See [Minikube installation instructions](https://minikube.sigs.k8s.io/docs/start/)
160+
161+
* **kubectl**: Kubernetes command-line tool, required for Helm integration tests.
162+
* macOS: `brew install kubectl`
163+
* See [kubectl installation instructions](https://kubernetes.io/docs/tasks/tools/)
164+
165+
### Other Tools
166+
167+
These tools are helpful but not strictly required:
168+
169+
* **jq**: JSON processor, useful for working with Polaris APIs and scripts.
170+
* macOS: `brew install jq`
171+
* See [jq installation instructions](https://jqlang.github.io/jq/download/)
172+
173+
### Quick Installation (macOS)
174+
175+
For macOS users with Homebrew, you can install all dependencies at once using the provided Makefile:
176+
177+
```bash
178+
make install-dependencies-brew
179+
make install-optional-dependencies-brew
180+
```
181+
182+
To check which dependencies are installed:
183+
```bash
184+
make check-dependencies
185+
```
186+
187+
### Skipping Specific Tests
188+
189+
If you don't have all the Helm-related tools installed, you can skip those tests:
190+
191+
```bash
192+
# Run checks excluding Helm tests
193+
./gradlew check -x :polaris-helm:test
194+
195+
# Run build excluding Helm integration tests
196+
./gradlew build -x :polaris-helm:intTest
197+
```
128198

129199
## Code Contribution Guidelines
130200

gradle/projects.main.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ polaris-config-docs-annotations=tools/config-docs/annotations
5050
polaris-config-docs-generator=tools/config-docs/generator
5151
polaris-config-docs-site=tools/config-docs/site
5252

53+
polaris-helm=helm/polaris
54+
5355
# executor abstraction
5456
polaris-async-api=persistence/nosql/async/api
5557
polaris-async-java=persistence/nosql/async/java

helm/polaris/README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ weight: 675
2828
Do not modify the README.md file directly, please modify README.md.gotmpl instead.
2929
To re-generate the README.md file, install helm-docs then run from the repo root:
3030
helm-docs --chart-search-root=helm
31+
Alternatively, run ./gradlew helmDocs from the repo root.
3132
-->
3233

3334
![Version: 1.2.0-incubating-SNAPSHOT](https://img.shields.io/badge/Version-1.2.0--incubating--SNAPSHOT-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.2.0-incubating-SNAPSHOT](https://img.shields.io/badge/AppVersion-1.2.0--incubating--SNAPSHOT-informational?style=flat-square)
@@ -55,8 +56,6 @@ eval $(minikube docker-env)
5556
./gradlew \
5657
:polaris-server:assemble \
5758
:polaris-server:quarkusAppPartsBuild --rerun \
58-
:polaris-admin:assemble \
59-
:polaris-admin:quarkusAppPartsBuild --rerun \
6059
-Dquarkus.container-image.build=true
6160
```
6261

@@ -143,10 +142,11 @@ The following tools are required to run the tests:
143142
* [Helm Unit Test](https://github.com/helm-unittest/helm-unittest)
144143
* [Chart Testing](https://github.com/helm/chart-testing)
145144

146-
Quick installation instructions for these tools:
145+
Quick installation of all required tools on macOS:
146+
147147
```bash
148-
helm plugin install https://github.com/helm-unittest/helm-unittest.git
149-
brew install chart-testing
148+
make install-dependencies-brew
149+
make install-optional-dependencies-brew
150150
```
151151

152152
The integration tests also require some fixtures to be deployed. The `ci/fixtures` directory
@@ -183,6 +183,15 @@ Integration tests are run with the Chart Testing tool:
183183
ct install --namespace polaris --charts ./helm/polaris
184184
```
185185

186+
### Running tets with Gradle
187+
188+
Both unit and integration tests can be run with Gradle. From the Polaris repo root:
189+
190+
```bash
191+
./gradlew :polaris-helm:test
192+
./gradlew :polaris-helm:intTest
193+
```
194+
186195
## Values
187196

188197
| Key | Type | Default | Description |

helm/polaris/README.md.gotmpl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ weight: 675
2828
Do not modify the README.md file directly, please modify README.md.gotmpl instead.
2929
To re-generate the README.md file, install helm-docs then run from the repo root:
3030
helm-docs --chart-search-root=helm
31+
Alternatively, run ./gradlew helmDocs from the repo root.
3132
-->
3233

3334
{{ template "chart.deprecationWarning" . }}
@@ -57,8 +58,6 @@ eval $(minikube docker-env)
5758
./gradlew \
5859
:polaris-server:assemble \
5960
:polaris-server:quarkusAppPartsBuild --rerun \
60-
:polaris-admin:assemble \
61-
:polaris-admin:quarkusAppPartsBuild --rerun \
6261
-Dquarkus.container-image.build=true
6362
```
6463

@@ -145,10 +144,11 @@ The following tools are required to run the tests:
145144
* [Helm Unit Test](https://github.com/helm-unittest/helm-unittest)
146145
* [Chart Testing](https://github.com/helm/chart-testing)
147146

148-
Quick installation instructions for these tools:
147+
Quick installation of all required tools on macOS:
148+
149149
```bash
150-
helm plugin install https://github.com/helm-unittest/helm-unittest.git
151-
brew install chart-testing
150+
make install-dependencies-brew
151+
make install-optional-dependencies-brew
152152
```
153153

154154
The integration tests also require some fixtures to be deployed. The `ci/fixtures` directory
@@ -185,4 +185,13 @@ Integration tests are run with the Chart Testing tool:
185185
ct install --namespace polaris --charts ./helm/polaris
186186
```
187187

188+
### Running tets with Gradle
189+
190+
Both unit and integration tests can be run with Gradle. From the Polaris repo root:
191+
192+
```bash
193+
./gradlew :polaris-helm:test
194+
./gradlew :polaris-helm:intTest
195+
```
196+
188197
{{ template "chart.valuesSection" . }}

0 commit comments

Comments
 (0)