apiVersion: tekton.dev/v1
kind: Task
metadata:
  annotations:
    artifacthub.io/category: integration-delivery
    artifacthub.io/maintainers: |
      - name: OpenShift Pipeline task maintainers
        email: pipelines-extcomm@redhat.com
    artifacthub.io/provider: Red Hat
    artifacthub.io/recommendations: |
      - url: https://tekton.dev/
    operator.tekton.dev/last-applied-hash: c6d98f357880dfd3a487e2b621693d9b1182a05cbe4f54aa65d6c5acb1c07aea
    tekton.dev/categories: containers
    tekton.dev/pipelines.minVersion: 0.41.0
    tekton.dev/source: https://github.com/openshift-pipelines/task-maven
    tekton.dev/tags: containers
  creationTimestamp: "2024-06-10T13:45:47Z"
  generation: 1
  labels:
    app.kubernetes.io/version: 0.2.1
    operator.tekton.dev/operand-name: openshift-pipelines-addons
    operator.tekton.dev/provider-type: redhat
  name: maven
  namespace: openshift-pipelines
  ownerReferences:
  - apiVersion: operator.tekton.dev/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: TektonInstallerSet
    name: addon-custom-resolvertask-4w7k4
    uid: 44cc2eb3-48d8-4e6c-82ef-203759a9a88b
  resourceVersion: "38841"
  uid: b6228b4e-0006-4c4b-9039-908fa71b1c91
spec:
  description: This Task can be used to run a Maven build.
  params:
  - default:
    - package
    description: maven goals to run
    name: GOALS
    type: array
  - default: ""
    description: The Maven repository mirror url
    name: MAVEN_MIRROR_URL
    type: string
  - default: .
    description: The subdirectory within the repository for sources on which we want
      to execute maven goals.
    name: SUBDIRECTORY
    type: string
  stepTemplate:
    computeResources: {}
    env:
    - name: PARAMS_MAVEN_MIRROR_URL
      value: $(params.MAVEN_MIRROR_URL)
    - name: PARAMS_SUBDIRECTORY
      value: $(params.SUBDIRECTORY)
    - name: WORKSPACES_SOURCE_PATH
      value: $(workspaces.source.path)
    - name: WORKSPACES_SOURCE_BOUND
      value: $(workspaces.source.bound)
    - name: WORKSPACES_SERVER_SECRET_PATH
      value: $(workspaces.server_secret.path)
    - name: WORKSPACES_SERVER_SECRET_BOUND
      value: $(workspaces.server_secret.bound)
    - name: WORKSPACES_PROXY_SECRET_PATH
      value: $(workspaces.proxy_secret.path)
    - name: WORKSPACES_PROXY_SECRET_BOUND
      value: $(workspaces.proxy_secret.bound)
    - name: WORKSPACES_PROXY_CONFIGMAP_PATH
      value: $(workspaces.proxy_configmap.path)
    - name: WORKSPACES_PROXY_CONFIGMAP_BOUND
      value: $(workspaces.proxy_configmap.bound)
    - name: WORKSPACES_MAVEN_SETTINGS_PATH
      value: $(workspaces.maven_settings.path)
    - name: WORKSPACES_MAVEN_SETTINGS_BOUND
      value: $(workspaces.maven_settings.bound)
  steps:
  - computeResources: {}
    image: registry.access.redhat.com/ubi8/ubi-minimal:8.9
    name: load-scripts
    script: |
      set -e
      printf '%s' "IyEvdXNyL2Jpbi9lbnYgYmFzaAoKZGVjbGFyZSAtcnggTUFWRU5fR0VORVJBVEVfRElSRUNUT1JZPSIke1dPUktTUEFDRVNfU09VUkNFX1BBVEh9L21hdmVuLWdlbmVyYXRlIgoKZGVjbGFyZSAtcnggTUFWRU5fU0VUVElOR1NfRklMRT0iJHtNQVZFTl9HRU5FUkFURV9ESVJFQ1RPUll9L3NldHRpbmdzLnhtbCIKCmlmIFtbIC1mICR7TUFWRU5fU0VUVElOR1NfRklMRX0gXV07IHRoZW4KICAgIGVjaG8gInVzaW5nIGV4aXN0aW5nICcke01BVkVOX1NFVFRJTkdTX0ZJTEV9JyIKICAgIGNhdCAke01BVkVOX1NFVFRJTkdTX0ZJTEV9CiAgICBleGl0IDAKZmkKCiMgQ2hlY2sgaWYgc2V0dGluZ3MueG1sIGV4aXN0cyBpbiB0aGUgd29ya3NwYWNlIG1hdmVuLXNldHRpbmdzCmlmIFtbIC1mICIke1dPUktTUEFDRVNfTUFWRU5fU0VUVElOR1NfUEFUSH0vc2V0dGluZ3MueG1sIiBdXTsgdGhlbgogICAgY3AgIiR7V09SS1NQQUNFU19NQVZFTl9TRVRUSU5HU19QQVRIfS9zZXR0aW5ncy54bWwiICIke01BVkVOX1NFVFRJT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hlbgogICAgeG1sPSIgICAgPG1pcnJvcj5cCiAgICA8aWQ+bWlycm9yLmRlZmF1bHQ8L2lkPlwKICAgIDx1cmw+JHtQQVJBTVNfTUFWRU5fTUlSUk9SX1VSTH08L3VybD5cCiAgICA8bWlycm9yT2Y+Y2VudHJhbDwvbWlycm9yT2Y+XAogICAgPC9taXJyb3I+IgogICAgc2VkIC1pICJzfDwhLS0gIyMjIG1pcnJvcnMgZnJvbSBFTlYgIyMjIC0tPnwkeG1sfCIgJHtNQVZFTl9TRVRUSU5HU19GSUxFfQpmaQo=" |base64 -d >maven-generate.sh
      chmod +x maven-*.sh
    volumeMounts:
    - mountPath: /scripts
      name: scripts-dir
    workingDir: /scripts
  - command:
    - /scripts/maven-generate.sh
    computeResources: {}
    env:
    - name: HOME
      value: /tekton/home
    image: registry.access.redhat.com/ubi8/ubi-minimal:8.9
    name: maven-generate
    securityContext:
      runAsNonRoot: true
      runAsUser: 65532
    volumeMounts:
    - mountPath: /scripts
      name: scripts-dir
    - mountPath: /maven-generate
      name: maven-settings-dir
  - args:
    - -s
    - maven-generate/settings.xml
    - $(params.GOALS[*])
    command:
    - /usr/bin/mvn
    computeResources: {}
    env:
    - name: HOME
      value: /tekton/home
    image: registry.access.redhat.com/ubi8/openjdk-11:latest
    name: maven-goals
    securityContext:
      runAsNonRoot: true
      runAsUser: 65532
    volumeMounts:
    - mountPath: /maven-generate
      name: maven-settings-dir
    workingDir: $(workspaces.source.path)/$(params.SUBDIRECTORY)
  volumes:
  - emptyDir: {}
    name: scripts-dir
  - emptyDir: {}
    name: maven-settings-dir
  workspaces:
  - description: The workspace consisting of maven project.
    name: source
  - description: The workspace containing server secrets (username and password)
    name: server_secret
    optional: true
  - description: The workspace containing proxy server access credentials (username,
      password).
    name: proxy_secret
    optional: true
  - description: The workspace containing some proxy values (proxy_port,proxy_host,proxy_protocol,proxy_non_proxy_hosts)
    name: proxy_configmap
    optional: true
  - description: The workspace consisting of the custom maven settings provided by
      the user.
    name: maven_settings
    optional: true
