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

Add support for specifying a file path via -f/--file when loading buildspec into cache #1808

Merged
merged 8 commits into from
Aug 16, 2024

Conversation

shahzebsiddiqui
Copy link
Member

@shahzebsiddiqui shahzebsiddiqui commented Aug 15, 2024

We have added support for command buildtest buildspec find -f <file> to enable buildtest to update buildspec cache with file path

motivation

Current support was limited to directory when building buildspec cache such that user must specify all buildspec files (.yml) in a directory. If one wants to add a few files into the buildspec cache that was not possible.

Shown below is an example usage, we can see that buildtest will load files tutorials/vars.yml and tutorials/sleep.yml into the buildspec cache. Buildtest will ignore files that dont exist like tutorials/x.yml

⚡   buildtest bc find -d general_tests/configuration -f tutorials/vars.yml -f tutorials/sleep.yml -f tutorials/x.yml
Path: /Users/siddiq90/Documents/buildtest/tutorials/x.yml does not exist!
Clearing cache file: /Users/siddiq90/Documents/buildtest/var/buildspecs/cache.json
Buildspec Paths: ['/Users/siddiq90/Documents/buildtest/general_tests/configuration']
Updating buildspec cache file: /Users/siddiq90/Documents/buildtest/var/buildspecs/cache.json
                                 Buildspec Cache: /Users/siddiq90/Documents/buildtest/var/buildspecs/cache.json                                  
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ name                         ┃ type   ┃ executor           ┃ tags               ┃ description                                                 ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ root_disk_usage              │ script │ generic.local.bash │ filesystem storage │ Check root disk usage and report if it exceeds threshold    │
│ kernel_swapusage             │ script │ generic.local.bash │ configuration      │ Retrieve Kernel Swap Usage                                  │
│ systemd_default_target       │ script │ generic.local.bash │ system             │ check if default target is multi-user.target                │
│ ulimit_filelock_unlimited    │ script │ generic.local.bash │ system             │ Check if file lock is set to unlimited in ulimits           │
│ ulimit_cputime_unlimited     │ script │ generic.local.bash │ system             │ Check if cputime is set to unlimited in ulimits             │
│ ulimit_stacksize_unlimited   │ script │ generic.local.bash │ system             │ Check if stack size is set to unlimited in ulimits          │
│ ulimit_vmsize_unlimited      │ script │ generic.local.bash │ system             │ Check virtual memory size and check if its set to unlimited │
│ ulimit_filedescriptor_4096   │ script │ generic.local.bash │ system             │ Check if open file descriptors limit is set to 4096         │
│ ulimit_max_user_process_2048 │ script │ generic.local.bash │ system             │ Check max number of user process limit is set to 2048       │
│ variables_bash               │ script │ generic.local.bash │ tutorials          │ Declare shell variables in bash                             │
│ sleep                        │ script │ generic.local.bash │ tutorials          │ sleep 2 seconds                                             │
└──────────────────────────────┴────────┴────────────────────┴────────────────────┴─────────────────────────────────────────────────────────────┘

⚡  buildtest bc find -b                                                                                            
                                      List of Buildspecs                                      
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Buildspecs                                                                                 ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ /Users/siddiq90/Documents/buildtest/general_tests/configuration/disk_usage.yml             │
│ /Users/siddiq90/Documents/buildtest/general_tests/configuration/kernel_state.yml           │
│ /Users/siddiq90/Documents/buildtest/general_tests/configuration/systemd-default-target.yml │
│ /Users/siddiq90/Documents/buildtest/general_tests/configuration/ulimits.yml                │
│ /Users/siddiq90/Documents/buildtest/tutorials/vars.yml                                     │
│ /Users/siddiq90/Documents/buildtest/tutorials/sleep.yml                                    │
└────────────────────────────────────────────────────────────────────────────────────────────┘

…o add

into buildspec cache instead of just --directory option which will recursively add all
files in a directory.

The file must be valid and must exist on file system and end with .yml extension to be added into the
cache
@pull-request-size pull-request-size bot added size/L and removed size/M labels Aug 15, 2024
@shahzebsiddiqui shahzebsiddiqui merged commit 0804a13 into devel Aug 16, 2024
35 of 39 checks passed
@shahzebsiddiqui shahzebsiddiqui deleted the specify_file_to_add_to_buildspec_cache branch August 16, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant