parameters:
  pool: 'Hosted Ubuntu 1604'
  jobName: 'none'
  scriptName: ''
  container: ''
  verification: ''
  continueOnError: false

jobs:

- job: ${{ parameters.jobName }}
  variables:
    scriptName: ${{ parameters.scriptName }}

  ${{ if ne(parameters.container, '') }}:
    container: ${{ parameters.container }}

  pool:
    name: ${{ parameters.pool }}

  displayName: ${{ parameters.jobName }}

  steps:
  - powershell: |
      Get-ChildItem -Path env:
    displayName: Capture environment
    condition: succeededOrFailed()

  - powershell:  Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhmmss"))"
    displayName: Set Build Name for Non-PR
    condition: ne(variables['Build.Reason'], 'PullRequest')

  - bash: |
      $(scriptName)
    displayName: Run Script - $(scriptName)
    condition: succeededOrFailed()
    continueOnError: ${{ parameters.continueOnError }}

  - ${{ if ne(parameters.verification, '') }}:
    - powershell: ${{ parameters.verification }}
      displayName: Verification
      continueOnError: ${{ parameters.continueOnError }}
