concourse / concourse/docker-image-resource

cache_from parameter does not work

Open
#200 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-validation
Dominant language
Go
Stars
162
Forks
250
PR merge metrics
No merged PRs in 30d

Description

When using cache_from and providing a docker image with layers that do not need to be re-built, Concourse will re-build all of the layers every time instead of using cached layers. (It is the same behavior as if you did not use cache_from at all.)

Here is an example pipeline:

---
resource_types:
- name: pull-request
  type: docker-image
  source:
    repository: jtarchie/pr

resources:
- name: pull-request
  type: pull-request
  source:
    repo: quotecenter/app-thunder-storefront
    access_token: ((github-token))
    username: x-oauth-basic
    password: ((github-token))

- name: docker-image
  type: docker-image
  source:
    repository: gcr.io/np-quotecenter/app-thunder-storefront/pull-requests
    username: _json_key
    password: ((gcr-key))

- name: docker-image-master
  type: docker-image
  source:
    repository: gcr.io/np-quotecenter/app-thunder-storefront/master
    username: _json_key
    password: ((gcr-key))
    tag: latest

jobs:
- name: build
  plan:
  - aggregate:
    - get: app-thunder-storefront
      resource: pull-request
      trigger: true
      version: every

    - get: docker-image-master
      params:
        save: true

  - put: docker-image
    params:
      build: app-thunder-storefront
      build_args:
        NPM_TOKEN: ((myget-token))
      tag: app-thunder-storefront/.git/head_sha
      cache_from: [ docker-image-master ]

The docker image docker-image-master contains the exact same docker image that this PR is building - I have verified this several times.

The resulting output shows that it builds the entire image from scratch without using any caching:
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with the example pipeline, especially the saved docker-image-master input and its cache_from parameter. Trace how the docker-image resource handles cache_from during the image build and verify the result against the expected reuse of unchanged layers. Done means the build reuses matching cached layers instead of rebuilding the image from scratch.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.