-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Packaging] Add snap edge build to CI pipeline #32591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
️✔️AzureCLI-FullTest
|
|
Add snap edge build |
|
Hi @wangzelin007, |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
️✔️AzureCLI-BreakingChangeTest
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds Snap package building to the Azure CLI CI pipeline for edge channel testing. The implementation includes a template-based snapcraft configuration, a comprehensive build script supporting both single and multi-architecture builds, and Azure Pipelines integration with automated testing.
Key changes:
- Introduced
snapcraft.yaml.templatewith configurable version and architecture support for packaging Azure CLI as a Snap - Added
build-snap.shscript to automate snap package generation from Python wheels with support for local (amd64) and remote multi-arch (amd64 + arm64) builds - Integrated snap build pipeline via
azure-pipelines-snap.ymltemplate with build, test, and optional store publishing jobs
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| scripts/release/snap/snapcraft.yaml.template | Snap package configuration template defining metadata, confinement settings, architecture placeholders, and build instructions |
| scripts/release/snap/build-snap.sh | Shell script orchestrating snap build process including version detection, wheel validation, snapcraft.yaml generation, and build execution |
| scripts/release/snap/azure-pipelines-snap.yml | Azure Pipelines template defining jobs for building and testing snap packages with optional store publishing |
| azure-pipelines.yml | Integrates snap build template into main CI pipeline with single-arch build and no store publishing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| echo "Azure CLI Snap Build Script" | ||
| echo "" | ||
| echo "Usage: $0 [VERSION] [--multi-arch]" | ||
| echo "" | ||
| echo "Arguments:" | ||
| echo " VERSION CLI version (auto-detected from wheel if not specified)" | ||
| echo " --multi-arch Build for amd64 and arm64 using Launchpad remote-build" | ||
| echo "" | ||
| echo "Environment Variables:" | ||
| echo " WHEEL_DIR Directory containing wheel files (default: /mnt/pypi)" | ||
| echo " OUTPUT_DIR Output directory for snap file (default: /mnt/output)" | ||
| echo "" | ||
| echo "Examples:" | ||
| echo " $0 # Build amd64 only" | ||
| echo " $0 --multi-arch # Build amd64 + arm64" | ||
| echo " $0 2.81.0 --multi-arch # Build specific version, multi-arch" | ||
| exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this file generated by AI? Could you share the initial prompt that was used to generate this file?
It seems a little bit over-complicated. For example, there is no need to provide this help message as this script is purely internal and not user-facing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this script was developed with GitHub Copilot assistance. Here's the prompt
Create a bash script to build Azure CLI snap package from wheel files.
Requirements:
- Accept CLI version as argument, or auto-detect from wheel filename
- Support single-arch (amd64) and multi-arch (amd64 + arm64) builds
- Use environment variables for wheel directory (WHEEL_DIR) and output directory (OUTPUT_DIR)
- Generate snapcraft.yaml from a template file, replacing version and architecture placeholders
- Create a wrapper script (az-wrapper) that sets up Python environment variables
- For single-arch: use --use-lxd locally, --destructive-mode in CI (detected via $CI or $BUILD_BUILDID)
- For multi-arch: use snapcraft remote-build (requires SNAPCRAFT_STORE_CREDENTIALS)
- Copy build artifacts and logs to output directory
I think the help message actually reduces complexity rather than adding to it.
For an internal script, the alternative would be reading through the code or
relying on comments to understand the usage. The help message serves as
self-documentation - anyone can run ./build-snap.sh --help and immediately
understand:
- What arguments are accepted
- What environment variables to set
- Example usage patterns
This is especially helpful for onboarding new team members or when someone
needs to debug the build process months later.
Also, this script is designed to run both in CI and locally for testing.
The help message makes local usage much easier without having to dig into
the code to figure out how to use it.
Description
Add Snap package build to the CI pipeline for edge channel testing.
The stable version will be released by a separate release pipeline.
Changes
snapcraft.yaml.templatefor snap package configurationbuild-snap.shto:snapcraft.yamlfrom templateWhy
Snap is a popular package format on Ubuntu and other Linux distributions.
Building snap packages in CI allows early detection of packaging issues
before the official release.
Testing
sudo snap install --dangerous azure-cli_*.snapazure-cli.az --version,azure-cli.az self-testRelated command
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.