#
# Copyright 2021 Ettus Research, a National Instruments Brand
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# Description:
#
# Build openembedded (OE) package for host architecture (genericx86-64)
#
# The recipe to be built is specified by variable "Image"
# The package itself is built (step "build $(Image)") and also all runtime
# dependencies are built (step "build $(Image) with dependencies")
#
# For the recipes "uhd", "uhd-fpga-images" and "mpmd", the build is configured
# to use the source code from the $(Agent.BuildDirectory)/uhd directory. The
# code is checked out by this pipeline with the branch and version which
# triggered this pipeline.
#
# The pipeline generates an artifact named qemux86_64-ipks containing the IPKs.

trigger:
  branches:
    include:
    - master
  paths:
    include:
    - .ci
    - host

pr:
  branches:
    include:
    - master
  paths:
    include:
    - .ci
    - host

resources:
  repositories:
    - repository: meta-ettus
      type: github
      name: EttusResearch/meta-ettus-dev
      endpoint: EttusResearch
      ref: zeus-ci
  pipelines:
    - pipeline: usrp-kas-pipeline
      source: 'usrp-kas'

variables:
  AUTO_CONF: $(Agent.BuildDirectory)/auto.conf

jobs:
  - template: .ci/templates/job_build_package.yml@meta-ettus
    parameters:
      machines:
        - qemux86_64
      targets:
        - $(Image)
        - package-index
        - package-feed
      auto_conf: $AUTO_CONF
      prebuild_steps:
        - script: rm -f $AUTO_CONF
        - template: .ci/templates/oe_localconf_externalsrc.yml@meta-ettus
          parameters:
            conf_file: $AUTO_CONF
            repository: self
            package_paths:
              - package: uhd
                path: host
              - package: mpmd
                path: mpm