Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 24, 2025

This PR resolves the warning "WARNING: apt does not have a stable CLI interface. Use with caution in scripts." that appears when running the Azure Pipelines Agent installation dependencies script on Debian-based systems.

Problem

The installdependencies.sh script was using the apt command, which is designed for interactive use and generates warnings when used in scripts:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Solution

Replaced all apt commands with apt-get equivalents, which provides a stable CLI interface specifically designed for scripting:

  • Before: apt update && apt install -y <packages>
  • After: apt-get update && apt-get install -y <packages>

Changes Made

  1. Updated comment from "prefer apt over apt-get" to "use apt-get for stable CLI interface in scripts"
  2. Changed package manager detection from command -v apt to command -v apt-get
  3. Replaced all apt update commands with apt-get update
  4. Replaced all apt install commands with apt-get install
  5. Updated error messages to reference apt-get instead of apt
  6. Simplified logic by removing the fallback to apt (since apt-get is always available when apt is)

Benefits

  • ✅ Eliminates the CLI stability warning completely
  • ✅ Uses the stable, script-friendly interface consistently
  • ✅ Maintains all existing functionality
  • ✅ Reduces code complexity by removing redundant fallback logic
  • ✅ More robust for automation scenarios

Testing

  • Script syntax validation passes
  • No remaining apt commands (only apt-get)
  • All error messages updated consistently
  • Integration test confirms warnings are eliminated

The fix is minimal and surgical, addressing the root cause while maintaining full backward compatibility.

Fixes #5149.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] [BUG]: WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Fix apt CLI stability warning by replacing apt with apt-get in installdependencies.sh Jun 24, 2025
Copilot AI requested a review from sanjuyadav24 June 24, 2025 17:17
Copilot finished work on behalf of sanjuyadav24 June 24, 2025 17:17
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.

[BUG]: WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

2 participants