Garden not respecting source.path
# 💻|contributing
b
Hey all Just to follow up on that issue with the source paths we bumped into in our collab session yesterday. AFAICT, Garden isn't handling the
source.path
field correctly when using the
getFiles
handler on the VCS class. It looks like its just ignoring it which means it thinks a give action doesn't have any files. For example, consider the following config:
Copy code
# In api/garden.yml
kind: Build
name: api
type: container
source:
  path: ../ # <-- Set the source to the parent dir
include: [api/**/*]
---
kind: Deploy
name: api
source:
  path: ../ # <-- Set the source to the parent dir
spec:
  files: [./manifests]
In this case the build context for the build action will be empty and the build fails with the error that a Dockerfile wasn't found. The Deploy appears to work because at deploy time we read the files from the correct path and Garden applies the manifests. However—and this is important!—because the files are still empty the action version is incorrectly calculated. So if you e.g. update the manifests, the version will not change. First off, am I doing something wrong here? If not, this needs to be addresses ASAP. cc @curved-intern-91221 @swift-garage-61180 , because this is pretty deep in the engine.
My guess is this is a one liner fix somewhere but the flow is a bit convoluted and I'm not sure where it should be applied. E.g. the action has field called
config.internal.basePath
and I'm not entirely sure if that's should be the actual config file path or the "corrected" one with respect to the
source.path
field.
Obviously we also need tests for this.
s
@curved-intern-91221 Do you want to take a first look at this? I'm also happy to check this out if you're in the middle of something else.
Ok, I think I've fixed this here @brief-restaurant-63679: https://github.com/garden-io/garden/pull/5305 Included a bit of commentary in the PR description.
c
Ah, sorry, missed that. I was looking into something else. @swift-garage-61180 the changes lgtm, Eysi letf a few comments.