Basic Gradle Example
Below is a simple workflow for executing tests in a Gradle project stored on GitHub. You can paste this directly into the
YAML of an existing or new test, just make sure to update the name
and namespace
for your environment as needed.
- The
spec.content
property defines the path to the Gradle project on GitHub. - The
spec.container
property defines default constraints for any container created in this workflow. - The
spec.steps
property defines a single step that runs thegradle --no-daemon
test command.
Basic Gradle Workflow
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: gradle-sample
namespace: testkube
labels:
docs: example
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- contrib/executor/gradle/examples/hello-gradle
container:
workingDir: /data/repo/contrib/executor/gradle/examples/hello-gradle
resources:
requests:
cpu: 512m
memory: 512Mi
steps:
- name: Run tests
run:
image: gradle:8.5.0-jdk11
env:
- name: TESTKUBE_GRADLE
value: "true"
command:
- gradle
- --no-daemon
- test
After execution, you can see the log output from the test executions under the executions panel tabs:
Basic Gradle from Template
Below is an example workflow for executing the Gradle project using an official Testkube Template.
Basic Gradle Workflow from Template
apiVersion: testworkflows.testkube.io/v1
kind: TestWorkflow
metadata:
name: gradle-sample-from-template
namespace: testkube
labels:
docs: example
spec:
content:
git:
uri: https://github.com/kubeshop/testkube
revision: main
paths:
- contrib/executor/gradle/examples/hello-gradle
container:
workingDir: /data/repo/contrib/executor/gradle/examples/hello-gradle
env:
- name: TESTKUBE_GRADLE
value: "true"
steps:
- name: Run from template
template:
name: official/gradle/v1
config:
version: 8.5.0-jdk11