diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 62f7cd0ef6b..365de8b91da 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -640,34 +640,7 @@ jobs: ArtifactName: rpm-mariner$(tag) -- job: BuildRpmPackageCentOS7 - displayName: Build Rpm Package CentOS 7 - # Uncomment this line to disable this job on Pull Requests - # condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) - pool: - vmImage: 'ubuntu-20.04' - steps: - - task: Bash@3 - displayName: 'Build Rpm Package' - inputs: - targetType: 'filePath' - filePath: scripts/release/rpm/pipeline.sh - env: - IMAGE: centos7 - - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 - displayName: 'SBOM' - inputs: - BuildDropPath: $(Build.ArtifactStagingDirectory) - - task: PublishPipelineArtifact@0 - displayName: 'Publish Artifact: rpm' - inputs: - TargetPath: $(Build.ArtifactStagingDirectory) - # Should be 'rpm-centos7', but we keep 'yum' for backward compatibility - ArtifactName: yum - # TODO: rpmbuild on Red Hat UBI 8 is slow for unknown reason. Still working with Red Hat to investigate. -# We use a separate job for Red Hat UBI 8 instead of strategy.matrix so that TestRpmPackage can start right after -# BuildRpmPackageCentOS7 finishes. - job: BuildRpmPackageUbi8 displayName: Build Rpm Package Red Hat Universal Base Image 8 # Do not run this job for Pull Requests due to the slowness @@ -696,7 +669,7 @@ jobs: - job: TestRpmPackage displayName: Test Rpm Package timeoutInMinutes: 120 - dependsOn: BuildRpmPackageCentOS7 + dependsOn: BuildRpmPackageUbi8 condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) pool: vmImage: 'ubuntu-20.04' @@ -712,19 +685,19 @@ jobs: displayName: 'Download Build Artifacts' inputs: TargetPath: '$(Build.ArtifactStagingDirectory)/rpm' - artifactName: yum + artifactName: rpm-ubi8 - bash: | set -ex CLI_VERSION=`cat $SYSTEM_ARTIFACTSDIRECTORY/metadata/version` - RPM_NAME=azure-cli-$CLI_VERSION-1.el7.x86_64.rpm + RPM_NAME=azure-cli-$CLI_VERSION-1.el8.x86_64.rpm RPM_FILE=$SYSTEM_ARTIFACTSDIRECTORY/rpm/$RPM_NAME - echo "== Test rpm package on CentOS ==" + echo "== Test rpm package on Red Hat UBI 8 ==" - IMAGE=centos:centos7 + IMAGE=registry.access.redhat.com/ubi8/ubi:8.4 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_rpm_in_docker.sh" diff --git a/scripts/release/rpm/test_rpm_in_docker.sh b/scripts/release/rpm/test_rpm_in_docker.sh index 79784d2335d..cf806a49c3d 100644 --- a/scripts/release/rpm/test_rpm_in_docker.sh +++ b/scripts/release/rpm/test_rpm_in_docker.sh @@ -5,22 +5,26 @@ set -exv export USERNAME=azureuser -yum --nogpgcheck localinstall /mnt/rpm/$RPM_NAME -y +PYTHON_PACKAGE=python39 +PYTHON_CMD=python3.9 +PIP_CMD=pip3.9 -yum install git gcc python3-devel -y +dnf --nogpgcheck install /mnt/rpm/$RPM_NAME -y -ln -s -f /usr/bin/python3 /usr/bin/python -ln -s -f /usr/bin/pip3 /usr/bin/pip +dnf install git gcc $PYTHON_PACKAGE-devel -y + +ln -s -f /usr/bin/$PYTHON_CMD /usr/bin/python +ln -s -f /usr/bin/$PIP_CMD /usr/bin/pip time az self-test time az --version cd /azure-cli/ -pip3 install wheel +pip install wheel ./scripts/ci/build.sh -pip3 install pytest --prefix /usr/lib64/az -pip3 install pytest-xdist --prefix /usr/lib64/az +pip install pytest --prefix /usr/lib64/az +pip install pytest-xdist --prefix /usr/lib64/az -find /azure-cli/artifacts/build -name "azure_cli_testsdk*" | xargs pip3 install --prefix /usr/lib64/az --upgrade --ignore-installed -find /azure-cli/artifacts/build -name "azure_cli_fulltest*" | xargs pip3 install --prefix /usr/lib64/az --upgrade --ignore-installed --no-deps +find /azure-cli/artifacts/build -name "azure_cli_testsdk*" | xargs pip install --prefix /usr/lib64/az --upgrade --ignore-installed +find /azure-cli/artifacts/build -name "azure_cli_fulltest*" | xargs pip install --prefix /usr/lib64/az --upgrade --ignore-installed --no-deps -python3 /azure-cli/scripts/release/rpm/test_rpm_package.py +python /azure-cli/scripts/release/rpm/test_rpm_package.py diff --git a/scripts/release/rpm/test_rpm_package.py b/scripts/release/rpm/test_rpm_package.py index 61a823b7887..95845cae4d1 100644 --- a/scripts/release/rpm/test_rpm_package.py +++ b/scripts/release/rpm/test_rpm_package.py @@ -7,10 +7,10 @@ import sys import subprocess -root_dir = '/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules' +root_dir = '/usr/lib64/az/lib/python3.9/site-packages/azure/cli/command_modules' mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__'] -pytest_base_cmd = 'PYTHONPATH=/usr/lib64/az/lib/python3.6/site-packages python3 -m pytest -x -v --boxed -p no:warnings --log-level=WARN' +pytest_base_cmd = 'PYTHONPATH=/usr/lib64/az/lib/python3.9/site-packages python3 -m pytest -x -v --boxed -p no:warnings --log-level=WARN' pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd) serial_test_modules = ['botservice', 'network', 'cloud', 'appservice']