A hook is a distinct PowerShell script located in the .qopshooks\ folder that runs before and/or after the execution of QOps commands.
Since version 1.14
The parameters of a QOps command or its results can be utilized within hooks using the $args[0] declaration. This encapsulates all available input parameters or results as a PowerShell object. If the QOps command iterates through a set of objects (applications, extensions, tasks, etc.), a hook could be executed before or after processing each object in the loop.
Supported hooks:
beforeBuild.ps1 | afterBuild.ps1 | beforeEachBuild.ps1 | afterEachBuild.ps1 |
beforePrepare.ps1 | afterPrepare.ps1 | beforeEachPrepare.ps1 | afterEachPrepare.ps1 |
beforePublish.ps1 | afterPublish.ps1 | beforeEachPublish.ps1 | afterEachPublish.ps1 |
beforeRelease.ps1 | afterRelease.ps1 | beforeEachRelease.ps1 | afterEachRelease.ps1 |
beforeBuildCustomProperties.ps1 | afterBuildCustomProperties.ps1 | beforeEachBuildCustomProperties.ps1 | afterEachBuildCustomProperties.ps1 |
beforeBuildDataConnections.ps1 | afterBuildDataConnections.ps1 | beforeEachBuildDataConnections.ps1 | afterEachBuildDataConnections.ps1 |
beforeBuildExtensions.ps1 | afterBuildExtensions.ps1 | beforeEachBuildExtensions.ps1 | afterEachBuildExtensions.ps1 |
beforeBuildTags.ps1 | afterBuildTags.ps1 | beforeEachBuildTags.ps1 | afterEachBuildTags.ps1 |
beforeCommit.ps1 | afterCommit.ps1 | beforeEachCommit.ps1 | afterEachCommit.ps1 |
beforePull.ps1 | afterPull.ps1 | beforeEachPull.ps1 | afterEachPull.ps1 |
beforePush.ps1 | afterPush.ps1 | beforeEachPush.ps1 | afterEachPush.ps1 |
beforeExportQVF.ps1 | afterExportQVF.ps1 | beforeEachExportQVF.ps1 | afterEachExportQVF.ps1 |
beforeImportQVF.ps1 | afterImportQVF.ps1 | beforeEachImportQVF.ps1 | afterEachImportQVF.ps1 |
beforePrepareCustomProperties.ps1 | afterPrepareCustomProperties.ps1 | beforeEachPrepareCustomProperties.ps1 | afterEachPrepareCustomProperties.ps1 |
beforePrepareDataConnections.ps1 | afterPrepareDataConnections.ps1 | beforeEachPrepareDataConnections.ps1 | afterEachPrepareDataConnections.ps1 |
beforePrepareExtensions.ps1 | afterPrepareExtensions.ps1 | beforeEachPrepareExtensions.ps1 | afterEachPrepareExtensions.ps1 |
beforePrepareTags.ps1 | afterPrepareTags.ps1 | beforeEachPrepareTags.ps1 | afterEachPrepareTags.ps1 |
beforeReload.ps1 | afterReload.ps1 | beforeEachReload.ps1 | afterEachReload.ps1 |
beforeRemoveApps.ps1 | afterRemoveApps.ps1 | beforeEachRemoveApps.ps1 | afterEachRemoveApps.ps1 |
beforeTriggerTasks.ps1 | afterTriggerTasks.ps1 | beforeEachTriggerTasks.ps1 | afterEachTriggerTasks.ps1 |
beforeBuildTasks.ps1 | afterBuildTasks.ps1 | beforeEachBuildTasks.ps1 | afterEachBuildTasks.ps1 |
beforePrepareTasks.ps1 | afterPrepareTasks.ps1 | beforeEachPrepareTasks.ps1 | afterEachPrepareTasks.ps1 |
beforeRenameExtension.ps1 | afterRenameExtension.ps1 |
Example
Download, edit and copy this file to .qopshooks\ folder in the repository
Write-Host "=====This is beforeEachPrepareExtensions hook start======"
Write-Host "Available parameters"
$params = $args[0]
$params | Format-Table | Out-String | Write-Host
Write-Host "Processing $($params.Name)"
Write-Host "=====This is beforeEachPrepareExtensions hook end======="
Then execute QOps command
QOps-PrepareExtensions -Filter "Name=Vizlib*"