Skip to content

Docker image is pulled even though test is cached #17958

Open
@chris-stetter

Description

@chris-stetter

Describe the bug
When using the new environments feature where a test is executed within a Docker container and remote caching is used, the Docker image still gets pulled even though the test is cached subsequently:

Run ./pants test services::
  
[1](https://github.com/myorg/myrepo/actions/runs/3861658230/jobs/6622990398#step:5:1)0:54:32.85 [WARN] DEPRECATED: The autoflake plugin has moved to `pants.backend.python.lint.autoflake` (and from the `fmt` goal to the `fix` goal).
10:54:32.92 [WARN] DEPRECATED: The autoflake plugin has moved to `pants.backend.python.lint.autoflake` (and from the `fmt` goal to the `fix` goal).
10:54:33.01 [INFO] Starting: Pulling Docker image `qgis/qgis:final-3_22_9` because the image is missing locally.
10:55:33.07 [INFO] Long running tasks:
  60.06s	Pulling Docker image `qgis/qgis:final-3_22_9` because the image is missing locally.
10:56:03.10 [INFO] Long running tasks:
  90.09s	Pulling Docker image `qgis/qgis:final-3_22_9` because the image is missing locally.
10:56:33.15 [INFO] Long running tasks:
  1[20](https://github.com/myorg/myrepo/actions/runs/3861658230/jobs/6622990398#step:5:20).14s	Pulling Docker image `qgis/qgis:final-3_[22](https://github.com/myorg/myrepo/actions/runs/3861658230/jobs/6622990398#step:5:23)_9` because the image is missing locally.
10:56:59.81 [INFO] Completed: Pulling Docker image `qgis/qgis:final-3_22_9` because the image is missing locally.
10:57:01.87 [INFO] Starting: Building requirements.pex
10:57:01.87 [INFO] Starting: Building 2 requirements for requirements.pex from the lockfiles/default.lock resolve: boto3==1.17.106, sqlalchemy==1.4.37
10:57:02.17 [INFO] Canceled: Building requirements.pex
10:57:02.17 [INFO] Starting: Building pytest.pex from lockfiles/pytest.lock
10:57:02.43 [INFO] Canceled: Building pytest.pex from lockfiles/pytest.lock
10:57:02.48 [INFO] Starting: Building local_dists.pex
10:57:02.52 [INFO] Canceled: Building 2 requirements for requirements.pex from the lockfiles/default.lock resolve: boto3==1.17.106, sqlalchemy==1.4.37
10:57:02.61 [INFO] Canceled: Building local_dists.pex
10:57:02.63 [INFO] Starting: Building pytest_runner.pex
10:57:02.63 [INFO] Starting: Building pytest_runner.pex
10:57:02.82 [INFO] Canceled: Building pytest_runner.pex
10:57:02.86 [INFO] Canceled: Building pytest_runner.pex
10:57:03.10 [INFO] Completed: Run Pytest - (environment:linux_docker, services/qgis/tests/example_test.py) - succeeded.
10:57:03.11 [INFO] Completed: Run Pytest - (environment:linux_docker, services/qgis/tests/test_add_spatial_analysis_project.py) - succeeded.

✓ services/qgis/tests/example_test.py succeeded in 1.81s (cached remotely).
✓ services/qgis/tests/test_add_spatial_analysis_project.py succeeded in 4.45s (cached remotely).
10:57:03.14 [INFO] Starting: Building coverage_py.pex from coverage-py_default.lock
10:57:03.42 [INFO] Canceled: Building coverage_py.pex from coverage-py_default.lock

Wrote xml coverage report to `dist/coverage/python`
10:57:03.83 [INFO] Counters:
  backtrack_attempts: 0
  docker_execution_errors: 0
  docker_execution_requests: 18
  docker_execution_successes: 0
  local_cache_read_errors: 0
  local_cache_requests: 27
  local_cache_requests_cached: 0
  local_cache_requests_uncached: 27
  local_cache_total_time_saved_ms: 0
  local_cache_write_errors: 0
  local_execution_requests: 10
  local_process_total_time_run_ms: 1335
  remote_cache_read_errors: 0
  remote_cache_requests: 26
  remote_cache_requests_cached: [23](https://github.com/myorg/myrepo/actions/runs/3861658230/jobs/6622990398#step:5:24)
  remote_cache_requests_uncached: 0
  remote_cache_speculation_local_completed_first: 3
  remote_cache_speculation_remote_completed_first: 23
  remote_cache_total_time_saved_ms: 4[37](https://github.com/myorg/myrepo/actions/runs/3861658230/jobs/6622990398#step:5:38)[84](https://github.com/myorg/myrepo/actions/runs/3861658230/jobs/6622990398#step:5:85)
  remote_cache_write_attempts: 3
  remote_cache_write_errors: 0
  remote_cache_write_successes: 3
  remote_execution_errors: 0
  remote_execution_requests: 0
  remote_execution_rpc_errors: 0
  remote_execution_rpc_execute: 0
  remote_execution_rpc_retries: 0
  remote_execution_rpc_wait_execution: 0
  remote_execution_success: 0
  remote_execution_timeouts: 0
  remote_process_total_time_run_ms: 0
  remote_store_missing_digest: 0

Pants version
2.15

OS
GitHub Actions, so Linux

Additional info
As pointed out by @stuhood in #15199 (comment), the Docker image pull should not be triggered or canceled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend: Environments{local,docker,remote}._environment-related issuesbug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions