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

0.13: [Bug]: Regression in git scan mode after 0.13.19 with remote repository URLs #5625

Closed
ohookins opened this issue Jan 11, 2024 · 1 comment · Fixed by #5660
Closed

Comments

@ohookins
Copy link
Contributor

Garden Bonsai (0.13) Bug

Current Behavior

We have most of our services defined in our Garden project repository, but the source points to the service repository itself, for example:

kind: Build
type: container
name: gateway
source:
  repository:
    url: [email protected]:xxxx/gateway#main
include: ["**/*"]

We run garden update-remote all to pull the contents of those remote repositories which causes Garden to check out the repository to a path like .garden/sources/action/build.gateway--a3057b675c within the current Garden project.

At container build time, Garden will sync the files from that directory to a build directory which is then picked up by mutagen. This is according to the include/exclude rules above. In 0.13.19 and earlier, this worked as expected:

ℹ git [debug]          → Scanning Build action gateway root at /private/tmp/b/.garden/sources/action/build.gateway--a3057b675c
  → Includes: **/*
  → Excludes: **/.garden/**/*

ℹ git [debug]          → Found 57 files in Build action gateway root /private/tmp/b/.garden/sources/action/build.gateway--a3057b675c

ℹ build.gateway [verbose] → Syncing sources (57 files)...
ℹ build.gateway [debug] → Syncing 57 files from .garden/sources/action/build.gateway--a3057b675c to .garden/build/gateway (and removing any extraneous files)

In 0.13.20 and later, Garden finds no files to sync:

ℹ build.gateway [debug] → Syncing 0 files from .garden/sources/action/build.gateway--a3057b675c to .garden/build/gateway (and removing any extraneous files)

(There's not much other usable output before this).

It appears to be because the git scan mode has changed from subtree to repo. When this is set to subtree again via environment variable, 0.13.20 and later work again as expected.

Expected behavior

Checked out files from the remote repository are synced to the K8s cluster and built as a container. (These are actually internal details and should not really be a user requirement, however in this case it is the cause of the problem of the service not building in Garden).

Reproducible example

See snippet above.

Workaround

export GARDEN_GIT_SCAN_MODE=subtree

Suggested solution(s)

It's hard to know what to suggest without knowing more about the internal workings of the git scan mode, which is really not a user-facing implementation detail of Garden.

ℹ graph [silly]        → TreeCache: Setting value for key ["source","/private/tmp/b/.garden/sources/action/build.gateway--a3057b675c","include","ad948e60de"]
ℹ graph [debug]        → Found 0 files in module path, filtering by 1 include and 1 exclude globs
ℹ graph [silly]        → Include globs: **/*
ℹ graph [silly]        → Exclude globs: **/.garden/**/*
ℹ graph [debug]        → Found 0 files in module path after glob matching

This may be a long shot, but it seems like the default exclude glob would exclude the path to which the remote repositories are checked out. This doesn't seem correct.

Additional context

Your environment

  • OS: macOS 14.2.1, Intel
  • How I'm running Kubernetes: EKS

garden version
0.13.20 introduces the regression, and I've been able to reproduce up until 0.13.23.

@vvagaytsev
Copy link
Collaborator

Re-opening this to address the same issue for the repo scan mode. The #5631 was just a hot-fix to avoid the necessity of a workaround.

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

Successfully merging a pull request may close this issue.

4 participants