1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-23 06:08:46 +00:00

Add gradle wrapper support

This commit is contained in:
Bastiaan Nijkamp 2023-10-25 22:29:19 +02:00 committed by tekton-robot
parent 9316f0bdd3
commit fc7afa447a
3 changed files with 42 additions and 3 deletions

View File

@ -1,11 +1,12 @@
# Gradle
This Task can be used to run a Gradle build on a gradle project.
If the project contains a gradle wrapper, the wrapper will be invoked instead of the gradle executable provided by the image.
## Install the Task
```bash
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/gradle/0.3/raw
kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/gradle/0.4/raw
```
## Parameters

View File

@ -3,7 +3,7 @@ kind: Task
metadata:
name: gradle
labels:
app.kubernetes.io/version: "0.3"
app.kubernetes.io/version: "0.4"
annotations:
tekton.dev/pipelines.minVersion: "0.17.0"
tekton.dev/displayName: Gradle
@ -54,7 +54,12 @@ spec:
fi
fi
cmd="gradle $*"
if [[ -f gradlew ]]; then
cmd="./gradlew $*"
else
cmd="gradle $*"
fi
echo "Running gradle task with command below"
echo "$cmd"
eval "$cmd"

View File

@ -35,6 +35,39 @@ spec:
workspace: shared-workspace
- name: gradle-config
workspace: gradle-config
- name: fetch-wrapper-code
taskRef:
name: git-clone
runAfter:
- gradle-run
workspaces:
- name: output
workspace: shared-workspace
params:
- name: url
value: https://github.com/BastiaanN/simple-gradle-wrapper
- name: subdirectory
value: "wrapper-test"
- name: deleteExisting
value: "true"
- name: gradle-wrapper-run
taskRef:
name: gradle
runAfter:
- fetch-wrapper-code
params:
- name: TASKS
value:
- build
- name: PROJECT_DIR
value: "wrapper-test"
- name: GRADLE_IMAGE
value: docker.io/library/eclipse-temurin:17-jdk-alpine@sha256:16d70818ae1d9dfca5e8d05de8e74a23c959ae59968010f013a4cfe5aa5b0038
workspaces:
- name: source
workspace: shared-workspace
- name: gradle-config
workspace: gradle-config
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun