aboutsummaryrefslogtreecommitdiffstats
path: root/fpga/.ci/templates/job-package-images.yml
blob: df73500427d53e8f81b40e4b4d454f497bf366d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# Copyright 2022 Ettus Research, a National Instruments Brand
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# Description:
#
#   This template shall be used to package images.
#
#   See description for the parameters below.
#

parameters:
### Required parameters
# Package name for identification purposes
- name: package_name
  type: string
# FPGA artifacts to be downloaded to "build_directory"
# Note that the value for each key is not used in this job.
# E.g.
#   targets_matrix:
#     X410_XG_100:
#       target: X410_XG_100
#       timeout: 480
#     X410_X4_200:
#       target: X410_X4_200
#       timeout: 480
- name: artifacts_matrix
  type: object
# PATH to device's build directory (where artifacts will be copied and
# packaging utility will be run)
- name: build_directory
  type: string


jobs:
- job: ${{ parameters.package_name }}
  displayName: 'Create ${{ parameters.package_name }}'
  timeoutInMinutes: 10
  pool:
    name: hardware
  steps:
    - checkout: self
      clean: true

    - ${{ each artifact in parameters.artifacts_matrix }}:
      - download: current
        artifact: ${{ artifact.key }}
        displayName: 'Download ${{ artifact.key }}'

    - ${{ each artifact in parameters.artifacts_matrix }}:
      - bash: |
          mkdir -p ${{ parameters.build_directory }}
          cp $(Pipeline.Workspace)/${{ artifact.key }}/* \
             ${{ parameters.build_directory }}/
          rm -rf $(Pipeline.Workspace)/${{ artifact.key }}/
        displayName: 'Populate ${{ artifact.key }} artifacts'

    - bash: |
        OSS_REPO_HASH="$(git rev-parse --verify HEAD --short=7 2>/dev/null)"
        echo "##vso[task.setvariable variable=OSS_REPO_HASH]$OSS_REPO_HASH"
        echo "OSS Repo hash: $OSS_REPO_HASH"
        python3 $(Build.SourcesDirectory)/fpga/usrp3/tools/utils/package_images.py --githash "uhd-$OSS_REPO_HASH"
        rm -f *.bit *.dts *.rpt *.md5
      workingDirectory: ${{ parameters.build_directory }}
      displayName: 'Run package_images.py'

    # Publish the final result only if all previous steps passed
    - publish: ${{ parameters.build_directory }}
      artifact: '${{ parameters.package_name }}-g$(OSS_REPO_HASH)'
      displayName: 'Publish package'