Skip to content

Commit

Permalink
Merge pull request #43 from manasakoraganji/lip-jenkins
Browse files Browse the repository at this point in the history
Jenkinsfile for CI/CD Integration
  • Loading branch information
karun-singh authored Mar 5, 2024
2 parents 9adc1d8 + 29ddcef commit 0bb9a9b
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
77 changes: 77 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
pipeline {
environment {
devRegistry = 'ghcr.io/datakaveri/lip-dev'
deplRegistry = 'ghcr.io/datakaveri/lip-depl'
registryUri = 'https://ghcr.io'
registryCredential = 'datakaveri-ghcr'
GIT_HASH = GIT_COMMIT.take(7)
}

agent {
node {
label 'slave1'
}
}

stages {
stage('Build images') {
steps {
script {
devImage = docker.build(devRegistry, "-f vertx/docker/dev.dockerfile .")
deplImage = docker.build(deplRegistry, "-f vertx/docker/depl.dockerfile .")
}
}
}
stage('Continuous Deployment') {
when {
allOf {
anyOf {
changeset "vertx/docker/**"
changeset "vertx/docs/**"
changeset "vertx/pom.xml"
changeset "vertx/src/main/**"
triggeredBy cause: 'UserIdCause'
}
expression {
return env.GIT_BRANCH == 'origin/master';
}
}
}
stages {
stage('Push Images') {
steps {
script {
docker.withRegistry( registryUri, registryCredential ) {
devImage.push("5.5.0-alpha-${env.GIT_HASH}")
deplImage.push("5.5.0-alpha-${env.GIT_HASH}")
}
}
}
}
stage('Docker Swarm deployment') {
steps {
script {
sh "ssh azureuser@docker-swarm 'docker service update lip_lip --image ghcr.io/datakaveri/lip-depl:5.5.0-alpha-${env.GIT_HASH}'"
sh 'sleep 10'
}
}
post {
failure {
error "Failed to deploy image in Docker Swarm"
}
}
}
}
post {
failure {
script {
if (env.GIT_BRANCH == 'origin/master') {
emailext recipientProviders: [buildUser(), developers()], to: '$RS_RECIPIENTS, $DEFAULT_RECIPIENTS', subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', body: '''$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
Check console output at $BUILD_URL to view the results.'''
}
}
}
}
}
}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://img.shields.io/jenkins/build?jobUrl=https://jenkins.iudx.io/view/iudx-master/job/iudx%20lip%20(master)%20pipeline/)](https://jenkins.iudx.io/view/iudx-master/job/iudx%20lip%20(master)%20pipeline/lastBuild/)

![IUDX](./images/iudx.png)
# Latest Ingestion Pipeline

Expand Down

0 comments on commit 0bb9a9b

Please sign in to comment.