fix build maybe
Gitea/homepage/pipeline/head There was a failure building this commit

This commit is contained in:
Georgios Jason Efstathiou
2024-12-26 12:51:24 +01:00
parent c9bd843e88
commit d8497a2f7f
Vendored
+13 -1
View File
@@ -28,7 +28,19 @@ pipeline {
stage('Deploy to Nomad') {
steps {
script {
sh 'curl -X POST -H "Content-Type: application/json" -d @jobspec.json http://nomad.service.consul:4646/v1/jobs'
// Calculate the hash of your Docker image (or your application code)
def imageHash = sh(script: "docker images --no-trunc $IMAGE_NAME | grep latest | awk '{print $3}'", returnStdout: true).trim()
// Read the jobspec.json file
def jobSpec = readJSON file: 'jobspec.json'
// Use jq to add the hash to the jobspec
def updatedJobSpec = sh(script: "jq '.meta[\"image_hash\"] = \"$imageHash\"' jobspec.json", returnStdout: true).trim()
// Write the updated jobspec back to the file
def updatedJobSpec = sh(script: "jq '.meta[\"image_hash\"] = \"$imageHash\"' jobspec.json", returnStdout: true).trim()
sh 'curl -X POST -H "Content-Type: application/json" -d "$updatedJobSpec" http://nomad.service.consul:4646/v1/jobs'
}
}
}