From bbc4d2feb910d1512c345635411bc00387f3a1bc Mon Sep 17 00:00:00 2001 From: Hang Date: Tue, 14 Feb 2023 14:33:06 +0800 Subject: [PATCH] [Packaging] Support ARM64 on Linux (#24180) --- .azure-pipelines/templates/variables.yml | 1 + azure-pipelines.yml | 290 ++++++++++++------- scripts/ci/install_docker.sh | 15 + scripts/release/debian/build.sh | 15 +- scripts/release/debian/deb_install.sh | 2 +- scripts/release/debian/prepare.sh | 4 +- scripts/release/debian/test_deb_in_docker.sh | 2 +- scripts/release/rpm/azure-cli.spec | 6 - scripts/release/rpm/fedora.dockerfile | 5 +- scripts/release/rpm/mariner.dockerfile | 9 +- scripts/release/rpm/pipeline.sh | 2 +- scripts/release/rpm/pipeline_mariner.sh | 2 +- scripts/release/rpm/ubi.dockerfile | 6 +- 13 files changed, 228 insertions(+), 131 deletions(-) create mode 100755 scripts/ci/install_docker.sh diff --git a/.azure-pipelines/templates/variables.yml b/.azure-pipelines/templates/variables.yml index 02890039265..f53f0c89e30 100644 --- a/.azure-pipelines/templates/variables.yml +++ b/.azure-pipelines/templates/variables.yml @@ -1,3 +1,4 @@ variables: ubuntu_pool: 'pool-ubuntu-2004' windows_pool: 'pool-windows-2019' + ubuntu_arm64_pool: 'ubuntu-arm64-2004-pool' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 04c3ebe8309..ba737fd07cc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -15,6 +15,17 @@ pr: variables: - template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml +parameters: +- name: architectures + type: object + default: + - name: AMD64 + value: amd64 + pool: pool-ubuntu-2004 + - name: ARM64 + value: arm64 + pool: ubuntu-arm64-2004-pool + jobs: - job: CheckPullRequest displayName: "Check the Format of Pull Request Title and Content" @@ -276,9 +287,19 @@ jobs: dependsOn: ExtractMetadata condition: succeeded() + strategy: + matrix: + AMD64: + pool: ${{ variables.ubuntu_pool }} + artifactName: docker-amd64 + ARM64: + pool: ${{ variables.ubuntu_arm64_pool }} + artifactName: docker-arm64 pool: - name: ${{ variables.ubuntu_pool }} + name: $(pool) steps: + - bash: ./scripts/ci/install_docker.sh + displayName: Install Docker - task: Bash@3 displayName: 'Bash Script' inputs: @@ -295,15 +316,23 @@ jobs: displayName: 'Publish Artifact: docker image' inputs: TargetPath: $(Build.ArtifactStagingDirectory) - ArtifactName: docker + ArtifactName: $(artifactName) - job: TestDockerImage displayName: Test Docker Image dependsOn: BuildDockerImage condition: succeeded() + strategy: + matrix: + AMD64: + pool: ${{ variables.ubuntu_pool }} + artifactName: docker-amd64 + ARM64: + pool: ${{ variables.ubuntu_arm64_pool }} + artifactName: docker-arm64 pool: - name: ${{ variables.ubuntu_pool }} + name: $(pool) steps: - task: DownloadPipelineArtifact@1 displayName: 'Download Metadata' @@ -316,8 +345,10 @@ jobs: displayName: 'Download Docker Image' inputs: TargetPath: '$(Build.ArtifactStagingDirectory)/docker' - artifactName: docker + artifactName: $(artifactName) + - bash: ./scripts/ci/install_docker.sh + displayName: Install Docker - bash: | set -exv @@ -619,14 +650,22 @@ jobs: - job: BuildRpmPackageMariner displayName: Build Rpm Package Mariner condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) - pool: - name: ${{ variables.ubuntu_pool }} strategy: matrix: - 2.0: + 2.0 AMD64: + image: mcr.microsoft.com/cbl-mariner/base/core:2.0 + artifact: rpm-mariner2.0-amd64 + pool: ${{ variables.ubuntu_pool }} + 2.0 ARM64: image: mcr.microsoft.com/cbl-mariner/base/core:2.0 - artifact: rpm-mariner2.0 + artifact: rpm-mariner2.0-arm64 + pool: ${{ variables.ubuntu_arm64_pool }} + pool: + name: $(pool) steps: + - bash: ./scripts/ci/install_docker.sh + displayName: Install Docker + - task: Bash@3 displayName: 'Build Rpm Package: Mariner' inputs: @@ -650,30 +689,37 @@ jobs: # Do not run this job for Pull Requests due to the slowness condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) pool: - name: ${{ variables.ubuntu_pool }} + name: $(pool) strategy: matrix: - Red Hat Universal Base Image 8: - dockerfile: ubi - image: registry.access.redhat.com/ubi8/ubi:8.4 - artifact: rpm-ubi8 - python_package: python39 - Red Hat Universal Base Image 9: - dockerfile: ubi - image: registry.access.redhat.com/ubi9/ubi:9.0.0 - artifact: rpm-ubi9 - python_package: python3.9 - Fedora35: - dockerfile: fedora - image: fedora:35 - artifact: rpm-fedora35 - python_package: python3 - Fedora36: - dockerfile: fedora - image: fedora:36 - artifact: rpm-fedora36 - python_package: python3 + ${{ each arch in parameters.architectures }}: + Red Hat Universal Base Image 8 ${{ arch.name }}: + dockerfile: ubi + image: registry.access.redhat.com/ubi8/ubi:8.4 + artifact: rpm-ubi8-${{ arch.value }} + python_package: python39 + pool: ${{ arch.pool }} + Red Hat Universal Base Image 9 ${{ arch.name }}: + dockerfile: ubi + image: registry.access.redhat.com/ubi9/ubi:9.0.0 + artifact: rpm-ubi9-${{ arch.value }} + python_package: python3.9 + pool: ${{ arch.pool }} + Fedora 35 ${{ arch.name }}: + dockerfile: fedora + image: fedora:35 + artifact: rpm-fedora35-${{ arch.value }} + python_package: python3 + pool: ${{ arch.pool }} + Fedora 36 ${{ arch.name }}: + dockerfile: fedora + image: fedora:36 + artifact: rpm-fedora36-${{ arch.value }} + python_package: python3 + pool: ${{ arch.pool }} steps: + - bash: ./scripts/ci/install_docker.sh + displayName: Install Docker - task: Bash@3 displayName: 'Build Rpm Package' inputs: @@ -693,40 +739,47 @@ jobs: - job: TestRpmPackage displayName: Test Rpm Package timeoutInMinutes: 120 - dependsOn: BuildRpmPackages + dependsOn: + - BuildRpmPackages + - ExtractMetadata condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) pool: - name: ${{ variables.ubuntu_pool }} + name: $(pool) strategy: matrix: - Red Hat Universal Base Image 8: - artifact: rpm-ubi8 - distro: el8 - image: registry.access.redhat.com/ubi8/ubi:8.4 - python_package: python39 - python_cmd: python3.9 - pip_cmd: pip3.9 - Red Hat Universal Base Image 9: - artifact: rpm-ubi9 - distro: el9 - image: registry.access.redhat.com/ubi9/ubi:9.0.0 - python_package: python3.9 - python_cmd: python3.9 - pip_cmd: pip3.9 - Fedora35: - artifact: rpm-fedora35 - distro: fc35 - image: fedora:35 - python_package: python3 - python_cmd: python3 - pip_cmd: pip3 - Fedora36: - artifact: rpm-fedora36 - distro: fc36 - image: fedora:36 - python_package: python3 - python_cmd: python3 - pip_cmd: pip3 + ${{ each arch in parameters.architectures }}: + Red Hat Universal Base Image 8 ${{ arch.name }}: + artifact: rpm-ubi8-${{ arch.value }} + distro: el8 + image: registry.access.redhat.com/ubi8/ubi:8.4 + python_package: python39 + python_cmd: python3.9 + pip_cmd: pip3.9 + pool: ${{ arch.pool }} + Red Hat Universal Base Image 9 ${{ arch.name }}: + artifact: rpm-ubi9-${{ arch.value }} + distro: el9 + image: registry.access.redhat.com/ubi9/ubi:9.0.0 + python_package: python3.9 + python_cmd: python3.9 + pip_cmd: pip3.9 + pool: ${{ arch.pool }} + Fedora 35 ${{ arch.name }}: + artifact: rpm-fedora35-${{ arch.value }} + distro: fc35 + image: fedora:35 + python_package: python3 + python_cmd: python3 + pip_cmd: pip3 + pool: ${{ arch.pool }} + Fedora 36 ${{ arch.name }}: + artifact: rpm-fedora36-${{ arch.value }} + distro: fc36 + image: fedora:36 + python_package: python3 + python_cmd: python3 + pip_cmd: pip3 + pool: ${{ arch.pool }} steps: - task: DownloadPipelineArtifact@1 displayName: 'Download Metadata' @@ -734,20 +787,20 @@ jobs: TargetPath: '$(Build.ArtifactStagingDirectory)/metadata' artifactName: metadata - - task: DownloadPipelineArtifact@1 displayName: 'Download Build Artifacts' inputs: TargetPath: '$(Build.ArtifactStagingDirectory)/rpm' artifactName: $(artifact) + - bash: ./scripts/ci/install_docker.sh + displayName: Install Docker - bash: | set -ex CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version` - RPM_NAME=azure-cli-$CLI_VERSION-1.${DISTRO}.x86_64.rpm - RPM_FILE=$SYSTEM_ARTIFACTSDIRECTORY/rpm/$RPM_NAME + RPM_NAME=$(find $SYSTEM_ARTIFACTSDIRECTORY/rpm/ -type f -name "azure-cli-$CLI_VERSION-1.${DISTRO}.*.rpm" -printf '%f\n') echo "== Test rpm package on ${IMAGE} ==" docker pull $IMAGE @@ -759,40 +812,52 @@ jobs: displayName: Build Deb Packages condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) pool: - name: ${{ variables.ubuntu_pool }} + name: $(pool) strategy: matrix: - # https://wiki.ubuntu.com/Releases - Bionic: - # 18.04 - deb_system: ubuntu - distro: bionic - Focal: - # 20.04 - deb_system: ubuntu - distro: focal - Jammy: - # 22.04 - deb_system: ubuntu - distro: jammy - - # https://wiki.debian.org/DebianReleases - Buster: - # 10 - deb_system: debian - distro: buster - Bullseye: - # 11 - deb_system: debian - distro: bullseye + ${{ each arch in parameters.architectures }}: + # https://wiki.ubuntu.com/Releases + Bionic ${{ arch.name }}: + # 18.04 + deb_system: ubuntu + distro: bionic + arch: ${{ arch.value }} + pool: ${{ arch.pool }} + Focal ${{ arch.name }}: + # 20.04 + deb_system: ubuntu + distro: focal + arch: ${{ arch.value }} + pool: ${{ arch.pool }} + Jammy ${{ arch.name }}: + # 22.04 + deb_system: ubuntu + distro: jammy + arch: ${{ arch.value }} + pool: ${{ arch.pool }} + + # https://wiki.debian.org/DebianReleases + Buster ${{ arch.name }}: + # 10 + deb_system: debian + distro: buster + arch: ${{ arch.value }} + pool: ${{ arch.pool }} + Bullseye ${{ arch.name }}: + # 11 + deb_system: debian + distro: bullseye + arch: ${{ arch.value }} + pool: ${{ arch.pool }} steps: + - bash: ./scripts/ci/install_docker.sh + displayName: Install Docker - task: Bash@3 - displayName: 'Build $(deb_system) $(distro) Package' + displayName: 'Build $(deb_system) $(distro) $(arch) Package' inputs: targetType: 'filePath' filePath: scripts/release/debian/pipeline.sh env: - DISTRO: $(distro) DISTRO_BASE_IMAGE: $(deb_system):$(distro) - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 @@ -801,10 +866,10 @@ jobs: BuildDropPath: $(Build.ArtifactStagingDirectory) - task: PublishPipelineArtifact@0 - displayName: 'Publish Artifact: debian' + displayName: 'Publish Artifact: $(deb_system) $(distro) $(arch)' inputs: TargetPath: $(Build.ArtifactStagingDirectory) - ArtifactName: $(deb_system)-$(distro) + ArtifactName: $(deb_system)-$(distro)-$(arch) - job: TestDebPackages timeoutInMinutes: 120 @@ -814,21 +879,32 @@ jobs: condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) strategy: matrix: - Focal: - deb_system: ubuntu - distro: focal - Jammy: - deb_system: ubuntu - distro: jammy - Buster: - deb_system: debian - distro: buster - Bullseye: - deb_system: debian - distro: bullseye + ${{ each arch in parameters.architectures }}: + Focal ${{ arch.name }}: + deb_system: ubuntu + distro: focal + arch: ${{ arch.value }} + pool: ${{ arch.pool }} + Jammy ${{ arch.name }}: + deb_system: ubuntu + distro: jammy + arch: ${{ arch.value }} + pool: ${{ arch.pool }} + Buster ${{ arch.name }}: + deb_system: debian + distro: buster + arch: ${{ arch.value }} + pool: ${{ arch.pool }} + Bullseye ${{ arch.name }}: + deb_system: debian + distro: bullseye + arch: ${{ arch.value }} + pool: ${{ arch.pool }} pool: - name: ${{ variables.ubuntu_pool }} + name: $(pool) steps: + - bash: ./scripts/ci/install_docker.sh + displayName: Install Docker - task: DownloadPipelineArtifact@1 displayName: 'Download Metadata' inputs: @@ -836,21 +912,21 @@ jobs: artifactName: metadata - task: DownloadPipelineArtifact@1 - displayName: 'Download $(deb_system):$(distro) Build' + displayName: 'Download $(deb_system):$(distro) $(arch) Build' inputs: TargetPath: '$(Build.ArtifactStagingDirectory)/debian' - artifactName: $(deb_system)-$(distro) + artifactName: $(deb_system)-$(distro)-$(arch) - task: Bash@3 - displayName: 'Test $(deb_system) $(distro) Package' + displayName: 'Test $(deb_system) $(distro) $(arch) Package' env: - DISTRO: $(distro) DISTRO_BASE_IMAGE: $(deb_system):$(distro) inputs: targetType: 'inline' script: | set -exv CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version` + echo "== Test debian package on ${DISTRO} ==" docker pull ${DISTRO_BASE_IMAGE} docker run --rm -e DISTRO=${DISTRO} -e CLI_VERSION=$CLI_VERSION -v $SYSTEM_ARTIFACTSDIRECTORY/debian:/mnt/artifacts -v $(pwd):/azure-cli ${DISTRO_BASE_IMAGE} /bin/bash "/azure-cli/scripts/release/debian/test_deb_in_docker.sh" diff --git a/scripts/ci/install_docker.sh b/scripts/ci/install_docker.sh new file mode 100755 index 00000000000..06afc6b2b10 --- /dev/null +++ b/scripts/ci/install_docker.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# ARM64 image does not have docker, install manually + +if [[ $(dpkg --print-architecture) == "amd64" ]]; then + echo "Docker is already installed on AMD64" + exit 0 +fi +# https://docs.docker.com/engine/security/rootless/ +/bin/bash -c "$(curl -fsSL https://get.docker.com)" +sudo apt-get install -y uidmap +dockerd-rootless-setuptool.sh install +export XDG_RUNTIME_DIR=/home/cloudtest/.docker/run +PATH=/usr/bin:/sbin:/usr/sbin:$PATH dockerd-rootless.sh & +sleep 5 +docker context use rootless diff --git a/scripts/release/debian/build.sh b/scripts/release/debian/build.sh index 668bc65d6e6..c6d3b15e266 100755 --- a/scripts/release/debian/build.sh +++ b/scripts/release/debian/build.sh @@ -21,8 +21,17 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Update APT packages apt-get update # uuid-dev is used to build _uuid module: https://github.com/python/cpython/pull/3796 -apt-get install -y libssl-dev libffi-dev python3-dev debhelper zlib1g-dev uuid-dev -apt-get install -y wget +apt-get install -y libssl-dev libffi-dev python3-dev zlib1g-dev uuid-dev wget + +# In Ubuntu 18.04, debhelper 11.1.6 has bug which makes it fail to dpkg-buildpackage. Use backport version instead. +# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897569 +if cat /etc/lsb-release | grep 18.04 +then + apt-get install -y debhelper -t bionic-backports +else + apt-get install -y debhelper +fi + # Git is not strictly necessary, but it would allow building an experimental package # with dependency which is currently only available in its git repo feature branch. apt-get install -y git @@ -51,5 +60,5 @@ $SCRIPT_DIR/prepare.sh $WORKDIR/debian $WORKDIR/az.completion $WORKDIR cd $WORKDIR dpkg-buildpackage -us -uc -deb_file=$WORKDIR/../azure-cli_${CLI_VERSION}-${CLI_VERSION_REVISION:=1}_all.deb +deb_file=$WORKDIR/../azure-cli_${CLI_VERSION}-${CLI_VERSION_REVISION:=1}_*.deb cp $deb_file /mnt/output/ diff --git a/scripts/release/debian/deb_install.sh b/scripts/release/debian/deb_install.sh index 873e5bfa97b..49660bcc422 100755 --- a/scripts/release/debian/deb_install.sh +++ b/scripts/release/debian/deb_install.sh @@ -81,7 +81,7 @@ setup() { exit 1 fi fi - echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ${CLI_REPO} main" \ + echo "deb [arch=$(dpkg --print-architecture)] https://packages.microsoft.com/repos/azure-cli/ ${CLI_REPO} main" \ > /etc/apt/sources.list.d/azure-cli.list apt-get update set +v diff --git a/scripts/release/debian/prepare.sh b/scripts/release/debian/prepare.sh index 173aa02ba22..9a3c314cf49 100755 --- a/scripts/release/debian/prepare.sh +++ b/scripts/release/debian/prepare.sh @@ -57,7 +57,7 @@ Standards-Version: 3.9.5 Homepage: https://github.com/azure/azure-cli Package: azure-cli -Architecture: all +Architecture: any Depends: \${shlibs:Depends}, \${misc:Depends} Description: Azure CLI A great cloud needs great tools; we're excited to introduce Azure CLI, @@ -110,7 +110,7 @@ ${TAB}echo "\043!/usr/bin/env bash\nbin_dir=\140cd \"\044(dirname \"\044BASH_SOU ${TAB}chmod 0755 debian/azure-cli/usr/bin/az ${TAB}mkdir -p debian/azure-cli/etc/bash_completion.d/ ${TAB}cat ${completion_script} > debian/azure-cli/etc/bash_completion.d/azure-cli -${TAB}dpkg-shlibdeps -v --warnings=7 -Tdebian/azure-cli.substvars -dDepends -edebian/azure-cli/opt/az/bin/python3 debian/azure-cli/opt/az/lib/python3.10/lib-dynload/_ssl.cpython-310-x86_64-linux-gnu.so +${TAB}dpkg-shlibdeps -v --warnings=7 -Tdebian/azure-cli.substvars -dDepends -edebian/azure-cli/opt/az/bin/python3 debian/azure-cli/opt/az/lib/python3.10/lib-dynload/_ssl.cpython-310-*-linux-gnu.so override_dh_strip: diff --git a/scripts/release/debian/test_deb_in_docker.sh b/scripts/release/debian/test_deb_in_docker.sh index 65702e48a26..003bdafd7ce 100644 --- a/scripts/release/debian/test_deb_in_docker.sh +++ b/scripts/release/debian/test_deb_in_docker.sh @@ -8,7 +8,7 @@ export USERNAME=azureuser apt update apt install -y apt-transport-https git gcc python3-dev -dpkg -i /mnt/artifacts/azure-cli_$CLI_VERSION-1~${DISTRO}_all.deb +dpkg -i /mnt/artifacts/azure-cli_$CLI_VERSION-1~${DISTRO}_*.deb time az self-test time az --version diff --git a/scripts/release/rpm/azure-cli.spec b/scripts/release/rpm/azure-cli.spec index 040618f1cf2..b8b87417071 100644 --- a/scripts/release/rpm/azure-cli.spec +++ b/scripts/release/rpm/azure-cli.spec @@ -5,11 +5,6 @@ # Turn off python byte compilation %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') -# .el7.centos -> .el7 -%if 0%{?rhel} - %define dist .el%{?rhel} -%endif - # The Python package name for dnf/yum/tdnf, such as python39, python3 %define python_package %{getenv:PYTHON_PACKAGE} # The Python executable name, such as python3.9, python3 @@ -27,7 +22,6 @@ Name: %{name} Version: %{version} Release: %{release} Url: https://docs.microsoft.com/cli/azure/install-azure-cli -BuildArch: x86_64 Requires: %{python_package} Prefix: /usr Prefix: /etc diff --git a/scripts/release/rpm/fedora.dockerfile b/scripts/release/rpm/fedora.dockerfile index ea8b6c45cae..66f0295af42 100644 --- a/scripts/release/rpm/fedora.dockerfile +++ b/scripts/release/rpm/fedora.dockerfile @@ -14,10 +14,11 @@ COPY . . RUN dos2unix ./scripts/release/rpm/azure-cli.spec && \ REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=$python_package PYTHON_CMD=python3 \ rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && \ - cp /root/rpmbuild/RPMS/x86_64/azure-cli-${cli_version}-1.*.x86_64.rpm /azure-cli-dev.rpm + cp /root/rpmbuild/RPMS/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && \ + mkdir /out && cp /root/rpmbuild/RPMS/*/azure-cli-${cli_version}-1.*.rpm /out/ FROM ${image} AS execution-env COPY --from=build-env /azure-cli-dev.rpm ./ -RUN rpm -i ./azure-cli-dev.rpm && \ +RUN dnf install -y ./azure-cli-dev.rpm && \ az --version diff --git a/scripts/release/rpm/mariner.dockerfile b/scripts/release/rpm/mariner.dockerfile index 3855e3a05d5..eb29b07711e 100644 --- a/scripts/release/rpm/mariner.dockerfile +++ b/scripts/release/rpm/mariner.dockerfile @@ -4,7 +4,8 @@ FROM ${image} AS build-env ARG cli_version=dev RUN tdnf update -y -RUN tdnf install -y binutils file rpm-build gcc libffi-devel python3-devel openssl-devel make diffutils patch dos2unix perl sed +# kernel-headers, glibc-devel, binutils are needed to install psutil python package on ARM64 +RUN tdnf install -y binutils file rpm-build gcc libffi-devel python3-devel openssl-devel make diffutils patch dos2unix perl sed kernel-headers glibc-devel binutils WORKDIR /azure-cli @@ -15,13 +16,13 @@ COPY . . RUN dos2unix ./scripts/release/rpm/azure-cli.spec && \ REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=python3 PYTHON_CMD=python3 \ rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && \ - cp /usr/src/mariner/RPMS/x86_64/azure-cli-${cli_version}-1.cm2.x86_64.rpm /azure-cli-dev.rpm + cp /usr/src/mariner/RPMS/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && \ + mkdir /out && cp /usr/src/mariner/RPMS/*/azure-cli-${cli_version}-1.*.rpm /out/ FROM ${image} AS execution-env RUN tdnf update -y -RUN tdnf install -y python3 rpm COPY --from=build-env /azure-cli-dev.rpm ./ -RUN rpm -i ./azure-cli-dev.rpm && \ +RUN tdnf install -y ./azure-cli-dev.rpm && \ az --version diff --git a/scripts/release/rpm/pipeline.sh b/scripts/release/rpm/pipeline.sh index 3f9874fbce2..52c99a6193c 100755 --- a/scripts/release/rpm/pipeline.sh +++ b/scripts/release/rpm/pipeline.sh @@ -39,7 +39,7 @@ docker build \ id=$(docker create azure/azure-cli:${DOCKERFILE}-builder) # https://docs.docker.com/engine/reference/commandline/cp/ # Append /. so that the x86_64 folder's content is copied, instead of x86_64 folder itself. -docker cp $id:/root/rpmbuild/RPMS/x86_64/. ${BUILD_STAGINGDIRECTORY} +docker cp $id:/out/. ${BUILD_STAGINGDIRECTORY} # Save these too a staging directory so that later build phases can choose to save them as Artifacts or publish them to # a registry. diff --git a/scripts/release/rpm/pipeline_mariner.sh b/scripts/release/rpm/pipeline_mariner.sh index be6f59c5369..c7274a3f5cb 100644 --- a/scripts/release/rpm/pipeline_mariner.sh +++ b/scripts/release/rpm/pipeline_mariner.sh @@ -33,7 +33,7 @@ docker build \ id=$(docker create azure/azure-cli:mariner-builder bash) # https://docs.docker.com/engine/reference/commandline/cp/ # Append /. so that the x86_64 folder's content is copied, instead of x86_64 folder itself. -docker cp $id:/usr/src/mariner/RPMS/x86_64/. ${BUILD_STAGINGDIRECTORY} +docker cp $id:/out/. ${BUILD_STAGINGDIRECTORY} # Save these too a staging directory so that later build phases can choose to save them as Artifacts or publish them to # a registry. diff --git a/scripts/release/rpm/ubi.dockerfile b/scripts/release/rpm/ubi.dockerfile index b1ecef72fad..558d0e85e2e 100644 --- a/scripts/release/rpm/ubi.dockerfile +++ b/scripts/release/rpm/ubi.dockerfile @@ -19,13 +19,13 @@ COPY . . RUN dos2unix ./scripts/release/rpm/azure-cli.spec && \ REPO_PATH=$(pwd) CLI_VERSION=$cli_version PYTHON_PACKAGE=$python_package PYTHON_CMD=python3.9 \ rpmbuild -v -bb --clean scripts/release/rpm/azure-cli.spec && \ - cp /root/rpmbuild/RPMS/x86_64/azure-cli-${cli_version}-1.*.x86_64.rpm /azure-cli-dev.rpm + cp /root/rpmbuild/RPMS/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && \ + mkdir /out && cp /root/rpmbuild/RPMS/*/azure-cli-${cli_version}-1.*.rpm /out/ FROM ${image} AS execution-env RUN yum update -y -RUN yum install -y python39 COPY --from=build-env /azure-cli-dev.rpm ./ -RUN rpm -i ./azure-cli-dev.rpm && \ +RUN yum install -y ./azure-cli-dev.rpm && \ az --version