mirror of
https://github.com/tektoncd/catalog.git
synced 2024-11-22 06:02:51 +00:00
jib-gradle: use workspace instead of GitResource 🐐
This migrate jib-gradle to use `workspace` instead of an input `GitResource`. This also updates e2e tests to use a `Pipeline` in order to clone the repository in the workspace. Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
This commit is contained in:
parent
a648e990dd
commit
84bb6d320a
@ -16,13 +16,13 @@ kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/master/jib-g
|
||||
- **DIRECTORY**: The directory in the source repository where source should be found. (*default: .*)
|
||||
- **CACHE**: The name of the volume for caching Gradle artifacts, local Maven repository, and base image layers (*default: empty-dir-volume*)
|
||||
|
||||
## Resources
|
||||
|
||||
### Inputs
|
||||
## Workspaces
|
||||
|
||||
* **source**: A `git`-type `PipelineResource` specifying the location of the
|
||||
source to build.
|
||||
|
||||
## Resources
|
||||
|
||||
### Outputs
|
||||
|
||||
* **image**: The Docker image name to apply to the newly built image.
|
||||
@ -55,14 +55,11 @@ spec:
|
||||
params:
|
||||
- name: DIRECTORY
|
||||
value: ./examples/helloworld
|
||||
workspaces:
|
||||
- name: source
|
||||
persistentVolumeClaim:
|
||||
claimName: my-source
|
||||
resources:
|
||||
inputs:
|
||||
- name: source
|
||||
resourceSpec:
|
||||
type: git
|
||||
params:
|
||||
- name: url
|
||||
value: https://github.com/my-user/my-repo
|
||||
outputs:
|
||||
- name: image
|
||||
resourceRef:
|
||||
|
@ -13,10 +13,9 @@ spec:
|
||||
- name: INSECUREREGISTRY
|
||||
description: Whether to allow insecure registry
|
||||
default: "false"
|
||||
workspaces:
|
||||
- name: source
|
||||
resources:
|
||||
inputs:
|
||||
- name: source
|
||||
type: git
|
||||
outputs:
|
||||
- name: image
|
||||
type: image
|
||||
@ -46,7 +45,7 @@ spec:
|
||||
-Dgradle.user.home=/tekton/home/.gradle \
|
||||
-Djib.allowInsecureRegistries=$(params.INSECUREREGISTRY) \
|
||||
-Djib.to.image=$(resources.outputs.image.url)
|
||||
workingDir: /workspace/source/$(params.DIRECTORY)
|
||||
workingDir: $(workspaces.source.path)/$(params.DIRECTORY)
|
||||
volumeMounts:
|
||||
- name: $(params.CACHE)
|
||||
mountPath: /tekton/home/.gradle/caches
|
||||
|
@ -3,3 +3,6 @@
|
||||
# Add an internal registry as sidecar to the task so we can upload it directly
|
||||
# from our tests withouth having to go to an external registry.
|
||||
add_sidecar_registry ${TMPF}
|
||||
|
||||
# Add git-clone
|
||||
kubectl -n ${tns} apply -f ./git/git-clone.yaml
|
||||
|
@ -1,18 +1,6 @@
|
||||
---
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: PipelineResource
|
||||
metadata:
|
||||
name: console-java-simple
|
||||
spec:
|
||||
type: git
|
||||
params:
|
||||
- name: revision
|
||||
value: master
|
||||
- name: url
|
||||
value: https://github.com/che-samples/console-java-simple
|
||||
---
|
||||
apiVersion: tekton.dev/v1alpha1
|
||||
kind: PipelineResource
|
||||
metadata:
|
||||
name: image
|
||||
spec:
|
||||
@ -20,3 +8,14 @@ spec:
|
||||
params:
|
||||
- name: url
|
||||
value: localhost:5000/tekton-pipelines/console-java-simple
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: jib-gradle-source-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 500Mi
|
||||
|
@ -1,20 +1,56 @@
|
||||
---
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: TaskRun
|
||||
kind: Pipeline
|
||||
metadata:
|
||||
name: jib-gradle-run
|
||||
name: jib-gradle-test-pipeline
|
||||
spec:
|
||||
taskRef:
|
||||
name: jib-gradle
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
resources:
|
||||
outputs:
|
||||
- name: image
|
||||
resourceRef:
|
||||
name: image
|
||||
inputs:
|
||||
- name: build-image
|
||||
type: image
|
||||
tasks:
|
||||
- name: fetch-repository
|
||||
taskRef:
|
||||
name: git-clone
|
||||
workspaces:
|
||||
- name: output
|
||||
workspace: shared-workspace
|
||||
params:
|
||||
- name: url
|
||||
value: https://github.com/che-samples/console-java-simple
|
||||
- name: subdirectory
|
||||
value: ""
|
||||
- name: deleteExisting
|
||||
value: "true"
|
||||
- name: jib-gradle
|
||||
taskRef:
|
||||
name: jib-gradle
|
||||
runAfter:
|
||||
- fetch-repository
|
||||
workspaces:
|
||||
- name: source
|
||||
resourceRef:
|
||||
name: console-java-simple
|
||||
params:
|
||||
- name: INSECUREREGISTRY
|
||||
value: "true"
|
||||
workspace: shared-workspace
|
||||
params:
|
||||
- name: INSECUREREGISTRY
|
||||
value: "true"
|
||||
resources:
|
||||
outputs:
|
||||
- name: image
|
||||
resource: build-image
|
||||
---
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: PipelineRun
|
||||
metadata:
|
||||
name: jib-gradle-test-pipeline-run
|
||||
spec:
|
||||
pipelineRef:
|
||||
name: jib-gradle-test-pipeline
|
||||
workspaces:
|
||||
- name: shared-workspace
|
||||
persistentvolumeclaim:
|
||||
claimName: jib-gradle-source-pvc
|
||||
resources:
|
||||
- name: build-image
|
||||
resourceRef:
|
||||
name: image
|
||||
|
Loading…
Reference in New Issue
Block a user