Skip to content

core install command ignores network.proxy configuration #2888

Closed
@Dmitro25

Description

@Dmitro25

Describe the problem

Arduino CLI must access the Internet for various operations. It can be configured to use a proxy server via the network.proxy configuration key.

🐛 The network.proxy configuration key is ignored by the core install command.

To reproduce

Setup

$ git clone https://github.com/arduino/arduino-cli && cd arduino-cli

[...]

$ git checkout 6320f6eb  # Checkout the last good commit.

[...]

$ task build

[...]

$ export ARDUINO_DIRECTORIES_DATA="/tmp/arduino-cli-directories/data"  # Use a throwaway data folder for the demo.

$ export ARDUINO_DIRECTORIES_DOWNLOADS="/tmp/arduino-cli-directories/downloads"

$ rm -r "$ARDUINO_DIRECTORIES_DATA" "$ARDUINO_DIRECTORIES_DOWNLOADS"  # Make sure there aren't existing files that would throw off the results.

[...]

$ ./arduino-cli lib update-index  # This is required as a preparatory operation because `core install` unnecessarily triggers a libraries index update if it is not already updated.

$ export ARDUINO_NETWORK_PROXY="http://foouser:[email protected]/404:42/"  # Configure Arduino CLI to use a proxy, intentionally using a non-functional configuration.

Demonstration of correct operation pre-regression

$ ./arduino-cli core install arduino:avr  # Attempt to install a platform while using a proxy.

Downloading packages...
arduino:[email protected] Get "https://downloads.arduino.cc/tools/arduinoOTA-1.3.0-windows_386.zip": Internal Server Error
Error during install: Get "https://downloads.arduino.cc/tools/arduinoOTA-1.3.0-windows_386.zip": Internal Server Error

🙂 The operation failed due to the non-functional proxy configuration, proving that the core install command does use the configured proxy for its downloads.

Demonstration of incorrect operation post-regression

$ git checkout master

[...]

$ task build

[...]

$ ./arduino-cli core install arduino:avr

$ ./arduino-cli core install arduino:avr
Downloading packages...
arduino:[email protected] downloaded
arduino:[email protected] downloaded                                                                                                                                                                                                                  
arduino:[email protected] downloaded
arduino:[email protected] downloaded
Installing arduino:[email protected]...
Configuring tool....
arduino:[email protected] installed
Installing arduino:[email protected]...
Configuring tool....
arduino:[email protected] installed
Installing arduino:[email protected]...
Configuring tool....
arduino:[email protected] installed
Installing platform arduino:[email protected]...
Configuring platform....
Platform arduino:[email protected] installed

🐛 The installation was successful even though Arduino CLI was configured to use a non-functional proxy. This proves that the core install command does not use the configured proxy for its downloads.

Demonstration of correct operation of lib install command

$ export ARDUINO_DIRECTORIES_USER="/tmp/arduino-cli-directories/user"  # Use a throwaway user folder for the demo.

$ rm -r "$ARDUINO_DIRECTORIES_USER"  # Make sure there aren't existing files that would throw off the results.

[...]

$ ./arduino-cli lib install Servo

Downloading [email protected]...
[email protected] Get "https://downloads.arduino.cc/libraries/github.com/arduino-libraries/Servo-1.2.2.zip?query=install": Internal Server Error
Error installing Servo: Can't download library: Get "https://downloads.arduino.cc/libraries/github.com/arduino-libraries/Servo-1.2.2.zip?query=install": Internal Server Error

🙂 The operation failed due to the non-functional proxy configuration, proving that the lib install command does use the configured proxy for its downloads.

Expected behavior

All operations that access the Internet respect the network.proxy configuration.

Arduino CLI version

23ed1b1

Operating system

Windows

Operating system version

  • 10, build 1809
  • 11

Additional context

I bisected the regression to 1fddba7 / #2565 (does not occur when using the build at the previous commit 6320f6e).

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    conclusion: resolvedIssue was resolvedtopic: codeRelated to content of the project itselftopic: package-managementRelated to the packaging and managing of the platform/librariestype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions