Skip to content

Instantly share code, notes, and snippets.

@imoutsatsos
Created February 2, 2023 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imoutsatsos/123a23333c632ff19797e8cc376a39a1 to your computer and use it in GitHub Desktop.
Save imoutsatsos/123a23333c632ff19797e8cc376a39a1 to your computer and use it in GitHub Desktop.
PowerShell script uses jenkins-cli to install multiple Jenkins plugins
#An example PowerShell build step of how to use jenkins-cli to install multiple Jenkins plugins
$condition = 'true'
$setupBase='D:\SERVER_SETUP\JENKINS' #Path to jenkins-cli.jar file
# A space separated list of Jenkins plugins to install, using their short names
$missing= 'jenkins-multijob-plugin parameterized-trigger' -split ' '
$USER_NAME='ioannis'
$JENKINS_API_TOKEN='blahblah'
if ( $condition -like 'true' )
{
Write-Output "Build will try to install Missing Plugins"
java -jar $setupBase\jenkins-cli.jar -s $JENKINS_URL -auth $USER_NAME:$JENKINS_API_TOKEN install-plugin $missing
}else{
Write-Output "Please, install required plugins manually"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment