Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #21

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 19 additions & 22 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
pipeline {
pipeline{

agent any

tools{
maven 'maven_3_5_0'
maven 'maven3.8'
}

stages{

stage('Build Maven'){
steps{
checkout([$class: 'GitSCM', branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/Java-Techie-jt/devops-automation']]])
sh 'mvn clean install'
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/BilalHaiderRizvi/devops-automation']])
bat 'mvn clean install'
}
}
stage('Build docker image'){

stage('Build Docker Image'){
steps{
script{
sh 'docker build -t javatechie/devops-integration .'
bat 'docker build -t haiderbilal/devops-integration .'
}
}
}
stage('Push image to Hub'){
steps{
script{
withCredentials([string(credentialsId: 'dockerhub-pwd', variable: 'dockerhubpwd')]) {
sh 'docker login -u javatechie -p ${dockerhubpwd}'

}
sh 'docker push javatechie/devops-integration'
}
}
}
stage('Deploy to k8s'){
steps{
script{
kubernetesDeploy (configs: 'deploymentservice.yaml',kubeconfigId: 'k8sconfigpwd')

stage('Push Image To DockerHub'){
steps {
withCredentials([usernamePassword(credentialsId: 'docker-hub', usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) {
bat 'docker login -u %DOCKER_USERNAME% -p %DOCKER_PASSWORD%'
}
bat 'docker push haiderbilal/devops-integration:latest'

}
}
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# devops-automation
# CI/CD pipeline project
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class DevopsIntegrationApplication {

@GetMapping
public String message(){
return "welcome to javatechie";
return "welcome to Miftha";
}

public static void main(String[] args) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ management:
include:
- "*"
server:
port: 8081
port: 8080