devops-test/Jenkinsfile

56 lines
1.2 KiB
Groovy

pipeline {
agent any
environment {
APP_NAME = 'devops-test'
VERSION = '1.0.0'
}
stages {
stage('Checkout') {
steps {
echo "📦 Cloning repository..."
checkout scm
}
}
stage('Validate') {
steps {
echo "🔍 Validating scripts..."
sh 'ls -la'
sh 'chmod +x app.sh'
sh 'bash -n app.sh' // Syntax check
}
}
stage('Test') {
steps {
echo "🧪 Running tests..."
sh './app.sh'
}
}
stage('Build Info') {
steps {
echo "📊 Build Information:"
echo " App: ${APP_NAME}"
echo " Version: ${VERSION}"
echo " Build: ${BUILD_NUMBER}"
echo " Branch: ${GIT_BRANCH}"
}
}
}
post {
success {
echo "✅ Pipeline completed successfully!"
}
failure {
echo "❌ Pipeline failed!"
}
always {
echo "🏁 Pipeline finished at ${new Date()}"
}
}
}