variables:
  wd: '$(System.DefaultWorkingDirectory)/integrationTest'

trigger:
  batch: "true"
  branches:
    include:
    - pipeline

# Each provider gets its' own job. These will run in parallel.
# each job gets setup with only the env vars it needs for that run.
# these are defined in azure pipelines web ui as secret variables.

jobs:

- job: Route53
  steps:
  - template: go-env.yaml
  - script: go test -v -verbose -provider ROUTE53
    workingDirectory: $(wd)
    env:
      R53_DOMAIN: $(R53_DOMAIN)
      R53_KEY_ID: $(R53_KEY_ID)
      R53_KEY: $(R53_KEY)

- job: GCloud
  steps:
  - template: go-env.yaml
  - script: go test -v -verbose -provider GCLOUD
    workingDirectory: $(wd)
    env:
      GCLOUD_DOMAIN: $(GCLOUD_DOMAIN)
      GCLOUD_TYPE: $(GCLOUD_TYPE)
      GCLOUD_EMAIL: $(GCLOUD_EMAIL)
      GCLOUD_PROJECT: $(GCLOUD_PROJECT)
      GCLOUD_PRIVATEKEY: $(GCLOUD_PRIVATEKEY)

- job: NameDotCom
  steps:
  - template: go-env.yaml
  - script: go test -v -verbose -provider NAMEDOTCOM
    workingDirectory: $(wd)
    env:
      NAMEDOTCOM_DOMAIN: $(NAMEDOTCOM_DOMAIN)
      NAMEDOTCOM_KEY: $(NAMEDOTCOM_KEY)
      NAMEDOTCOM_USER: $(NAMEDOTCOM_USER)

- job: Cloudflare
  steps:
  - template: go-env.yaml
  - script: go test -v -timeout 30m -verbose -provider CLOUDFLAREAPI
    workingDirectory: $(wd)
    env:
      CF_TOKEN: $(CF_TOKEN)

- job: DigitalOcean
  steps:
  - template: go-env.yaml
  - script: go test -v -verbose -provider DIGITALOCEAN
    workingDirectory: $(wd)
    env:
      DO_DOMAIN: $(DO_DOMAIN)
      DO_TOKEN: $(DO_TOKEN)

- job: GandiV5
  steps:
  - template: go-env.yaml
  - script: go test -v -verbose -provider GANDI_V5
    workingDirectory: $(wd)
    env:
      GANDI_KEY: $(GANDI_V5_APIKEY)
      GANDI_DOMAIN: $(GANDI_V5_DOMAIN)

# - job: GandiLive
#   steps:
#   - template: go-env.yaml
#   - script: go test -v -verbose -provider GANDI-LIVEDNS
#     workingDirectory: $(wd)
#     env:
#       GANDILIVE_KEY: $(GANDILIVE_KEY)
#       GANDILIVE_DOMAIN: $(GANDILIVE_DOMAIN)

# - job: NS1
#   steps:
#   - template: go-env.yaml
#   - script: go test -v -verbose -provider NS1
#     workingDirectory: $(wd)
#     env:
#       NS1_TOKEN: $(NS1_TOKEN)
#       NS1_DOMAIN: $(NS1_DOMAIN)

- job: DNSIMPLE
  steps:
  - template: go-env.yaml
  - script: go test -v -verbose -provider DNSIMPLE
    workingDirectory: $(wd)
    env:
      DNSIMPLE_TOKEN: $(DNSIMPLE_TOKEN)
      DNSIMPLE_DOMAIN: $(DNSIMPLE_DOMAIN)

- job: Vultr
  steps:
  - template: go-env.yaml
  - script: go test -v -verbose -provider VULTR
    workingDirectory: $(wd)
    env:
      VULTR_DOMAIN: $(VULTR_DOMAIN)
      VULTR_TOKEN: $(VULTR_TOKEN)

- job: Azure
  steps:
    - template: go-env.yaml
    - script: go test -v -verbose -provider AZURE_DNS
      workingDirectory: $(wd)
      env:
        AZURE_CLIENT_ID: $(AZ_CLIENTID)
        AZURE_CLIENT_SECRET: $(AZ_CLIENTSECRET)
        AZURE_DOMAIN: $(AZ_DOMAIN)
        AZURE_RESOURCE_GROUP: $(AZ_RSGNAME)
        AZURE_SUBSCRIPTION_ID: $(AZ_SUBSCRIPTIONID)
        AZURE_TENANT_ID: $(AZ_TENANTID)
