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

Fix local-preview project-root-only flag. #288

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

armooo
Copy link
Contributor

@armooo armooo commented Feb 1, 2025

It seems 9274791 which added .gitignore support inadvertently removed packagePath from the call to GetIgnoreMatcherFn.

Fixes: #287

@tomasmik
Copy link
Contributor

tomasmik commented Feb 3, 2025

Will this now include and archive dirs in the root which we don't actually care about?

@armooo
Copy link
Contributor Author

armooo commented Feb 3, 2025

I don't think it would. Do you have an example you can think of where this would happen? Here are a few tests I ran.

The test setup.

> tree
.
├── a
│   ├── bar
│   └── foo
├── b
│   ├── bar
│   └── foo
└── c
    ├── base
    └── foo

4 directories, 6 files

> cat .gitignore
c/**

Without --project-root-only from the root.

> spacectl stack local-preview --id test --no-upload
Packing local workspace...
No upload flag was provided, will not create run, saved archive at: /var/folders/3c/1nl1q9816zd66cy4lp5fdxjw0000gn/T/spacectl/local-workspace/01JK6GJDA51NCGBS0FJWR23KV9.tar.gz

> tar -tf /var/folders/3c/1nl1q9816zd66cy4lp5fdxjw0000gn/T/spacectl/local-workspace/01JK6GJDA51NCGBS0FJWR23KV9.tar.gz
01JK6GJDA51NCGBS0FJWR23KV9/
01JK6GJDA51NCGBS0FJWR23KV9/.gitignore
01JK6GJDA51NCGBS0FJWR23KV9/a/
01JK6GJDA51NCGBS0FJWR23KV9/a/bar
01JK6GJDA51NCGBS0FJWR23KV9/a/foo
01JK6GJDA51NCGBS0FJWR23KV9/b/
01JK6GJDA51NCGBS0FJWR23KV9/b/bar
01JK6GJDA51NCGBS0FJWR23KV9/b/foo

Without --project-root-only from subdir a.

> ~/src/spacectl/spacectl stack local-preview --id test --no-upload
Packing local workspace...
No upload flag was provided, will not create run, saved archive at: /var/folders/3c/1nl1q9816zd66cy4lp5fdxjw0000gn/T/spacectl/local-workspace/01JK6GMXJBHZ5CJ79XS11P1HC2.tar.gz

> tar -tf /var/folders/3c/1nl1q9816zd66cy4lp5fdxjw0000gn/T/spacectl/local-workspace/01JK6GMXJBHZ5CJ79XS11P1HC2.tar.gz
01JK6GMXJBHZ5CJ79XS11P1HC2/
01JK6GMXJBHZ5CJ79XS11P1HC2/.gitignore
01JK6GMXJBHZ5CJ79XS11P1HC2/a/
01JK6GMXJBHZ5CJ79XS11P1HC2/a/bar
01JK6GMXJBHZ5CJ79XS11P1HC2/a/foo
01JK6GMXJBHZ5CJ79XS11P1HC2/b/
01JK6GMXJBHZ5CJ79XS11P1HC2/b/bar
01JK6GMXJBHZ5CJ79XS11P1HC2/b/foo

With --project-root-only from subdir a.

> ~/src/spacectl/spacectl stack local-preview --id test --project-root-only --no-upload
Packing 'a' as local workspace...
No upload flag was provided, will not create run, saved archive at: /var/folders/3c/1nl1q9816zd66cy4lp5fdxjw0000gn/T/spacectl/local-workspace/01JK6GQ99BB9CQXXMJMXRRSW0G.tar.gz

> tar -tf /var/folders/3c/1nl1q9816zd66cy4lp5fdxjw0000gn/T/spacectl/local-workspace/01JK6GQ99BB9CQXXMJMXRRSW0G.tar.gz
01JK6GQ99BB9CQXXMJMXRRSW0G/a/bar
01JK6GQ99BB9CQXXMJMXRRSW0G/a/foo

@tomasmik tomasmik merged commit e838a85 into spacelift-io:main Feb 4, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The --project-root-only option to stack local-preview has no effect.
2 participants