-
Notifications
You must be signed in to change notification settings - Fork 244
fix: update waagent during boot of firsttime #7747
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -426,3 +426,52 @@ cpAndMode() { | |||||||||||||||||||||||||||||||||||||||||||||||||
| mode=$3 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| DIR=$(dirname "$dest") && mkdir -p ${DIR} && cp $src $dest && chmod $mode $dest || exit $ERR_PACKER_COPY_FILE | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| updateWALinuxAgent() { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| local waagent_version="2.15.0.1" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| local tarball="v${waagent_version}.tar.gz" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| local extract_dir="WALinuxAgent-${waagent_version}" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| apt-get purge -y walinuxagent | ||||||||||||||||||||||||||||||||||||||||||||||||||
| systemctl daemon-reload | ||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf /usr/lib/python3/dist-packages/azurelinuxagent* | ||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf /usr/local/lib/python3.10/dist-packages/azurelinuxagent* | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+438
to
+439
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf /usr/local/lib/python3.10/dist-packages/azurelinuxagent* | |
| # Dynamically determine any /usr/local site-packages directory and remove azurelinuxagent from it | |
| local local_site_packages | |
| local_site_packages=$(python3 - <<'EOF' | |
| import site | |
| paths = [] | |
| if hasattr(site, "getsitepackages"): | |
| paths.extend(site.getsitepackages()) | |
| get_user_site = getattr(site, "getusersitepackages", None) | |
| if callable(get_user_site): | |
| user_site = get_user_site() | |
| if isinstance(user_site, str): | |
| paths.append(user_site) | |
| for p in paths: | |
| if p.startswith("/usr/local/"): | |
| print(p) | |
| break | |
| EOF | |
| ) || local_site_packages="" | |
| if [[ -n "$local_site_packages" ]]; then | |
| rm -rf "${local_site_packages%/}/azurelinuxagent"* | |
| fi |
Copilot
AI
Jan 28, 2026
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.
The agent source is downloaded and installed as root from GitHub without any integrity verification (checksum/signature) beyond HTTPS. For a base image build step, please add a deterministic integrity check (e.g., pinned SHA256 for the tarball or verify a signed release) to reduce supply-chain risk.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,6 +33,7 @@ if isMarinerOrAzureLinux "$OS"; then | |||||||||
| fi | ||||||||||
|
|
||||||||||
| installJq || echo "WARNING: jq installation failed, VHD Build benchmarks will not be available for this build." | ||||||||||
| updateWALinuxAgent || echo "WARNING: WALinuxAgent update failed" | ||||||||||
|
||||||||||
| updateWALinuxAgent || echo "WARNING: WALinuxAgent update failed" | |
| if [[ "$OS" == "UBUNTU" || "$OS" == "DEBIAN" ]]; then | |
| updateWALinuxAgent || echo "WARNING: WALinuxAgent update failed" | |
| fi |
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.
oh, did you intentionally break it? Did copilot catch an issue?
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.
updateWALinuxAgentdirectly callsapt-get purge -y walinuxagentwithout using the repo’s retry/timeout helpers (e.g.apt_get_purgeinvhdbuilder/packer/install-dependencies.sh). This makes builds more brittle and can hang/fail differently than the rest of the provisioning flow; please switch to the existing helper (and only run on apt-based distros).