-
Notifications
You must be signed in to change notification settings - Fork 328
Automate Helm tests with Gradle #2964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This PR automates Helm tests and make them executable as part of the Gradle build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
CONTRIBUTING.md
Outdated
| * [SDKMAN!](https://sdkman.io/) - Run `sdk list java` to see available distributions, then `sdk install java <identifier>` to install. | ||
| * [jEnv](https://www.jenv.be/) - You can also use jEnv to manage Java versions. | ||
|
|
||
| * **Docker**: Required for integration tests and building container images. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Docker or Podman? Podman with its docker compatibility shims works fairly well in my local build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice!
Some comments - all Gradle related improvements.
| description = "Apache Polaris (incubating) Helm Chart" | ||
|
|
||
| val helmTestReportsDir = layout.buildDirectory.dir("reports") | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| val runtimeServerDistribution by configurations.registering { | |
| isCanBeConsumed = true | |
| isCanBeResolved = false | |
| } | |
| dependencies { | |
| runtimeServerDistribution(project(":polaris-server", "distributionElements")) | |
| } |
helm/polaris/build.gradle.kts
Outdated
| workingDir = rootProject.projectDir | ||
|
|
||
| // Output: file containing SHA digest of built image | ||
| val outputFile = helmTestReportsDir.get().file("minikube-images.sha256") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better relativize outputFile to project.projectDir (or better this.workingDir) here (and in other places) so the commandLine doesn't contain any local paths.
Within a task configuration block, you can
| val outputFile = helmTestReportsDir.get().file("minikube-images.sha256") | |
| val outputFile = helmTestReportsDir.get().file("minikube-images.sha256").relativeTo(project.projectDir) |
helm/polaris/build.gradle.kts
Outdated
|
|
||
| dependsOn(":polaris-server:quarkusBuild") | ||
|
|
||
| inputs.dir(rootProject.file("runtime/server/build/quarkus-app")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the approach from above.
helm/polaris/build.gradle.kts
Outdated
| group = "documentation" | ||
| description = "Generate Helm chart documentation using helm-docs" | ||
|
|
||
| workingDir = rootProject.projectDir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| workingDir = rootProject.projectDir |
helm/polaris/build.gradle.kts
Outdated
| tasks.named("build") { | ||
| dependsOn(intTest) | ||
| dependsOn(helmDocs) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| tasks.named("build") { | |
| dependsOn(intTest) | |
| dependsOn(helmDocs) | |
| } | |
| tasks.named("assemble") { dependsOn(helmDocs) } |
| make install-dependencies-brew | ||
| make install-optional-dependencies-brew |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding this as a macOS variant but leave the Linux one?
(Also for the other occurrences below)
helm/polaris/build.gradle.kts
Outdated
| dependsOn(chartTestingInstall) | ||
| } | ||
|
|
||
| tasks.named("check") { dependsOn(test) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check is expected to exercise checks
| tasks.named("check") { dependsOn(test) } | |
| tasks.named("check") { dependsOn(test, intTest) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So check is expected to run intTest? TIL :-)
| ./gradlew \ | ||
| intTest \ | ||
| -x :polaris-runtime-service:intTest \ | ||
| -x :polaris-helm:intTest \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| -x :polaris-helm:intTest \ | |
| -x :polaris-helm:check \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So check doesn't work, :polaris-helm:intTest still gets executed.
|
|
||
| dependsOn(":polaris-server:quarkusBuild") | ||
|
|
||
| inputs.files(runtimeServerDistribution) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@snazy I think this is the only task that actually needs this configuration as input.
As for the Dockerfile, I don't see any other way to reference it as it is not an output of any task (that I know of). Should I create a configuration in polaris-server to expose it?
9070130 to
1e4db2c
Compare
|
To all the reviewers: sorry for so pushing so many commits 😅 – it was harder than I thought to get this PR right. Note: with this change, |
This PR automates Helm tests and make them executable as part of the Gradle build.