50 lines
1.4 KiB
Groovy
50 lines
1.4 KiB
Groovy
pipeline {
|
|
agent any
|
|
|
|
environment {
|
|
// Define environment variables
|
|
PROJECT_DIR = 'your_project_directory'
|
|
}
|
|
|
|
stages {
|
|
stage('Build') {
|
|
steps {
|
|
echo 'Building the project...Again but this time by pushing new code'
|
|
// You can add your build tool commands here (e.g., Maven, Gradle, npm)
|
|
sh 'echo "Building project in ${PROJECT_DIR}"'
|
|
}
|
|
}
|
|
|
|
stage('Test') {
|
|
steps {
|
|
echo 'Running tests... Again'
|
|
// Example: Run tests with a test framework (e.g., JUnit, Mocha)
|
|
sh 'echo "Running tests in ${PROJECT_DIR}"'
|
|
}
|
|
}
|
|
|
|
stage('Deploy') {
|
|
steps {
|
|
echo 'Deploying the application... Deployed by Zakaria'
|
|
// Example: You can add your deployment steps (e.g., Docker push, SCP, Kubernetes apply)
|
|
sh 'echo "Deploying project from ${PROJECT_DIR}"'
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
echo 'Cleaning up...'
|
|
// Clean workspace to ensure no leftover files affect future builds
|
|
cleanWs()
|
|
}
|
|
success {
|
|
echo 'Pipeline finished successfully! - Done by Zakaria'
|
|
}
|
|
failure {
|
|
echo 'Pipeline failed.'
|
|
}
|
|
}
|
|
}
|
|
|