gitpod-io / gitpod

The developer platform for on-demand cloud development environments to create software faster and more securely.
https://www.gitpod.io
GNU Affero General Public License v3.0
12.57k stars 1.2k forks source link

Dockerfile always rebuilding with "Incremental Prebuilds" enabled #11455

Open aucampia opened 2 years ago

aucampia commented 2 years ago

Bug description

I have Incremental Prebuilds enabled for my project (https://gitpod.io/projects/rdflib/settings), however every time I commit to a PR branch the docker build starts from scratch as far as I can tell.

Steps to reproduce

  1. Create a branch from https://github.com/aucampia/rdflib/tree/iwana-20220718T2235-gitpod-issue
  2. Create a (draft) PR from the branch
  3. Wait for it to do a prebuild
  4. Create an arbitrary update to README.md on the branch
  5. Wait for it to do a prebuild

Workspace affected

https://gitpod.io/#https://github.com/aucampia/rdflib/tree/iwana-20220718T2235-gitpod-issue

Expected behavior

Each update to README.md after the first prebuild does not do a full docker build

Example repository

https://github.com/aucampia/rdflib/tree/iwana-20220718T2235-gitpod-issue

Anything else?

No response

Front logo Front conversations

david-bakin commented 2 years ago

I noticed this in the past - but failed to report it, sorry. IIRC in my case the container wasn't build each time but most times, and also I don't think I had incremental prebuilds enabled. I couldn't figure out any pattern. But in any event it was rebuilt even though I had not pushed an updated .gitpod.Dockerfile.

This is a large time sink as docker container builds especially off of Gitpod.io's "workspace-full" container, are quite slow. And that defeats the main selling points of Gitpod.io - "Select project, start coding."

I think the custom container should only be updated on two occasions when doing a prebuild (or loading a workspace that hasn't been prebuilt):

  1. The custom dockerfile (specified of course by the image: attribute in .gitpod.yml) has been pushed.
  2. A custom dockerfile is specified, and the base container it specifies (via the FROM statement) has changed. (i.e., its image checksum has changed)
    • Yes, that does mean you have to look inside the customer dockerfile to find the base image's ref.

(As to discovering whether the image now at the tag is the same or different that the image that was last used in a customer dockerfile build: that's left as "an exercise for the reader" as my brief reading of various issues at Docker show that identifying a particular image is a hairball ... - but I'm no docker registry expert ...)

nandubatchu commented 1 year ago

Hey @csweichel - is this bug-fix being worked upon?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.