Jenkins- PowerShell include global config
We have a PowerShell-script that will be referenced in many jobs at Jenkins.e.g. Retrieving a DataTable from the database.
It will hard to maintain if this script in individual jobs. For this issue, I found a plugin can solve it
How to setup
1.Install plugin-Managed Scripts
2.Jenkins Management,Enter the link of Managed files.
3.Add a new Config
- Name:For identification。
- Content:Execute Script
Way to use
1.Including the config which we just add it before.,Target:Output folder
2.Executing Power Shell
Import-Module the config file in the output folder and call its function to get the count of records by SQL
Reference
Managed Script Plugin
Power Shell Sql Query