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 automation action for plugin_cache.json #819

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

jmartin-tech
Copy link
Collaborator

Maintain the distributed plugin_cache.json via github action preformed on merge of PRs to main.

  • more tolerant cache validation
    • cache rebuild allows for and empty cache file containing only {}
  • new automation action triggered on push to main or manual branch trigger
    • run on push to main
    • only commit when changes are found
    • cancel if a new commit is pushed to same branch including main ( avoids race conditions on cache update )
    • do not commit changes on branch trigger ( only log if changes exist )
    • do not execute when only cache file is updated ( avoids commit loop by automation )

Noted quirks:

  • concurrency limit - workflow cancelled by a new commit will mark the commit as failing automation, the subsequent completion will mark only the last push as passing tests
  • Commit by automation to main does not trigger a full new test run ( metadata only change makes this reasonable )

@jmartin-tech jmartin-tech changed the title add automation action for plugin_cache.json update add automation action for plugin_cache.json Aug 6, 2024
run: |
if [ -f $HOME/.cache/garak/resources/plugin_cache.json ]; then
echo "File updated from user cache"
cp $HOME/.cache/garak/resources/plugin_cache.json $FILE_TO_COMMIT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are user caches something that replaces the package cache rather than augmenting it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package cache is a baseline that is immutable on disk to ensure the user does not need write permissions to the install location. The user file is updated from this baseline when it is newer than the user file and augmented with any updates since the package cache was created. This pattern will allow for custom user local items to be added to the cache when that support is added to the project. The user file is utilized exclusively during runtime. It is much less complex to maintain consistency of single cache file than to merge and override sections.

This automation simply forces the user cache file to be built and checks if it is different from the baseline. If it is those change are what needs to be added to the tree since the build is based on the latest commit to the branch.

@jmartin-tech jmartin-tech merged commit c2c9011 into NVIDIA:main Aug 14, 2024
8 checks passed
@jmartin-tech jmartin-tech deleted the automation/plugin-cache branch August 14, 2024 13:36
@github-actions github-actions bot locked and limited conversation to collaborators Aug 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants