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

Plugins that run before/after each package #17

Open
pauby opened this issue Oct 31, 2022 · 0 comments
Open

Plugins that run before/after each package #17

pauby opened this issue Oct 31, 2022 · 0 comments
Labels
Improvement Issues that enhances existing functionality, or adds new features

Comments

@pauby
Copy link
Member

pauby commented Oct 31, 2022

Currently AU plugins run at the end and there is a single BeforeAfter script that can be set in updateall options.

It should be possible to define plugins that run before/after each package in the same way. AU can known which plugin to run at the end and which in between based on plugin file system location.

This would allow for creation of more interesting plugins:

  • Attribute setter
    Define what package attributes are automatically set - very useful for setting package source url, icon url, adding user among maintainers etc. With it migration of packages between AU repositories would be true file copy.
  • Guideliness checker
    Could be run to check powershell style etc.
  • Deleyer
    #94 could be done as this type of plugin that would save latest version in a file and wait for delay to pass
  • VirusTotal
    #84 can be done as plugin.
  • Grammar
    Can be used to automatically check for spelling errors.

Details

  • Plugin would need to get [AUPackage]. It could determine if its invocation is before or after package update based on its fields.
  • Plugin should have an option to get output of previous plugin that did run on package
  • Plugin should have an option to reference stuff
  • Plugins could be run only in updateall context. update should never support them as updateall can be used to run single package.
  • Global before/after scripts should run before/after all plugins.
  • Files used by plugins should be saved by git plugin automatically (and streams json along the way).

Example

AttributeSetter = @{
   packageSourceUrl = { 'https://github.../$this_repo/automatic/$Name' }
   owners  = { 'chocolatey, ' + ($owners -replace 'chocolatey,?' }
   description = { $description + "`n`nAutomatic package by majkinetor" }
}

MetadataChecker = @{
    Tags = { Compare-Object $mandatory_tags ($Tags -split ' ') ... }
    licenseUrl = $true      
    files = { if (ls $Package.Path VERIFICATION) { $files -contains 'legal' } }
}

Ignorant = @{
     err      = 60    # rise ignored to error after 60 days
     'clover' = 'Disabled due virustotal results'
     'pkg'    = 'Disabled due to no maintainers'
}

Deleyer    = @{ 
     '*' = 2           # 2 days latency for all packages
     clover = 14  # specific package latency
}
VirusTotal = @{ Threshold = 5 #report errors after this many positives }
Enforcer = @{ForcedPackages = $ForcedPackages}  

/cc @AdmiringWorm

Issue migrated from majkinetor/au#116

@pauby pauby added the Improvement Issues that enhances existing functionality, or adds new features label Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Issues that enhances existing functionality, or adds new features
Projects
None yet
Development

No branches or pull requests

1 participant