Using Shell Steps in Jenkins Pipeline
📖 Scenario: You are setting up a Jenkins pipeline to automate simple shell commands. This will help you understand how to run shell scripts inside Jenkins jobs.
🎯 Goal: Build a Jenkins pipeline script that runs shell commands using sh steps on Linux or macOS, and bat steps on Windows agents.
📋 What You'll Learn
Create a Jenkins pipeline script with a
pipeline blockUse a
stage named Setup to run shell commandsUse
sh step to run a Linux/macOS shell commandUse
bat step to run a Windows batch commandPrint the output of the commands in the Jenkins console
💡 Why This Matters
🌍 Real World
Jenkins pipelines automate software builds and deployments by running shell commands on build agents.
💼 Career
Knowing how to use <code>sh</code> and <code>bat</code> steps is essential for DevOps engineers to automate tasks across different operating systems.
Progress0 / 4 steps