Skip to content

Commit

Permalink
Use product-versions.json instead of latest-aziot-*.json (#7270)
Browse files Browse the repository at this point in the history
This change updates the iotedge CLI and the packages release pipeline to query/update product-versions.json instead of latest-aziot-edge.json and latest-aziot-identity-service.json. The previous json files were specific to a particular release channel + version (1.4 LTS), whereas product-versions.json represents the current state of supported products and components across all stable and LTS releases. This is allow the CLI and our releases to operate smoothly during the coming phase where both 1.5 LTS and 1.6 LTS are supported side by side.

CLI details:
- Added a dependency on the semver crate to the iotedge CLI
- Updated the iotedge CLI to use and document a new vanity link for product-versions.json : https://aka.ms/azure-iotedge-latest-versions
- Updated the iotedge CLI to parse product-versions.json and extract the latest version of aziot-edge and aziot-identity-service. It uses the MAJOR.MINOR version of the currently installed CLI to determine which product versions (e.g., 1.4.x vs. 1.5.x) to get.
- Tested the CLI manually with/without the `--expected-aziot-edged-version` option against various versions of product-versions.json

Release pipeline details:
- Renamed update_latest_version_json() function in udpateLatestVersion.sh to update_product_versions_json()
- Added product-versions.jq alongside updateLatestVersion.sh to hold all the custom filters we use to query and update versions in the package release pipeline
- Currently, updateLatestVersion.sh determines the new product version by (1) grabbing the MAJOR.MINOR product version from the branch name, and (2) querying GitHub for the latest matching version. Since 1.5 will be serviced out of the main branch, I changed the logic to get the new product version from the release tag in the Azure/iotedge repo, and the current product version from the release tag in Azure/azure-iotedge.
- Removed some functions in updateLatestVersion.sh that were no longer needed since we don't query GitHub for release versions
- Added logic in updateLatestVersion.sh to use the filters in product-versions.jq to get and update information in product-versions.json. This logic also supports creating a new product in product-versions.json, which will allow for releasing 1.5 LTS side-by-side with 1.4 LTS.
- Tested product-versions.jq directly and via updateLatestVersion.sh, all from my desktop. *.jq files support some sort of unit testing, which I'd like to look into at a future date.

## Azure IoT Edge PR checklist:
  • Loading branch information
damonbarry authored Apr 26, 2024
1 parent 68b617d commit fad7ea1
Show file tree
Hide file tree
Showing 10 changed files with 383 additions and 226 deletions.
2 changes: 1 addition & 1 deletion builds/misc/packages-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ stages:
# Source the scripts & Update version files
source $(Build.SourcesDirectory)/iotedge/scripts/linux/github/updateLatestVersion.sh
update_latest_version_json
update_product_versions_json
# Update Github and tag
github_update_and_push
Expand Down
10 changes: 5 additions & 5 deletions builds/misc/templates/build-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ stages:
steps:
- bash: |
BASE_VERSION=`cat $BUILD_SOURCESDIRECTORY/edgelet/version.txt`
VERSION="$BASE_VERSION$BUILD_BUILDNUMBER"
VERSION="$BASE_VERSION~$BUILD_BUILDNUMBER"
echo "Version: $VERSION"
echo "##vso[task.setvariable variable=VERSION;]$VERSION"
Expand Down Expand Up @@ -189,7 +189,7 @@ stages:
steps:
- bash: |
BASE_VERSION=`cat $BUILD_SOURCESDIRECTORY/edgelet/version.txt`
VERSION="$BASE_VERSION$BUILD_BUILDNUMBER"
VERSION="$BASE_VERSION~$BUILD_BUILDNUMBER"
echo "##vso[task.setvariable variable=VERSION;]$VERSION"
echo "##vso[task.setvariable variable=PACKAGE_ARCH;]$(arch)"
echo "PACKAGE_OS=$(os)"
Expand All @@ -205,7 +205,7 @@ stages:
inputs:
azureSubscription: $(az.subscription)
KeyVaultName: 'edgebuildkv'
SecretsFilter: >-
SecretsFilter: >-
IotEdge1-GitHub-PAT
- task: PowerShell@2
displayName: 'Download aziot-identity-service'
Expand Down Expand Up @@ -275,7 +275,7 @@ stages:
steps:
- bash: |
BASE_VERSION=`cat $BUILD_SOURCESDIRECTORY/edgelet/version.txt`
VERSION="$BASE_VERSION$BUILD_BUILDNUMBER"
VERSION="$BASE_VERSION~$BUILD_BUILDNUMBER" # Give deb format here; let Makefile convert to rpm format
echo "##vso[task.setvariable variable=VERSION;]$VERSION"
echo "##vso[task.setvariable variable=PACKAGE_ARCH;]$(arch)"
echo "PACKAGE_OS=$(os)"
Expand Down Expand Up @@ -332,7 +332,7 @@ stages:
sudo cp iot-identity-service/packages/mariner$(os_version)/$(arch)/aziot-identity-service-$packageVersion-1.cm$(os_version).$(arch).rpm .
sudo cp iot-identity-service/packages/mariner$(os_version)/$(arch)/aziot-identity-service-debuginfo-$packageVersion-1.cm$(os_version).$(arch).rpm .
sudo rm -rf iot-identity-service
- bash: |
sudo docker run --rm \
-v "$(Build.SourcesDirectory):/src" \
Expand Down
59 changes: 33 additions & 26 deletions edgelet/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions edgelet/iotedge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ libc = "0.2"
log = { version = "0.4", features = ["std"] }
nix = "0.26"
regex = "1"
semver = "1.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sysinfo = "0.28"
Expand Down
Loading

0 comments on commit fad7ea1

Please sign in to comment.