diff --git a/Jenkinsfile b/Jenkinsfile index 84530c2..80e410d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,28 +1,46 @@ -pipeline { - - agent any - - stages { - - stage('Install Dependencies') { - steps { - sh 'npm install' +pipeline { + agent any + + stages { + stage('Checkout') { + steps { + // Checkout code from the Git repository + script { + checkout scm + } + } } - } - - stage('Test') { - steps { - sh 'echo "testing application..."' + + stage('Build') { + steps { + // Build the project (Replace 'your_build_command' with the actual build command) + script { + sh 'your_build_command' + } + } } - } - - stage("Deploy application") { - steps { - sh 'echo "deploying application..."' - } - - } - - } - - } + + stage('Test') { + steps { + // Run tests (Replace 'your_test_command' with the actual test command) + script { + sh 'your_test_command' + } + } + } + } + + post { + success { + // Actions to be taken if the build is successful + echo 'Build successful! Deploying...' + // Add deployment steps or other post-build actions here + } + + failure { + // Actions to be taken if the build fails + echo 'Build failed! Not deploying.' + // Add failure handling or notifications here + } + } +} diff --git a/README.md b/README.md index 5ac99db..4add87a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Build and Deploy nodejs application on EC2 instance - Freestyle +# Build and Deploy nodejs application on EC2 instance - FreestyleS # Pre-requisites