---
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: maven
spec:
  workspaces:
  - name: maven-repo
  inputs:
    params:
    - name: GOALS
      description: The Maven goals to run
      type: array
      default: ["package"]
    - name: MAVEN_SETTINGS_CONFIGMAP
      description: The configmap containing Maven settings.xml
      type: string
      default: maven-settings
    resources:
    - name: source
      type: git
  steps:
    - name: mvn
      image: gcr.io/cloud-builders/mvn
      workingDir: /workspace/source/bank-app-backend
      command: ["/usr/bin/mvn"]
      args:
        - -DskipITs
        - -Dmaven.test.skip=true
        - -Dmaven.repo.local=$(workspaces.maven-repo.path)
        - -s
        - /var/config/settings.xml
        - "$(inputs.params.GOALS)"
      volumeMounts:
        - name: maven-settings
          mountPath: /var/config
  volumes:
    - name: maven-settings
      configMap:
        name: $(inputs.params.MAVEN_SETTINGS_CONFIGMAP)
