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

Microservice k8s app cicd projects #21

Draft
wants to merge 69 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
a409f2e
added fluentd branch and README
mbandiaak Apr 21, 2023
c7a1bb6
added docs branch and fdarch
mbandiaak Apr 21, 2023
28a89a3
added images for Arch
mbandiaak Apr 21, 2023
0820bea
added pipeline docs
mbandiaak Apr 24, 2023
e886931
added pipeline docs
mbandiaak Apr 24, 2023
2e00171
added pipeline docs
mbandiaak Apr 24, 2023
1ef0964
added pipeline docs
mbandiaak Apr 24, 2023
422ae08
updated docs
mbandiaak Apr 24, 2023
73dfd49
updated docs
mbandiaak Apr 24, 2023
717d502
updated docs
mbandiaak Apr 24, 2023
2bf7f06
Add files via upload
awanmbandi Apr 24, 2023
91b85a4
Add files via upload
awanmbandi Apr 24, 2023
b30b22c
Add files via upload
awanmbandi Apr 24, 2023
7c952d6
Add files via upload
awanmbandi Apr 24, 2023
062aa34
Add files via upload
awanmbandi Apr 24, 2023
fcd4925
Add files via upload
awanmbandi Apr 24, 2023
46d2154
Add files via upload
awanmbandi Apr 24, 2023
dcf3403
Add files via upload
awanmbandi Apr 24, 2023
1a29d16
Add files via upload
awanmbandi Apr 24, 2023
a631829
Add files via upload
awanmbandi Apr 24, 2023
1fd170c
Add files via upload
awanmbandi Apr 24, 2023
3c46b2f
Add files via upload
awanmbandi Apr 24, 2023
325ebea
Add files via upload
awanmbandi Apr 24, 2023
238bb70
Add files via upload
awanmbandi Apr 25, 2023
7da5096
Add files via upload
awanmbandi Apr 26, 2023
45bf230
Add files via upload
awanmbandi Apr 26, 2023
8bf60b6
Add files via upload
awanmbandi Apr 26, 2023
e841590
Add files via upload
awanmbandi Apr 26, 2023
c404d4e
Add files via upload
awanmbandi Apr 26, 2023
285f19a
Add files via upload
awanmbandi Apr 26, 2023
a399fe5
Add files via upload
awanmbandi Apr 26, 2023
c8d2a31
Add files via upload
awanmbandi Apr 26, 2023
fa0299f
Add files via upload
awanmbandi Apr 26, 2023
1f0efb3
Add files via upload
awanmbandi Apr 26, 2023
d7584ed
Add files via upload
awanmbandi Apr 27, 2023
a3ead50
Add files via upload
awanmbandi Apr 27, 2023
bf7fac8
Add files via upload
awanmbandi Apr 27, 2023
4a334da
Add files via upload
awanmbandi Apr 27, 2023
3153159
Add files via upload
awanmbandi Apr 27, 2023
1f6ac2f
Add files via upload
awanmbandi Apr 27, 2023
036f676
Add files via upload
awanmbandi Apr 27, 2023
0838599
Add files via upload
awanmbandi Apr 27, 2023
1f35c2a
Add files via upload
awanmbandi Apr 27, 2023
40e010f
Add files via upload
awanmbandi Apr 27, 2023
94723c0
Add files via upload
awanmbandi Apr 27, 2023
a6ce349
Add files via upload
awanmbandi Apr 27, 2023
e657a77
Add files via upload
awanmbandi Apr 27, 2023
0a40a3a
Add files via upload
awanmbandi Apr 28, 2023
d1414c6
Add files via upload
awanmbandi Apr 28, 2023
c8d28b6
Add files via upload
awanmbandi Apr 28, 2023
a341aab
Add files via upload
awanmbandi Apr 28, 2023
3952f76
Add files via upload
awanmbandi Apr 28, 2023
92fc305
Add files via upload
awanmbandi Apr 30, 2023
9a758eb
Add files via upload
awanmbandi Apr 30, 2023
b56dfaf
Add files via upload
awanmbandi Apr 30, 2023
564ebed
Add files via upload
awanmbandi Apr 30, 2023
df0aaab
Add files via upload
awanmbandi Apr 30, 2023
5af3a61
Add files via upload
awanmbandi Apr 30, 2023
3b22d43
Update zdocs README.md
awanmbandi May 19, 2023
dfb9ddf
Add files via upload
awanmbandi Jun 27, 2023
0489769
Add files via upload
awanmbandi Jun 28, 2023
f3ba202
Add files via upload
awanmbandi Jun 28, 2023
5eaf84c
Add files via upload
awanmbandi Jun 28, 2023
1bbe458
Add files via upload
awanmbandi Jul 1, 2023
eea1d81
updated profile readme
mbandiaak Jul 1, 2023
a3d3ff6
Add files via upload
awanmbandi Jul 1, 2023
9b09077
Add files via upload
awanmbandi Jul 3, 2023
bbe5c73
Add files via upload
awanmbandi Jul 25, 2023
31ae929
added project configurations and src code
awanmbandi Aug 7, 2023
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
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Create Custom Docker Image
# Pull tomcat latest image from dockerhub
FROM tomcat:latest

# Maintainer
MAINTAINER "PR Reddy - iwayQ"

# copy war file on to container
COPY ./iwayq.war /usr/local/tomcat/webapps
219 changes: 124 additions & 95 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,109 +1,138 @@
def COLOR_MAP = [
'SUCCESS': 'good',
'FAILURE': 'danger',
]
pipeline {
agent any
environment {
WORKSPACE = "${env.WORKSPACE}"
}
tools {
maven 'localMaven'
jdk 'localJdk'

maven 'maven'

}
stages {
stage('Build') {
steps {
sh 'mvn clean package'
}
post {
success {
echo ' now Archiving '
archiveArtifacts artifacts: '**/*.war'
}
}
}
stage('Unit Test'){
stages {

stage ('Checkout SCM'){
steps {
sh 'mvn test'
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'git', url: 'https://[email protected]/iwayqtech/devops-pipeline-project.git']]])
}
}
stage('Integration Test'){
steps {
sh 'mvn verify -DskipUnitTests'
}

stage ('Build') {
steps {

dir('java-source'){
sh "mvn package"
}
}
}
stage ('Checkstyle Code Analysis'){

}

stage ('SonarQube Analysis') {
steps {
sh 'mvn checkstyle:checkstyle'
}
post {
success {
echo 'Generated Analysis Result'
withSonarQubeEnv('sonar') {

dir('java-source'){
sh 'mvn -U clean install sonar:sonar'
}

}
}
}
}
stage('SonarQube Scan') {
steps {
sh """mvn sonar:sonar \
-Dsonar.projectKey=JavaWebApp \
-Dsonar.host.url=http://172.31.4.143:9000 \
-Dsonar.login=e9733df3fcd6ed54cef307d8ac4cc00eeb2d3611"""
}
}
// stage('Quality Gate') {
// steps {
// waitForQualityGate abortPipeline: true
// }
// }
stage('Upload to Artifactory') {
steps {
sh "mvn clean deploy -DskipTests"
}
}
stage('Deploy to DEV') {
environment {
HOSTS = "dev"
}
steps {
sh "ansible-playbook ${WORKSPACE}/deploy.yaml --extra-vars \"hosts=$HOSTS workspace_path=$WORKSPACE\""
}
}
// stage('Approval for stage') {
// steps {
// input('Do you want to proceed?')
// }
// }
stage('Deploy to Stage') {
environment {
HOSTS = "stage" // Make sure to update to "stage"
}
steps {
sh "ansible-playbook ${WORKSPACE}/deploy.yaml --extra-vars \"hosts=$HOSTS workspace_path=$WORKSPACE\""
}
}
stage('Approval') {
steps {
input('Do you want to proceed?')
}

stage ('Artifactory configuration') {
steps {
rtServer (
id: "jfrog",
url: "http://18.207.136.250:8082/artifactory",
credentialsId: "jfrog"
)

rtMavenDeployer (
id: "MAVEN_DEPLOYER",
serverId: "jfrog",
releaseRepo: "iwayq-libs-release-local",
snapshotRepo: "iwayq-libs-snapshot-local"
)

rtMavenResolver (
id: "MAVEN_RESOLVER",
serverId: "jfrog",
releaseRepo: "iwayq-libs-release",
snapshotRepo: "iwayq-libs-snapshot"
)
}
}
stage('Deploy to PROD') {
environment {
HOSTS = "prod"
}
steps {
sh "ansible-playbook ${WORKSPACE}/deploy.yaml --extra-vars \"hosts=$HOSTS workspace_path=$WORKSPACE\""
}

stage ('Deploy Artifacts') {
steps {
rtMavenRun (
tool: "maven", // Tool name from Jenkins configuration
pom: 'java-source/pom.xml',
goals: 'clean install',
deployerId: "MAVEN_DEPLOYER",
resolverId: "MAVEN_RESOLVER"
)
}
}
}
post {
always {
echo 'Slack Notifications.'
slackSend channel: '#mbandi-jenkins-cicd-pipeline-alerts', //update and provide your channel name
color: COLOR_MAP[currentBuild.currentResult],
message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}"

stage ('Publish build info') {
steps {
rtPublishBuildInfo (
serverId: "jfrog"
)
}
}
}
}

//slackSend channel: '#mbandi-cloudformation-cicd', message: "Please find the pipeline status of the following ${env.JOB_NAME ${env.BUILD_NUMBER} ${env.BUILD_URL}"
stage('Copy Dockerfile & Playbook to Ansible Server') {

steps {
sshagent(['sshkey']) {

sh "scp -o StrictHostKeyChecking=no Dockerfile [email protected]:/home/ec2-user"
sh "scp -o StrictHostKeyChecking=no create-container-image.yaml [email protected]:/home/ec2-user"
}
}

}
stage('Build Container Image') {

steps {
sshagent(['sshkey']) {

sh "ssh -o StrictHostKeyChecking=no [email protected] -C \"sudo ansible-playbook create-container-image.yaml\""

}
}

}
stage('Copy Deployent & Service Defination to K8s Master') {

steps {
sshagent(['sshkey']) {

sh "scp -o StrictHostKeyChecking=no create-k8s-deployment.yaml [email protected]:/home/ec2-user"
sh "scp -o StrictHostKeyChecking=no nodePort.yaml [email protected]:/home/ec2-user"
}
}

}

stage('Waiting for Approvals') {

steps{

input('Test Completed ? Please provide Approvals for Prod Release ?')
}

}
stage('Deploy Artifacts to Production') {

steps {
sshagent(['sshkey']) {

sh "ssh -o StrictHostKeyChecking=no [email protected] -C \"sudo kubectl apply -f create-k8s-deployment.yaml\""
sh "ssh -o StrictHostKeyChecking=no [email protected] -C \"sudo kubectl apply -f nodePort.yaml\""

}
}

}

}
}
Loading