Simple Jenkins Declarative Pipeline
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building the application...'
}
}
stage('Test') {
steps {
echo 'Running tests...'
}
}
stage('Deploy') {
steps {
echo 'Deploying application...'
}
}
}
}
Groovy Script for a Scripted Pipeline
node {
stage('Clone Repository') {
git 'https://github.com/example/repository.git'
}
stage('Build') {
echo 'Building application...'
sh './build.sh'
}
stage('Test') {
echo 'Running tests...'
sh './run_tests.sh'
}
stage('Deploy') {
echo 'Deploying application...'
sh './deploy.sh'
}
}
This script clones a repository, builds the project, runs tests, and deploys it.