# Required pipeline variables:
# - BUILD_POOL - Azure DevOps build pool to use
# - CONTAINER_IMAGE - Dev container image URL to use. Should have Azure CLI, Packer and Ansible.
# - AZURE_CLIENT_ID - Service principal ID
# - AZURE_CLIENT_SECRET - Service principal secret
# - AZURE_TENANT_ID - tenant ID
# - KUBERNETES_VERSION - version of Kubernetes to create the sku for, e.g. `1.16.2`
# - OFFER - the name of the offer to create the sku for
# - OS - target of build e.g. `Ubuntu/Windows`
# - OS_VERSION - target of build e.g. `18.04/2004/2019/2022-containerd`
# - PUBLISHER - the name of the publisher to create the sku for
# - SKU_TEMPLATE_FILE - the base template file to use for the sku
# - VM_GENERATION - VM generation to use, e.g. `gen2`

jobs:
- job: create_sku
  container: $[ variables['CONTAINER_IMAGE'] ]
  timeoutInMinutes: 120
  strategy:
    maxParallel: 0
  pool:
    name: $(BUILD_POOL)
  steps:
  - script: |
      ./scripts/new-sku.sh
    displayName: Create a new marketplace SKU
    workingDirectory: '$(system.defaultWorkingDirectory)/images/capi/packer/azure'
    env:
      AZURE_CLIENT_SECRET: $(AZURE_CLIENT_SECRET)
  - task: PublishPipelineArtifact@1
    inputs:
      artifact: 'sku-info'
      path: '$(system.defaultWorkingDirectory)/images/capi/packer/azure/sku-publishing-info.json'