build fixed, deploy job done

This commit is contained in:
moleksiienko 2025-01-14 00:04:42 +02:00
parent 99c2d18bc3
commit de98afcd93
2 changed files with 26 additions and 5 deletions

View file

@ -1,11 +1,11 @@
pipeline {
agent any
// triggers {
// pollSCM('H/5 * * * *') // Watches the `dev` branch
// }
triggers {
pollSCM('H/5 * * * *') // Watches the `dev` branch
}
environment {
DOCKERHUB_CREDENTIALS = credentials('nalexxgd_docker_pass')
DOCKERHUB_USERNAME = "nalexxgd"
DOCKERHUB_CREDENTIALS = credentials('nalexx6_docker_pass')
DOCKERHUB_USERNAME = "nalexx6"
NEXUS_URL = 'localhost:8081'
def ARTIFACT_VERSION = sh(script: "mvn help:evaluate -Dexpression=project.version -q -DforceStdout", returnStdout: true).trim()

View file

@ -0,0 +1,21 @@
pipeline {
agent any
parameters {
string(name: 'ARTIFACT_VERSION', description: 'Version of the artifact to deploy')
}
environment {
DOCKERHUB_USERNAME = "nalexx6"
}
stages {
stage('Pull Docker Image') {
steps {
sh "docker pull ${DOCKERHUB_USERNAME}/petclinic:${ARTIFACT_VERSION}"
}
}
stage('Run Docker Container') {
steps {
sh "docker run -d -p 80:8080 ${DOCKERHUB_USERNAME}/petclinic:${ARTIFACT_VERSION}"
}
}
}
}