Commit ed17da2a authored by Abdullah Khabir's avatar Abdullah Khabir
Browse files

بِسْمِ ٱللّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيم - In the name of Allah SWT, the most...

بِسْمِ ٱللّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيم - In the name of Allah SWT, the most Gracious, the most Merciful.
parents
pipeline {
agent any
environment {
GIT_TAG = '' // Placeholder for the git tag environment variable
DEPLOY_ENV = '' // Target deployment environment
}
stages {
stage('Parse Git Tag') {
steps {
script {
// Extract the git tag from the Git SCM
GIT_TAG = sh(script: "git describe --tags --abbrev=0", returnStdout: true).trim()
echo "Detected Git Tag: ${GIT_TAG}"
// Parse the git tag format
if (GIT_TAG =~ /^(af|ab|abs)-(gcp|pilot)-[0-9]+\.[0-9]+$/) {
DEPLOY_ENV = (GIT_TAG.contains('gcp')) ? 'gcp' : 'pilot'
echo "Parsed Environment: ${DEPLOY_ENV}"
} else {
error("Invalid Git Tag Format: ${GIT_TAG}")
}
}
}
}
stage('Deploy') {
steps {
script {
echo "Deploying to ${DEPLOY_ENV} with Git Tag: ${GIT_TAG}"
// Simulate deployment (replace with actual deployment commands)
if (DEPLOY_ENV == 'gcp') {
echo "Executing GCP Deployment..."
// Add GCP deployment logic here
} else if (DEPLOY_ENV == 'pilot') {
echo "Executing Pilot Deployment..."
// Add Pilot deployment logic here
} else {
error("Unknown Deployment Environment: ${DEPLOY_ENV}")
}
}
}
}
}
post {
always {
echo "Pipeline execution completed."
}
success {
echo "Deployment succeeded!"
}
failure {
echo "Deployment failed."
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment