Update Jenkinsfile

This commit is contained in:
2025-05-27 15:39:45 +03:00
parent cb5b38d920
commit 78e4d6b39c

24
Jenkinsfile vendored
View File

@@ -16,30 +16,6 @@ pipeline {
} }
} }
} }
stage('Check First Pipeline Status') {
steps {
script {
def jobName = "custom-dind-pipeline"
def jobURL = "http://jenkins-server.default.svc.cluster.local:8080/job/${jobName}/api/json"
// Fetch the raw JSON response
def response = sh(script: "curl -s ${jobURL}", returnStdout: true).trim()
// Parse JSON using Groovy's built-in JSON handling
def jsonSlurper = new groovy.json.JsonSlurper()
def jobData = jsonSlurper.parseText(response)
// Extract the first build number to check if the job has run at least once
def firstBuildNumber = jobData.firstBuild?.number
if (firstBuildNumber == null) {
error("Pipeline '${jobName}' has **never** run! Stopping execution.")
}
echo "Pipeline '${jobName}' has executed before. First build number: ${firstBuildNumber}"
}
}
}
stage('Build and Deploy') { stage('Build and Deploy') {
steps { steps {
script { script {