uhd/.ci/templates/job-get-latest-uhd-docker.yml
2026-08-20 02:03:09 +02:00

85 lines
5.2 KiB
YAML

# Must include uhd-pipeline-vars.yml in top line pipeline to include this template
# Reads and sets uhd docker builder information to variables
# dockerBuildNumber, dockerImagePrefix, dockerImageMatrix
# Reference the data by calling:
# $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerBuildNumber'] ]
# $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerImagePrefix'] ]
# $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerImageMatrixLin'] ]
# $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerImageMatrixWin'] ]
# $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerImageMatrixUbuntuDeb'] ]
# $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.macOSBuilders'] ]
# $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerImageMatrixSourcePackageBuilders'] ]
# $[ dependencies.get_latest_uhd_docker.outputs['setDockerVar.dockerImageMatrixFedoraRpm'] ]
jobs:
- job: get_latest_uhd_docker
displayName: Get Last Docker Build Version
pool:
name: Drivers-NIBuildFarm-RFMIBUILD
demands: sh
steps:
- checkout: self
clean: true
- download: uhd_build_docker_container
displayName: Download Docker Image List
# The following script pulls each line from the DockerImageNames
# file and variablizes them in the AzDO Pipeline Context.
# sed '1q;d' pulls the first line, sed '2q;d' pulls the second, etc.
- script: |
set -euo pipefail
cd $(Pipeline.Workspace)/uhd_build_docker_container/
artifact_file="$(UHDPipelineDockerImageArtifactName)/$(UHDPipelineDockerImageArtifactName)"
derive_script="$(Build.SourcesDirectory)/.ci/utils/derive_docker_image_matrix.py"
line_count=$(wc -l < "$artifact_file")
if [ "$line_count" -eq 9 ]; then
macos_line=6
docker_image_matrix_lin=$(sed '3q;d' "$artifact_file")
docker_image_matrix_win=$(sed '4q;d' "$artifact_file")
docker_image_matrix_ubuntu_deb=$(sed '5q;d' "$artifact_file")
docker_image_matrix_source_package=$(sed '7q;d' "$artifact_file")
docker_image_matrix_fedora_rpm=$(sed '8q;d' "$artifact_file")
docker_image_matrix_windows_python_build=$(sed '9q;d' "$artifact_file")
elif [ "$line_count" -eq 6 ]; then
macos_line=5
# Keep derive failures blocking for strict CI reasons (CI/scheduled),
# but allow non-CI/manual debug runs to continue with '{}' fallback.
# PR runs also use fallback mode.
# The behavior is implemented by derive_docker_image_matrix.py.
docker_image_matrix_lin=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type build --os linux)
docker_image_matrix_win=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type build --os windows)
docker_image_matrix_ubuntu_deb=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type installer --os linux --package deb --filter-out "focal,questing")
docker_image_matrix_source_package=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type source --os linux --select noble)
docker_image_matrix_fedora_rpm=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --type installer --os linux --package rpm)
docker_image_matrix_windows_python_build=$(python3 "$derive_script" --empty-on-error-non-ci --input "$artifact_file" --section windows-python-build-matrix)
else
echo "Error: Unexpected DockerImageNames format with $line_count lines; expected 6 or 9"
exit 1
fi
docker_build_number=$(sed '1q;d' "$artifact_file")
docker_image_prefix=$(sed '2q;d' "$artifact_file")
macos_builders=$(sed "${macos_line}q;d" "$artifact_file")
echo "##vso[task.setvariable variable=dockerBuildNumber;isOutput=true;]$docker_build_number"
echo "##vso[task.setvariable variable=dockerImagePrefix;isOutput=true;]$docker_image_prefix"
echo "##vso[task.setvariable variable=dockerImageMatrixLin;isOutput=true;]$docker_image_matrix_lin"
echo "##vso[task.setvariable variable=dockerImageMatrixWin;isOutput=true;]$docker_image_matrix_win"
echo "##vso[task.setvariable variable=dockerImageMatrixUbuntuDeb;isOutput=true;]$docker_image_matrix_ubuntu_deb"
echo "##vso[task.setvariable variable=macOSBuilders;isOutput=true;]$macos_builders"
echo "##vso[task.setvariable variable=dockerImageMatrixSourcePackageBuilders;isOutput=true;]$docker_image_matrix_source_package"
echo "##vso[task.setvariable variable=dockerImageMatrixFedoraRpm;isOutput=true;]$docker_image_matrix_fedora_rpm"
echo "##vso[task.setvariable variable=dockerImageMatrixWinPythonBuild;isOutput=true;]$docker_image_matrix_windows_python_build"
name: setDockerVar
- script: |
echo "Docker Build Number: "
echo $(setDockerVar.dockerBuildNumber)
echo $(setDockerVar.dockerImagePrefix)
echo $(setDockerVar.dockerImageMatrixLin)
echo $(setDockerVar.dockerImageMatrixWin)
echo $(setDockerVar.dockerImageMatrixUbuntuDeb)
echo $(setDockerVar.macOSBuilders)
echo $(setDockerVar.dockerImageMatrixSourcePackageBuilders)
echo $(setDockerVar.dockerImageMatrixFedoraRpm)
echo $(setDockerVar.dockerImageMatrixWinPythonBuild)
name: echoDockerVar