From e34b94108300354d3fdf04df9fae5e46afb747d8 Mon Sep 17 00:00:00 2001 From: Micah Lewis <1009123+micahl@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:14:36 -0700 Subject: [PATCH] Add RHEL 9 (#6850) This change adds support for RHEL 9 by building packages in the CI build pipeline, running the end-to-end tests on an RHEL 9 agent, and building, signing, and publishing packages to packages.microsoft.com and our GitHub release pages. I confirmed that the CI build produces RHEL 9 packages, that those packages can be installed on an RHEL 9 agent, and that all the end-to-end tests pass. ## Azure IoT Edge PR checklist: --- builds/e2e/e2e.yaml | 23 +++++++++++++- builds/misc/packages-release.yaml | 26 ++++++++++++---- builds/misc/templates/build-packages.yaml | 4 +++ edgelet/build/linux/package.sh | 30 ++++++++++++++++++- edgelet/doc/devguide.md | 2 +- scripts/linux/publishReleasePackages.sh | 3 ++ .../linux/EdgeDaemon.cs | 2 +- 7 files changed, 80 insertions(+), 10 deletions(-) diff --git a/builds/e2e/e2e.yaml b/builds/e2e/e2e.yaml index 2b81372c219..af0d7b2fa8c 100644 --- a/builds/e2e/e2e.yaml +++ b/builds/e2e/e2e.yaml @@ -282,6 +282,27 @@ jobs: - template: templates/e2e-setup.yaml - template: templates/e2e-run.yaml + ################################################################################ + - job: redhat9_amd64 + ################################################################################ + displayName: RedHat9 amd64 + + pool: + name: $(pool.linux.name) + demands: + - ImageOverride -equals agent-aziotedge-rhel-9-msmoby + + variables: + os: linux + arch: amd64 + artifactName: iotedged-redhat9-amd64 + identityServiceArtifactName: packages_redhat-ubi9-latest_amd64 + identityServicePackageFilter: aziot-identity-service-*.x86_64.rpm + + steps: + - template: templates/e2e-setup.yaml + - template: templates/e2e-run.yaml + ################################################################################ - job: linux_amd64_proxy ################################################################################ @@ -357,4 +378,4 @@ jobs: steps: - template: templates/e2e-setup.yaml - - template: templates/e2e-run.yaml \ No newline at end of file + - template: templates/e2e-run.yaml diff --git a/builds/misc/packages-release.yaml b/builds/misc/packages-release.yaml index 8cfa8e74eec..94d15edfa5c 100644 --- a/builds/misc/packages-release.yaml +++ b/builds/misc/packages-release.yaml @@ -39,6 +39,10 @@ stages: arch: amd64 os: redhat8 target.iotedged: edgelet/target/rpmbuild/RPMS/x86_64 + RedHat9-amd64: + arch: amd64 + os: redhat9 + target.iotedged: edgelet/target/rpmbuild/RPMS/x86_64 Debian10-amd64: os: debian10 @@ -65,7 +69,7 @@ stages: os: debian11 arch: aarch64 target.iotedged: edgelet/target/aarch64-unknown-linux-gnu/release - + Ubuntu1804-amd64: os: ubuntu18.04 arch: amd64 @@ -193,6 +197,11 @@ stages: artifactName: iotedged-redhat8-amd64 identityServiceArtifactName: packages_redhat-ubi8-latest_amd64 identityServicePackageFilter: aziot-identity-service-*.x86_64.rpm + RedHat9-amd64: + os: redhat9 + artifactName: iotedged-redhat9-amd64 + identityServiceArtifactName: packages_redhat-ubi9-latest_amd64 + identityServicePackageFilter: aziot-identity-service-*.x86_64.rpm Ubuntu1804-amd64: os: ubuntu18.04 @@ -204,7 +213,7 @@ stages: artifactName: iotedged-ubuntu18.04-aarch64 identityServiceArtifactName: packages_ubuntu-18.04_aarch64 identityServicePackageFilter: aziot-identity-service_*_arm64.deb - + Ubuntu2004-amd64: os: ubuntu20.04 artifactName: iotedged-ubuntu20.04-amd64 @@ -305,7 +314,7 @@ stages: scriptType: bash scriptPath: $(Build.SourcesDirectory)/scripts/linux/publishReleasePackages.sh arguments: -p $(os) -w $(System.ArtifactsDirectory) -d $(System.ArtifactsDirectory)/$(artifactName) -s $(package-server-name) - + ############################################################################## - stage: PublishPackagesGithub ############################################################################## @@ -374,7 +383,12 @@ stages: artifactName: iotedged-redhat8-amd64 identityServiceArtifactName: packages_redhat-ubi8-latest_amd64 identityServicePackageFilter: aziot-identity-service-*.x86_64.rpm - + RedHat9-amd64: + os: redhat9 + artifactName: iotedged-redhat9-amd64 + identityServiceArtifactName: packages_redhat-ubi9-latest_amd64 + identityServicePackageFilter: aziot-identity-service-*.x86_64.rpm + Debian10-amd64: os: debian10 artifactName: iotedged-debian10-amd64 @@ -390,7 +404,7 @@ stages: artifactName: iotedged-debian10-aarch64 identityServiceArtifactName: packages_debian-10-slim_aarch64 identityServicePackageFilter: aziot-identity-service_*_arm64.deb - + Debian11-amd64: os: debian11 artifactName: iotedged-debian11-amd64 @@ -618,4 +632,4 @@ stages: test-released-images "$(Build.SourceBranchName)" displayName: Released Images Smoke Tests env: - DEVOPS_PAT: "$(IotEdge1-PAT-msazure)" \ No newline at end of file + DEVOPS_PAT: "$(IotEdge1-PAT-msazure)" diff --git a/builds/misc/templates/build-packages.yaml b/builds/misc/templates/build-packages.yaml index ce5ccc09268..10682167d95 100644 --- a/builds/misc/templates/build-packages.yaml +++ b/builds/misc/templates/build-packages.yaml @@ -59,6 +59,10 @@ stages: arch: amd64 os: redhat8 target.iotedged: edgelet/target/rpmbuild/RPMS/x86_64 + RedHat9-amd64: + arch: amd64 + os: redhat9 + target.iotedged: edgelet/target/rpmbuild/RPMS/x86_64 Debian10-amd64: os: debian10 diff --git a/edgelet/build/linux/package.sh b/edgelet/build/linux/package.sh index 1f59a6bfb22..d6a333d8c89 100755 --- a/edgelet/build/linux/package.sh +++ b/edgelet/build/linux/package.sh @@ -51,6 +51,24 @@ case "$PACKAGE_OS" in esac ;; + 'redhat9') + # Converts debian versioning to rpm version + # deb 1.0.1~dev100 ~> rpm 1.0.1-0.1.dev100 + RPM_VERSION="$(echo "$VERSION" | cut -d"~" -f1)" + RPM_TAG="$(echo "$VERSION" | cut -s -d"~" -f2)" + if [ -n "$RPM_TAG" ]; then + RPM_RELEASE="0.$REVISION.$RPM_TAG" + else + RPM_RELEASE="$REVISION" + fi + + case "$PACKAGE_ARCH" in + 'amd64') + DOCKER_IMAGE='redhat/ubi9:latest' + ;; + esac + ;; + 'debian10') DOCKER_IMAGE='debian:10-slim' ;; @@ -117,6 +135,16 @@ case "$PACKAGE_OS.$PACKAGE_ARCH" in ' ;; + redhat9.amd64) + SETUP_COMMAND=$' + dnf distro-sync -y && + dnf install -y \ + git make rpm-build \ + gcc gcc-c++ \ + libcurl-devel libuuid-devel openssl-devel && + ' + ;; + debian*.amd64) SETUP_COMMAND=$' export DEBIAN_FRONTEND=noninteractive @@ -298,7 +326,7 @@ case "$PACKAGE_OS" in MAKE_COMMAND="$MAKE_COMMAND && make rpm rpmbuilddir=/project/edgelet/target/rpmbuild 'TARGET=$MAKE_TARGET_DIR' 'VERSION=$VERSION' 'REVISION=$REVISION' 'CARGOFLAGS=--manifest-path ./Cargo.toml $CARGO_TARGET_FLAG' RPMBUILDFLAGS='-v -bb --clean --define \"_topdir /project/edgelet/target/rpmbuild\" $RPMBUILD_TARGET_FLAG'" ;; - redhat8) + redhat8|redhat9) case "$PACKAGE_ARCH" in amd64) MAKE_TARGET_DIR='target/release' diff --git a/edgelet/doc/devguide.md b/edgelet/doc/devguide.md index c4641a0eafb..3abe10a17e9 100644 --- a/edgelet/doc/devguide.md +++ b/edgelet/doc/devguide.md @@ -13,7 +13,7 @@ There are two options for building the IoT Edge Security Daemon. Linux packages are built using the `edgelet/build/linux/package.sh` script. Set the following environment variables, then invoke the script: -1. `PACKAGE_OS`: This is the OS on which the resulting packages will be installed. It should be one of `centos7`, `redhat8`, `debian10`, `debian11`, `ubuntu18.04`, `ubuntu20.04`, or `ubuntu22.04`. +1. `PACKAGE_OS`: This is the OS on which the resulting packages will be installed. It should be one of `centos7`, `redhat8`, `redhat9`, `debian10`, `debian11`, `ubuntu18.04`, `ubuntu20.04`, or `ubuntu22.04`. 1. `PACKAGE_ARCH`: This is the architecture of the OS on which the resulting packages will be installed. It should be one of `amd64`, `arm32v7` or `aarch64`. diff --git a/scripts/linux/publishReleasePackages.sh b/scripts/linux/publishReleasePackages.sh index 38d95f3ac4c..42410c377d3 100755 --- a/scripts/linux/publishReleasePackages.sh +++ b/scripts/linux/publishReleasePackages.sh @@ -51,6 +51,9 @@ check_os() { elif [[ "$PACKAGE_OS" == "redhat8" ]]; then OS_NAME="redhat" OS_VERSION="8" + elif [[ "$PACKAGE_OS" == "redhat9" ]]; then + OS_NAME="redhat" + OS_VERSION="9" else echo "Unsupported OS: $PACKAGE_OS" exit 1 diff --git a/test/Microsoft.Azure.Devices.Edge.Test.Common/linux/EdgeDaemon.cs b/test/Microsoft.Azure.Devices.Edge.Test.Common/linux/EdgeDaemon.cs index 45a2537505d..21febba6fc9 100644 --- a/test/Microsoft.Azure.Devices.Edge.Test.Common/linux/EdgeDaemon.cs +++ b/test/Microsoft.Azure.Devices.Edge.Test.Common/linux/EdgeDaemon.cs @@ -55,7 +55,7 @@ public static async Task CreateAsync(CancellationToken token) version = version.Split('.')[0]; packageExtension = SupportedPackageExtension.Rpm; - if (version != "8") + if (version != "8" && version != "9") { throw new NotImplementedException($"Daemon is only installed on Red Hat version 8.X, operating system '{os} {version}'"); }