X Tutup
The Wayback Machine - https://web.archive.org/web/20201117230431/https://github.com/devspace-cloud/devspace/issues/1188
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images always rebuild due to use of DEVSPACE_RANDOM in image tag #1188

Open
khaled opened this issue Oct 3, 2020 · 1 comment
Open

Images always rebuild due to use of DEVSPACE_RANDOM in image tag #1188

khaled opened this issue Oct 3, 2020 · 1 comment

Comments

@khaled
Copy link

@khaled khaled commented Oct 3, 2020

What happened?

I've noticed that my images always rebuild when running devspace dev, despite having preferSyncOverRebuild set to true.

It appears that using DEVSPACE_RANDOM as part of my image tag leads to this.

I'm using kaniko to build, so there's a significant unnecessary wait time every time I run devspace dev, even though kaniko is caching the layers. In other words, a kaniko pod has to spin up, the context files are synced to the pod, layer hashes are calculated and checked against the cache for each step, etc.

What did you expect to happen instead?
The image does not rebuild every time. Instead, the prior image tag is re-used, and a sync happens on startup.

How can we reproduce the bug? (as minimally and precisely as possible)
Use DEVSPACE_RANDOM as the tag in an image.

Local Environment:

  • DevSpace Version: 5.03
  • Operating System: mac
  • Deployment method: helm

Kubernetes Cluster:

  • Cloud Provider: aws
  • Kubernetes Version: 1.15

Anything else we need to know?

This appears to have to do with the calculation of imageConfigHash in helper.go. The image config contains the tag, which is a new random value every time you run devspace dev. Ideally there could be a special case in how imageConfigHash is calculated when DEVSPACE_RANDOM is used as part of the tag. For example, the hash could be calculated prior to replacing the DEVSPACE_RANDOM variable with a random value.

A snippet from the related Slack thread:
Screen Shot 2020-10-03 at 10 15 07 AM

/kind bug

@FabianKramm
Copy link
Member

@FabianKramm FabianKramm commented Oct 5, 2020

@khaled thanks for reporting this issue! This is actually a tricky problem since variable resolution happens very early in the command and I'll have to think about it for a good solution. As a workaround you could use devspace dev -x which would just skip building the image if you know that a rebuild is not necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
X Tutup