# auto generated by script/update-tasks.sh
# DO NOT EDIT: use the script instead
# source: https://raw.githubusercontent.com/openshift/pipelines-catalog/release-v0.9/s2i-java-11/s2i-java-11-task.yaml
#
---
apiVersion: tekton.dev/v1alpha1
kind: ClusterTask
metadata:
  name: s2i-java-11
spec:
  inputs:
    resources:
      - name: source
        type: git
    params:
      - name: PATH_CONTEXT
        description: The location of the path to run s2i from
        default: .
        type: string
      - name: TLSVERIFY
        description: Verify the TLS on the registry endpoint (for push/pull to a non-TLS registry)
        default: "true"
        type: string
      - name: MAVEN_ARGS_APPEND
        description: Additional Maven arguments
        default: ""
        type: string
      - name: MAVEN_CLEAR_REPO
        description: Remove the Maven repository after the artifact is built
        default: "false"
        type: string
      - name: MAVEN_MIRROR_URL
        description: The base URL of a mirror used for retrieving artifacts
        default: ""
        type: string
  outputs:
    resources:
      - name: image
        type: image
  steps:
    - name: gen-env-file
      image: quay.io/openshift-pipeline/s2i
      workingDir: /env-params
      command:
        - '/bin/sh'
        - '-c'
      args:
        - |-
          echo "MAVEN_CLEAR_REPO=$(inputs.params.MAVEN_CLEAR_REPO)" > env-file

          [[ '$(inputs.params.MAVEN_ARGS_APPEND)' != "" ]] &&
            echo "MAVEN_ARGS_APPEND=$(inputs.params.MAVEN_ARGS_APPEND)" >> env-file

          [[ '$(inputs.params.MAVEN_MIRROR_URL)' != "" ]] &&
            echo "MAVEN_MIRROR_URL=$(inputs.params.MAVEN_MIRROR_URL)" >> env-file

          echo "Generated Env file"
          echo "------------------------------"
          cat env-file
          echo "------------------------------"
      volumeMounts:
        - name: envparams
          mountPath: /env-params
    - name: generate
      image: quay.io/openshift-pipeline/s2i
      workingDir: /workspace/source
      command:
        - 's2i'
        - 'build'
        - '$(inputs.params.PATH_CONTEXT)'
        - 'registry.access.redhat.com/openjdk/openjdk-11-rhel7'
        - '--image-scripts-url'
        - 'image:///usr/local/s2i'
        - '--as-dockerfile'
        - '/gen-source/Dockerfile.gen'
        - '--environment-file'
        - '/env-params/env-file'
      volumeMounts:
        - name: gen-source
          mountPath: /gen-source
        - name: envparams
          mountPath: /env-params
    - name: build
      image: quay.io/buildah/stable
      workingDir: /gen-source
      command: ['buildah', 'bud', '--tls-verify=$(inputs.params.TLSVERIFY)', '--layers', '-f', '/gen-source/Dockerfile.gen', '-t', '$(outputs.resources.image.url)', '.']
      volumeMounts:
        - name: varlibcontainers
          mountPath: /var/lib/containers
        - name: gen-source
          mountPath: /gen-source
      securityContext:
        privileged: true
    - name: push
      image: quay.io/buildah/stable
      command: ['buildah', 'push', '--tls-verify=$(inputs.params.TLSVERIFY)', '$(outputs.resources.image.url)', 'docker://$(outputs.resources.image.url)']
      volumeMounts:
        - name: varlibcontainers
          mountPath: /var/lib/containers
      securityContext:
        privileged: true
  volumes:
    - name: varlibcontainers
      emptyDir: {}
    - name: gen-source
      emptyDir: {}
    - name: envparams
      emptyDir: {}
