# Talend CI/CD on Azure DevOps
# Build Pipeline for building and publishing Docker images

trigger: none
pool:
 vmImage: 'ubuntu-latest'

variables:
- group: Talend Variables
- name: project_name
  value: 'XXX'
- name: artifact_name
  value: 'XXX'
- name: artifact_version
  value: 'XXX'
- name: docker_image_name
  value: 'XXX'

steps:
  - task: DownloadSecureFile@1
    name: settings_xml
    inputs:
      secureFile: settings.xml

  - task: DownloadSecureFile@1
    name: license
    inputs:
      secureFile: license

  - task: CmdLine@2
    inputs:
      script: 'docker pull openjdk:8-jre-slim'

  - task: Maven@3
    inputs:
        mavenPomFile: '$(project_name)/poms/pom.xml' 
        mavenOptions: |
          -Dlicense.path=$(license.secureFilePath)
          -Dupdatesite.path=$(updatesite_path)
          -Ddocker.push.registry=$(docker_registry)
          -Ddocker.push.username=$(docker_username)
          -Ddocker.push.password=$(docker_password)
          -Xmx3096m -Xms1024m
        options: '--settings $(settings_xml.secureFilePath) -X -Pdocker -pl jobs/process/$(artifact_name)_$(artifact_version) -am -Dtalend.docker.name=$(docker_image_name)'
        goals: 'deploy'