diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0b26aa5cc11..922b0ac1f1d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -403,7 +403,7 @@ jobs: - job: BuildDockerImageAzureLinux displayName: Build Docker Image Azure Linux - dependsOn: BuildRpmPackageMariner + dependsOn: BuildRpmPackagesAzureLinux strategy: matrix: ${{ each arch in parameters.architectures }}: @@ -766,19 +766,20 @@ jobs: displayName: 'Test Homebrew Package' -- job: BuildRpmPackageMariner - displayName: Build Rpm Package Mariner +- job: BuildRpmPackagesAzureLinux + displayName: Build Rpm Package condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) strategy: matrix: - 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-arm64 - pool: ${{ variables.ubuntu_arm64_pool }} + ${{ each arch in parameters.architectures }}: + Mariner 2.0 ${{ arch.name }}: + image: mcr.microsoft.com/cbl-mariner/base/core:2.0 + artifact: rpm-mariner2.0-${{ arch.value }} + pool: ${{ arch.pool }} + Azure Linux 3.0 ${{ arch.name }}: + image: azurelinuxpreview.azurecr.io/public/azurelinux/base/core:3.0 + artifact: rpm-azurelinux3.0-${{ arch.value }} + pool: ${{ arch.pool }} pool: name: $(pool) steps: @@ -786,10 +787,10 @@ jobs: displayName: Install Docker - task: Bash@3 - displayName: 'Build Rpm Package: Mariner' + displayName: 'Build Rpm Package: Azure Linux' inputs: targetType: 'filePath' - filePath: scripts/release/rpm/pipeline_mariner.sh + filePath: scripts/release/rpm/pipeline_azurelinux.sh - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 displayName: 'SBOM' @@ -802,25 +803,26 @@ jobs: TargetPath: $(Build.ArtifactStagingDirectory) ArtifactName: $(artifact) -- job: TestRpmPackageMariner - displayName: Test Rpm Package Mariner +- job: TestRpmPackagesAzureLinux + displayName: Test Rpm Package timeoutInMinutes: 120 dependsOn: - - BuildRpmPackageMariner + - BuildRpmPackagesAzureLinux - ExtractMetadata condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) pool: name: $(pool) strategy: matrix: - 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-arm64 - pool: ${{ variables.ubuntu_arm64_pool }} + ${{ each arch in parameters.architectures }}: + Mariner 2.0 ${{ arch.name }}: + image: mcr.microsoft.com/cbl-mariner/base/core:2.0 + artifact: rpm-mariner2.0-${{ arch.value }} + pool: ${{ arch.pool }} + Azure Linux 3.0 ${{ arch.name }}: + image: azurelinuxpreview.azurecr.io/public/azurelinux/base/core:3.0 + artifact: rpm-azurelinux3.0-${{ arch.value }} + pool: ${{ arch.pool }} steps: - task: DownloadPipelineArtifact@1 displayName: 'Download Metadata' @@ -841,11 +843,11 @@ jobs: set -ex CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version` - RPM_NAME=$(find $SYSTEM_ARTIFACTSDIRECTORY/rpm/ -type f -name "azure-cli-$CLI_VERSION-1.cm2.*.rpm" -printf '%f\n') + RPM_NAME=$(find $SYSTEM_ARTIFACTSDIRECTORY/rpm/ -type f -name "azure-cli-$CLI_VERSION-1.*.rpm" -printf '%f\n') echo "== Test rpm package on ${IMAGE} ==" docker pull $IMAGE - docker run --rm -e RPM_NAME=$RPM_NAME -v $SYSTEM_ARTIFACTSDIRECTORY/rpm:/mnt/rpm -v $(pwd):/azure-cli $IMAGE /bin/bash "/azure-cli/scripts/release/rpm/test_mariner_in_docker.sh" + docker run --rm -e RPM_NAME=$RPM_NAME -v $SYSTEM_ARTIFACTSDIRECTORY/rpm:/mnt/rpm -v $(pwd):/azure-cli $IMAGE /bin/bash "/azure-cli/scripts/release/rpm/test_azurelinux_in_docker.sh" displayName: 'Test Rpm Package Mariner' @@ -1253,7 +1255,7 @@ jobs: - BuildHomebrewFormula - TestHomebrewFormula - TestHomebrewPackage - - BuildRpmPackageMariner + - BuildRpmPackagesAzureLinux - BuildRpmPackages - TestRpmPackage - BuildDebPackages diff --git a/scripts/ci/build.sh b/scripts/ci/build.sh index 671b5d62ec7..706992fe4a5 100755 --- a/scripts/ci/build.sh +++ b/scripts/ci/build.sh @@ -102,6 +102,7 @@ CLASSIFIERS = [ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'License :: OSI Approved :: MIT License', ] diff --git a/scripts/release/rpm/mariner.dockerfile b/scripts/release/rpm/azurelinux.dockerfile similarity index 67% rename from scripts/release/rpm/mariner.dockerfile rename to scripts/release/rpm/azurelinux.dockerfile index 3de26923a20..4ee528ea955 100644 --- a/scripts/release/rpm/mariner.dockerfile +++ b/scripts/release/rpm/azurelinux.dockerfile @@ -16,13 +16,17 @@ WORKDIR /azure-cli COPY . . -# Mariner 2.0 only has 'python3' package, which is currently (2022-12-09) Python 3.9. -# It has no version-specific packages like 'python39'. +# Mariner 2.0's python3 is 3.9, the rpm paths are +# /usr/src/mariner/RPMS/x86_64/azure-cli-2.63.0-1.cm2.x86_64.rpm +# /usr/src/mariner/RPMS/aarch64/azure-cli-2.63.0-1.cm2.aarch64.rpm +# Azure Linux 3's python3 is 3.12, the rpm paths are +# /usr/src/azl/RPMS/x86_64/azure-cli-2.63.0-1.azl3.x86_64.rpm +# /usr/src/azl/RPMS/aarch64/azure-cli-2.63.0-1.azl3.aarch64.rpm 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/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && \ - mkdir /out && cp /usr/src/mariner/RPMS/*/azure-cli-${cli_version}-1.*.rpm /out/ + cp /usr/src/*/RPMS/*/azure-cli-${cli_version}-1.*.rpm /azure-cli-dev.rpm && \ + mkdir /out && cp /usr/src/*/RPMS/*/azure-cli-${cli_version}-1.*.rpm /out/ FROM ${image} AS execution-env diff --git a/scripts/release/rpm/build.sh b/scripts/release/rpm/build.sh deleted file mode 100755 index d59e9664b9c..00000000000 --- a/scripts/release/rpm/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -: "${CLI_VERSION:?CLI_VERSION environment variable not set.}" - -yum check-update -yum install -y gcc rpm-build rpm-level rpmlint make bash corutils diffutils \ - path rpmdevtools python libffi-devel python3-devel openssl-devel \ - wget - -set -ev - -export REPO_PATH=`cd $(dirname $0); cd ../../../; pwd` -rpmbuild -v -bb --clean $REPO_PATH/scripts/release/rpm/azure-cli.spec && cp /root/rpmbuild/RPMS/x86_64/* /mnt/output diff --git a/scripts/release/rpm/pipeline_mariner.sh b/scripts/release/rpm/pipeline_azurelinux.sh similarity index 68% rename from scripts/release/rpm/pipeline_mariner.sh rename to scripts/release/rpm/pipeline_azurelinux.sh index c7274a3f5cb..8a89780d0e8 100644 --- a/scripts/release/rpm/pipeline_mariner.sh +++ b/scripts/release/rpm/pipeline_azurelinux.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash -# Build assets related to Linux Distributions that use RPM/yum for installation specific for CBL-Mariner. +# Build assets related to Linux Distributions that use RPM/yum for installation specific for Azure Linux set -exv : "${BUILD_STAGINGDIRECTORY:?BUILD_STAGINGDIRECTORY environment variable not set.}" -# IMAGE should be Mariner docker image url, such as mcr.microsoft.com/cbl-mariner/base/core:2.0 +# IMAGE should be Azure Linux docker image url, such as mcr.microsoft.com/cbl-mariner/base/core:2.0 : "${IMAGE:?IMAGE environment variable not set.}" CLI_VERSION=`cat src/azure-cli/azure/cli/__main__.py | grep __version__ | sed s/' '//g | sed s/'__version__='// | sed s/\"//g` @@ -16,21 +16,21 @@ docker build \ --target build-env \ --build-arg cli_version=${CLI_VERSION} \ --build-arg image=${IMAGE} \ - -f ./scripts/release/rpm/mariner.dockerfile \ - -t azure/azure-cli:mariner-builder \ + -f ./scripts/release/rpm/azurelinux.dockerfile \ + -t azure/azure-cli:azurelinux-builder \ . # Continue the previous build, and create a container that has the current azure-cli build but not the source code. docker build \ --build-arg cli_version=${CLI_VERSION} \ --build-arg image=${IMAGE} \ - -f ./scripts/release/rpm/mariner.dockerfile \ - -t azure/azure-cli:mariner \ + -f ./scripts/release/rpm/azurelinux.dockerfile \ + -t azure/azure-cli:azurelinux \ . # Extract the built RPM so that it can be distributed independently. # The RPM file looks like azure-cli-2.32.0-1.x86_64.rpm -id=$(docker create azure/azure-cli:mariner-builder bash) +id=$(docker create azure/azure-cli:azurelinux-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:/out/. ${BUILD_STAGINGDIRECTORY} @@ -40,6 +40,6 @@ docker cp $id:/out/. ${BUILD_STAGINGDIRECTORY} # # The products of `docker save` can be rehydrated using `docker load`. # mkdir -p ${BUILD_STAGINGDIRECTORY}/docker -# docker save azure/azure-cli:mariner-builder | gzip > ${BUILD_STAGINGDIRECTORY}/docker/azure_azure-cli_mariner-builder.tar.gz & -# docker save azure/azure-cli:mariner | gzip > ${BUILD_STAGINGDIRECTORY}/docker/azure_azure-cli_mariner.tar.gz & +# docker save azure/azure-cli:azurelinux-builder | gzip > ${BUILD_STAGINGDIRECTORY}/docker/azure_azure-cli_azurelinux-builder.tar.gz & +# docker save azure/azure-cli:azurelinux | gzip > ${BUILD_STAGINGDIRECTORY}/docker/azure_azure-cli_azurelinux.tar.gz & # wait diff --git a/scripts/release/rpm/test_mariner_in_docker.sh b/scripts/release/rpm/test_azurelinux_in_docker.sh similarity index 91% rename from scripts/release/rpm/test_mariner_in_docker.sh rename to scripts/release/rpm/test_azurelinux_in_docker.sh index f979f3052ba..6161d65a87e 100644 --- a/scripts/release/rpm/test_mariner_in_docker.sh +++ b/scripts/release/rpm/test_azurelinux_in_docker.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# This script should be run in a Mariner 2.0 docker container. +# This script should be run in a Azure Linux docker container. set -exv export USERNAME=azureuser @@ -14,7 +14,7 @@ time az self-test time az --version cd /azure-cli/ -pip install wheel +python -m pip install --upgrade pip setuptools ./scripts/ci/build.sh # From Fedora36, when using `pip install --prefix` with root privileges, the package is installed into `{prefix}/local/lib`. diff --git a/scripts/release/rpm/test_rpm_in_docker.sh b/scripts/release/rpm/test_rpm_in_docker.sh index 5f1d21d8423..be4cc9a4e66 100644 --- a/scripts/release/rpm/test_rpm_in_docker.sh +++ b/scripts/release/rpm/test_rpm_in_docker.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# This script should be run in a centos7 docker. +# This script should be run in a ubi8, ubi9 docker. set -exv export USERNAME=azureuser @@ -15,7 +15,7 @@ time az self-test time az --version cd /azure-cli/ -pip install wheel +python -m pip install --upgrade pip setuptools ./scripts/ci/build.sh # From Fedora36, when using `pip install --prefix` with root privileges, the package is installed into `{prefix}/local/lib`.