--skip-build uses cached image tag in generated.yaml
What happened?
In a project devspace configuration which has an image build section and also a replaceImage config, if we use devspace dev a docker build is performed and the image is tagged with a random value. This value then seems to be stored in .devspace/generated.yaml like below.
# .devspace/generated.yaml
varsEncrypted: true
profiles:
"":
images:
test-project:
imageName: test-project-image-name
tag: YZdjOtm
lastContext:
namespace: test-project
context: minikube
# devspace.yaml
version: v1beta10
images:
test-project:
image: test-project-image-name
build:
custom:
command: ./docker-build.sh
dev:
sync:
- containerName: main
labelSelector:
role: app-server
localSubPath: ./src
containerPath: /app/src
replacePods:
- containerName: main
labelSelector:
role: app-server
replaceImage: test-project-image-name-builder:latest
patches:
- op: remove
path: spec.containers[0].securityContext
- op: replace
path: spec.containers[0].args
value:
- "sbt"
- "set reStart / mainClass := Some(\"io.rvignesh.test-project\");~reStart"
The next time if I run devspace dev --skip-build the replaced pod uses the image tag YZdjOtm that was generated from the previous dev run, instead of using the replaceImage configuration in the dev section.
What did you expect to happen instead?
If I use devspace dev --skip-build I expect devspace to honor the replaceImage in dev.replacePods section.
How can we reproduce the bug? (as minimally and precisely as possible)
- Create a devspace config with image build section and replaceImage configurations
- Run
devspace devwhich should build a new image and use it in the replaced pod - Reset using
devspace reset pods - Run
devspace dev --skip-buildwhich should use the configuration in thereplaceImagebut instead it's using the tag from the previous build.
Local Environment:
- DevSpace Version: 5.17.0
- Operating System: mac
- Deployment method: kubectl apply
Kubernetes Cluster:
- Cloud Provider: aws
- Kubernetes Version: 1.21
Anything else we need to know?
/kind bug
@rvignesh89 thanks for creating this issue! Could you provide a short example devspace.yaml so that we can reproduce this issue?
Updated the issue description.
@rvignesh89 thanks for the update! This works as intended as devspace always prefers the self-built tags configured in images.*.tags. You can use the following configuration which should work:
version: v1beta10
images:
test-project:
image: test-project-image-name
build:
custom:
command: ./docker-build.sh
dev:
sync:
- containerName: main
labelSelector:
role: app-server
localSubPath: ./src
containerPath: /app/src
replacePods:
- containerName: main
labelSelector:
role: app-server
replaceImage: image(test-project-image-name):latest
patches:
- op: remove
path: spec.containers[0].securityContext
- op: replace
path: spec.containers[0].args
value:
- "sbt"
- "set reStart / mainClass := Some(\"io.rvignesh.test-project\");~reStart"