Files
stage-infra/Tekton/tasks/build-maven.yaml
2020-03-19 14:07:04 +01:00

50 lines
1.4 KiB
YAML

apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: build-maven
namespace: tekton-pipeline-1
spec:
params:
- name: DIRECTORY
description: The directory containing the app, relative to the source repository root
default: .
- name: CACHE
description: The name of the volume for caching Maven artifacts and base image layers
default: empty-dir-volume
- name: INSECUREREGISTRY
description: Whether to allow insecure registry
default: "true"
- name: image-name
description: name of the image after push
- name: image-tag
description: tag of the image after push
workspaces:
- name: source
mountpath: /source
steps:
- name: build-and-push
image: gcr.io/cloud-builders/mvn
command:
- mvn
- -o
- -B
- compile
- com.google.cloud.tools:jib-maven-plugin:build
- -Duser.home=/tekton/home
- -Djib.allowInsecureRegistries=$(params.INSECUREREGISTRY)
- -Djib.to.image=docker.io/beppev/$(params.image-name):$(params.image-tag)
- -Djib.from.auth.username=
- -Djib.from.auth.password=
- -Djib.to.auth.username=
- -Djib.to.auth.password=
workingDir: /source/$(params.DIRECTORY)
volumeMounts:
- name: $(params.CACHE)
mountPath: /tekton/home/.m2
subPath: m2-cache
- name: $(params.CACHE)
mountPath: /tekton/home/.cache
subPath: jib-cache
volumes:
- name: empty-dir-volume
emptyDir: {}