0
0
Jenkinsdevops~15 mins

Installing suggested plugins in Jenkins - Try It Yourself

Choose your learning style9 modes available
Installing Suggested Plugins in Jenkins
📖 Scenario: You have just installed Jenkins, a tool that helps automate tasks like building and testing software. Jenkins suggests some useful plugins to add extra features. You want to install these suggested plugins to make Jenkins ready for your projects.
🎯 Goal: Learn how to install the suggested plugins in Jenkins using a script. This will help you set up Jenkins quickly and easily without clicking through the web interface.
📋 What You'll Learn
Create a list variable called suggested_plugins with the exact plugin names: git, workflow-aggregator, blueocean
Create a variable called jenkins_cli_command with the exact string to run Jenkins CLI: java -jar jenkins-cli.jar -s http://localhost:8080/
Write a for loop using the variable plugin to iterate over suggested_plugins and print the command to install each plugin
Print the final message All suggested plugins installation commands are ready.
💡 Why This Matters
🌍 Real World
Automating Jenkins plugin installation saves time and avoids manual errors when setting up Jenkins servers.
💼 Career
DevOps engineers often automate Jenkins setup using scripts to ensure consistent environments across teams.
Progress0 / 4 steps
1
Create the list of suggested plugins
Create a list variable called suggested_plugins with these exact plugin names: 'git', 'workflow-aggregator', and 'blueocean'.
Jenkins
Need a hint?

Use square brackets [] to create a list and separate items with commas.

2
Set the Jenkins CLI command variable
Create a variable called jenkins_cli_command and set it to the exact string 'java -jar jenkins-cli.jar -s http://localhost:8080/'.
Jenkins
Need a hint?

Use single quotes to create the string exactly as shown.

3
Generate plugin installation commands
Write a for loop using the variable plugin to iterate over suggested_plugins. Inside the loop, print the command to install each plugin using jenkins_cli_command and the plugin name. The command format is: {jenkins_cli_command} install-plugin {plugin}.
Jenkins
Need a hint?

Use an f-string to combine the command and plugin name inside the print statement.

4
Print the final confirmation message
Print the exact message All suggested plugins installation commands are ready. after the loop.
Jenkins
Need a hint?

Use a print statement with the exact message after the loop.