Skip to content

fix: fix oras path#7890

Closed
lilypan26 wants to merge 2 commits intomainfrom
lily/fix-oras-path
Closed

fix: fix oras path#7890
lilypan26 wants to merge 2 commits intomainfrom
lily/fix-oras-path

Conversation

@lilypan26
Copy link
Contributor

What this PR does / why we need it:
fixes oras path that was changed in #7125

Which issue(s) this PR fixes:

Fixes #

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the oras CLI invocation path in Linux CSE helpers (regressed when components were moved to /opt/bin in #7125) and updates generated CustomData snapshots accordingly.

Changes:

  • Define ORAS=/opt/bin/oras and use it for oras pull/cp/login/logout/repo ls calls in cse_helpers.sh.
  • Regenerate/update pkg/agent/testdata/**/CustomData snapshots to reflect the script change.

Reviewed changes

Copilot reviewed 38 out of 66 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
parts/linux/cloud-init/artifacts/cse_helpers.sh Introduces ORAS path variable and updates oras command invocations to use it.
pkg/agent/testdata/MarinerV2+Kata/CustomData Snapshot update after script change.
pkg/agent/testdata/MarinerV2+CustomCloud/CustomData Snapshot update after script change.
pkg/agent/testdata/CustomizedImageLinuxGuard/CustomData Snapshot update after script change.
pkg/agent/testdata/CustomizedImageKata/CustomData Snapshot update after script change.
pkg/agent/testdata/CustomizedImage/CustomData Snapshot update after script change.

FLATCAR_OS_NAME="FLATCAR"
AZURELINUX_OSGUARD_OS_VARIANT="OSGUARD"
KUBECTL=/opt/bin/kubectl
ORAS=/opt/bin/oras
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoding ORAS=/opt/bin/oras can break backward compatibility when newer CSE scripts run on older VHDs that may still have oras in a different location (e.g., /usr/local/bin/PATH). Consider resolving ORAS dynamically (prefer /opt/bin/oras when present, otherwise fall back to command -v oras/known legacy paths) and fail with a clear error if no binary is found.

Suggested change
ORAS=/opt/bin/oras
# Resolve ORAS dynamically to maintain compatibility across VHDs.
if [ -x /opt/bin/oras ]; then
ORAS=/opt/bin/oras
elif command -v oras >/dev/null 2>&1; then
ORAS="$(command -v oras)"
elif [ -x /usr/local/bin/oras ]; then
ORAS=/usr/local/bin/oras
else
echo "ERROR: oras binary not found. Expected at /opt/bin/oras or in PATH (e.g., /usr/local/bin/oras)." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
FLATCAR_OS_NAME="FLATCAR"
AZURELINUX_OSGUARD_OS_VARIANT="OSGUARD"
KUBECTL=/opt/bin/kubectl
ORAS=/opt/bin/oras
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this path not present on older VHD, could this cse script run on older VHD ?

Copy link
Contributor

@awesomenix awesomenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after discussing in teams this will break old VHD which is still using /usr/local/bin path

@djsly
Copy link
Collaborator

djsly commented Feb 18, 2026

probably not needed.

@lilypan26 lilypan26 closed this Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants