Skip to content

Fix docker-autoscaler proxy tunnel for Windows

Arran Walker requested to merge ajwalker/fix-docker-conn into main

What does this MR do?

  • Moves environment.Prepare() outside of the Docker client's Dialer implementation.
  • Updates the fleeting library.

Why was this MR needed?

  • environment.Prepare() inside the Dialer implementation is no longer a good fit because Prepare() can create environments (nested VMs) on the instance, and the Docker client can make more than one connection. environment.Prepare() now also adds logging that you would only expect to see once, not each time Docker needs to connect to the daemon.
  • The fleeting library is updated to fix a problem with WinRM, where connections were not being terminated correctly with the proxy tunnel (which is used to connect to the Docker daemon).

What's the best way to test this MR?

Use Docker-Autoscaler executor against Windows instances with the docker daemon installed.

concurrent = 4

[[runners]]
  name = "windowsrunner"
  url = "https://gitlab.com"
  token = "<snip>"
  executor = "docker-autoscaler"
  environment = ["FF_USE_POWERSHELL_PATH_RESOLVER=1"]
  shell = "pwsh"

  [runners.docker]
    host = "npipe:////./pipe/docker_engine"
    image = "mcr.microsoft.com/powershell:lts-7.2-nanoserver-ltsc2022"

  [runners.autoscaler]
    capacity_per_instance = 2
    max_use_count = 2
    max_instances = 5
    plugin = "fleeting-plugin-aws"

    [runners.autoscaler.plugin_config]
      name = "windows-test"

    [runners.autoscaler.connector_config]
      username = "Administrator"
      use_static_credentials = false
      timeout = "5m0s"
      use_external_addr = true

    [[runners.autoscaler.policy]]
      idle_count = 4
      idle_time = "20m0s"

What are the relevant issue numbers?

Closes gitlab-org/fleeting/fleeting#6 (comment 1435573881)

Edited by Arran Walker

Merge request reports