name: $(BuildID)_$(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)

variables:
  runCodesignValidationInjection: false
resources:
  containers:
  - container: linux-c-ubuntu-2004
    endpoint: csdk-containers
    image: csdkcontainerregistry.azurecr.io/linux-c-ubuntu-2004:latest
jobs:
- job: ubuntu2004
  container: linux-c-ubuntu-2004
  pool: 
    name: 'sdk-c--ubuntu-22'
  displayName: 'Ubuntu 20.04'
  steps:
  - script: |
      export OPENSSL_ia32cap=0x00000000
      sudo chmod -R 755 .
      sudo -E ./jenkins/linux_back_compat.sh
    displayName: 'Build'
  - script: |
      cd cmake && sudo -E ../build_all/linux/run_tests.sh
    displayName: 'Run Tests'
    env:
      IOTHUB_CONNECTION_STRING: $(IOTHUB-CONNECTION-STRING)
      IOTHUB_EVENTHUB_CONNECTION_STRING: $(IOTHUB-EVENTHUB-CONNECTION-STRING)
      IOTHUB_E2E_X509_CERT_BASE64: $(IOTHUB-E2E-X509-CERT-BASE64)
      IOTHUB_E2E_X509_PRIVATE_KEY_BASE64: $(IOTHUB-E2E-X509-PRIVATE-KEY-BASE64)
      IOTHUB_E2E_X509_THUMBPRINT: $(IOTHUB-E2E-X509-THUMBPRINT)
      IOTHUB_POLICY_KEY: $(IOTHUB-POLICY-KEY)
      STORAGE_ACCOUNT_CONNECTION_STRING: $(STORAGE-ACCOUNT-CONNECTION-STRING)
      IOT_DPS_CONNECTION_STRING: $(IOT-DPS-CONNECTION-STRING)
      IOT_DPS_ID_SCOPE: $(IOT-DPS-ID-SCOPE)
      IOTHUB_CA_ROOT_CERT: $(IOTHUB-CA-ROOT-CERT)
      IOTHUB_CA_ROOT_CERT_KEY: $(IOTHUB-CA-ROOT-CERT-KEY)
      IOT_DPS_GLOBAL_ENDPOINT: $(IOT-DPS-GLOBAL-ENDPOINT)
      IOTHUB_DEVICE_CONN_STRING_INVALIDCERT: $(IOTHUB-DEVICE-CONN-STRING-INVALIDCERT)
      IOTHUB_CONN_STRING_INVALIDCERT: $(IOTHUB-CONN-STRING-INVALIDCERT)
      DPS_GLOBALDEVICEENDPOINT_INVALIDCERT: $(DPS-GLOBALDEVICEENDPOINT-INVALIDCERT)
      PROVISIONING_CONNECTION_STRING_INVALIDCERT: $(PROVISIONING-CONNECTION-STRING-INVALIDCERT)
    condition: always()
