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 #6

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
34ef186
Update pom.xml
keshavkummari Sep 1, 2018
fd2f131
Update JenkinsFile
keshavkummari Sep 1, 2018
c8f1ea8
Update JenkinsFile
keshavkummari Sep 7, 2018
9eb9486
Update pom.xml
keshavkummari Sep 7, 2018
7b0a03d
Update JenkinsFile
keshavkummari Sep 21, 2018
c76e1b7
Update pom.xml
keshavkummari Sep 21, 2018
d605af0
Update JenkinsFile
keshavkummari Oct 16, 2018
24124b7
Update pom.xml
keshavkummari Oct 16, 2018
313a378
Update pom.xml
keshavkummari Nov 4, 2018
c905164
Update JenkinsFile
keshavkummari Nov 4, 2018
3751278
Update pom.xml
keshavkummari Feb 16, 2019
559b93e
Update JenkinsFile
keshavkummari Jun 6, 2020
d3ca9ea
Update pom.xml
keshavkummari Dec 7, 2021
71aecb4
Update pom.xml
keshavkummari Dec 8, 2021
2031aea
Update pom.xml
keshavkummari Dec 8, 2021
244d85f
Update pom.xml
keshavkummari Dec 9, 2021
34f0e09
Update pom.xml
keshavkummari Dec 10, 2021
8a4ea54
Update pom.xml
keshavkummari Dec 10, 2021
0b219eb
Update pom.xml
keshavkummari Dec 14, 2021
be69030
Update pom.xml
keshavkummari Dec 14, 2021
623a9a9
Update pom.xml
keshavkummari Dec 14, 2021
22e87ba
Update pom.xml
keshavkummari Dec 14, 2021
4075eeb
Create buildspec.yml
keshavkummari Dec 20, 2021
b0299d4
Update buildspec.yml
keshavkummari Dec 20, 2021
aff9bf2
Update buildspec.yml
keshavkummari Dec 20, 2021
4229f72
Update buildspec.yml
keshavkummari Dec 20, 2021
b72162f
Update buildspec.yml
keshavkummari Dec 20, 2021
805a532
Update buildspec.yml
keshavkummari Dec 20, 2021
d188a8b
Update buildspec.yml
keshavkummari Dec 20, 2021
bfa403c
Update buildspec.yml
keshavkummari Dec 20, 2021
0586cc9
Update buildspec.yml
keshavkummari Dec 20, 2021
7e2a2aa
Update buildspec.yml
keshavkummari Dec 20, 2021
346c02b
Create jenkinsFile
keshavkummari Dec 20, 2021
7561dd9
Update jenkinsFile
keshavkummari Dec 20, 2021
74c6ee0
Update jenkinsFile
keshavkummari Dec 20, 2021
c931ef0
Update jenkinsFile
keshavkummari Dec 20, 2021
175aba3
Update jenkinsFile
keshavkummari Dec 20, 2021
0b5f43c
Update jenkinsFile
keshavkummari Dec 20, 2021
d8f1446
Update jenkinsFile
keshavkummari Dec 20, 2021
137f93b
Update jenkinsFile
keshavkummari Dec 20, 2021
b69e806
Update jenkinsFile
keshavkummari Dec 20, 2021
8932bce
Update jenkinsFile
keshavkummari Dec 20, 2021
6825970
Update jenkinsFile
keshavkummari Dec 20, 2021
3441b49
Update pom.xml
keshavkummari Dec 20, 2021
094c728
Update jenkinsFile
keshavkummari Dec 20, 2021
1f22ebf
Update pom.xml
keshavkummari Dec 20, 2021
d4937f4
Update jenkinsFile
keshavkummari Dec 20, 2021
1c430d6
Create JENKINSFILE
keshavkummari Dec 20, 2021
7c153f0
Update pom.xml
keshavkummari Dec 20, 2021
de93dc2
Update buildspec.yml
keshavkummari Dec 20, 2021
37fff6e
Update buildspec.yml
keshavkummari Dec 20, 2021
b8fc75b
Update buildspec.yml
keshavkummari Dec 20, 2021
e9b5f21
Update buildspec.yml
keshavkummari Dec 20, 2021
e2cc479
Update buildspec.yml
keshavkummari Dec 20, 2021
e96be63
Create packer-buildspec.yml
keshavkummari Dec 20, 2021
2d3d132
Update packer-buildspec.yml
keshavkummari Dec 20, 2021
c211ec0
Create packer.json
keshavkummari Dec 20, 2021
d643f7f
Update packer-buildspec.yml
keshavkummari Dec 20, 2021
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
29 changes: 29 additions & 0 deletions JENKINSFILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pipeline {
agent any
tools {
maven 'maven'
jdk 'java'
}
stages {
stage('Stage-1 : Static Code Quality Using SonarQube') {
steps {
sh 'mvn sonar:sonar'
}
}
stage('Stage-2 : Build & Push Artifact unto Artifactory manager') {
steps {
sh 'mvn clean validate compile test install verify package deploy -DskipTests'
}
}
stage('Stage-3 : Deployment - Deploy a Artifact devops-2.0.0-SNAPSHOT.war file to Tomcat Server') {
steps {
sh 'curl -u admin:redhat@123 -T target/**.war "http://54.146.36.84:8080/manager/text/deploy?path=/devops&update=true"'
}
}
stage('Stage-4 : SmokeTest') {
steps {
sh 'curl --retry-delay 10 --retry 5 "http://54.146.36.84:8080/devops"'
}
}
}
}
4 changes: 2 additions & 2 deletions JenkinsFile
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ node {
}
}
stage('Deploy') {
sh 'curl -u admin:redhat@123 -T target/**.war "http://52.91.244.245:8080/manager/text/deploy?path=/devops&update=true"'
sh 'curl -u admin:redhat@123 -T target/**.war "http://13.233.138.132:8060/manager/text/deploy?path=/devops&update=true"'
}
stage("Smoke Test"){
sh "curl --retry-delay 10 --retry 5 http://52.91.244.245:8080/devops"
sh "curl --retry-delay 10 --retry 5 http://13.233.138.132:8060/devops"
}
stage('Artifacts') {
if (isUnix()) {
Expand Down
21 changes: 21 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 0.2
phases:
install:
runtime-versions:
java: corretto11
pre_build:
commands:
- cd src/main/resources/static
- cd $CODEBUILD_SRC_DIR
#- mvn sonar:sonar
- mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=kk-java -DskipTests
build:
commands:
- echo Build started on `date`
post_build:
commands:
- mvn package -DskipTests
- echo Build completed on `date`
artifacts:
files:
- '**/*'
66 changes: 66 additions & 0 deletions jenkinsFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
pipeline {
agent any
tools {
maven 'maven'
jdk 'java'
}
stages {
/*
stage('Stage-0 : Static Code Quality Using SonarQube') {
steps {
sh 'mvn sonar:sonar'
}
}
stage('Stage-1 : Clean') {
steps {
sh 'mvn clean'
}
}
stage('Stage-2 : Validate') {
steps {
sh 'mvn validate'
}
}
stage('Stage-3 : Compile') {
steps {
sh 'mvn compile'
}
}
stage('Stage-4 : Test') {
steps {
sh 'mvn test -DskipTests'
}
}
stage('Stage-5 : Install') {
steps {
sh 'mvn install -DskipTests'
}
}
stage('Stage-6 : Verify') {
steps {
sh 'mvn verify -DskipTests'
}
}
stage('Stage-7 : Package') {
steps {
sh 'mvn package -DskipTests'
}
}
stage('Stage-8 : Deploy an Artifact to Artifactory Manager i.e. Nexus/Jfrog') {
steps {
sh 'mvn deploy -DskipTests'
}
}
stage('Stage-9 : Deployment - Deploy a Artifact devops-2.0.0-SNAPSHOT.war file to Tomcat Server') {
steps {
sh 'curl -u admin:redhat@123 -T target/**.war "http://54.146.36.84:8080/manager/text/deploy?path=/devops&update=true"'
}
}
*/
stage('Stage-10 : SmokeTest') {
steps {
sh 'curl --retry-delay 10 --retry 5 "http://54.146.36.84:8080/devops"'
}
}
}
}
28 changes: 28 additions & 0 deletions packer-buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: 0.2

phases:
pre_build:
commands:
- echo "Installing HashiCorp Packer..."
- curl -qL -o packer.zip https://releases.hashicorp.com/packer/0.12.3/packer_0.12.3_linux_amd64.zip && unzip packer.zip
- echo "Installing jq..."
- curl -qL -o jq https://stedolan.github.io/jq/download/linux64/jq && chmod +x ./jq
- mv packer /usr/local/bin
- mv jq /usr/local/bin
- pwd
- ls -ltr $CODEBUILD_SRC_DIR
- cd $CODEBUILD_SRC_DIR/
- echo "Validating packer.json"
- packer validate packer.json
build:
commands:
- curl -qL -o aws_credentials.json http://169.254.170.2/$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI > aws_credentials.json
- aws configure set region $AWS_REGION
- aws configure set aws_access_key_id `jq -r '.AccessKeyId' aws_credentials.json`
- aws configure set aws_secret_access_key `jq -r '.SecretAccessKey' aws_credentials.json`
- aws configure set aws_session_token `jq -r '.Token' aws_credentials.json`
- packer build packer.json
post_build:
commands:
- echo "Packer Build Completed on `date`"

54 changes: 54 additions & 0 deletions packer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"variables": {
"application_name": "codewithck",
"application_version": "1.0.0",
"region": "us-east-1",
"instance_type": "t2.micro",
"source_ami": "ami-083654bd07b5da81d",
"ami_shared_accounts": "156779398815"
},
"builders": [
{
"name": "{{ user `application_name`}}",
"type": "amazon-ebs",
"ssh_username": "ubuntu",
"force_deregister": "true",
"force_delete_snapshot": "true",
"associate_public_ip_address": "true",
"region": "{{ user `region` }}",
"source_ami": "{{ user `source_ami` }}",
"instance_type": "{{ user `instance_type` }}",
"ami_name": "{{ user `application_name`}}-{{ user `application_version`}}",
"ami_users": "{{ user `ami_shared_accounts`}}",
"tags": {
"Name": "{{ user `application_name` }}",
"CreatedBy": "Packer"
},
"run_tags": {
"Name": "{{ user `application_name` }}",
"CreatedBy": "Packer"
}

}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sudo apt update"
]
},
{
"type": "shell",
"inline": [
"sudo apt install git curl unzip wget -y"
]
},
{
"type": "shell",
"inline": [
"sudo apt install ansible -y"
]
}
]
}
29 changes: 21 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.example</groupId>
<artifactId>devops</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>devops</name>
Expand All @@ -21,23 +21,36 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<surefire.version>2.17</surefire.version>
<surefire.version>3.0.0-M3</surefire.version>
<jacoco.version>0.7.9</jacoco.version>

<sonar.organization>kk-java</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<!--
<sonar.projectKey>firstdevopsproject</sonar.projectKey>
<sonar.organization>firstdevopsproject</sonar.organization>
<sonar.host.url>http://35.172.195.91:9000</sonar.host.url>
<sonar.login>79f26f53ddbfa867596c56621c6df355d3001264</sonar.login>
-->

</properties>

<!--
<distributionManagement>

<repository>
<id>central</id>
<name>releases</name>
<url>http://52.91.244.245:8081/artifactory/libs-release-local</url>
<url>http://localhost:8080/home/ubuntu/libs-release-local</url>
</repository>

<snapshotRepository>
<id>snapshot</id>
<name>snapshots</name>
<url>http://52.91.244.245:8081/artifactory/libs-snapshot-local</url>
<id>hatigen-snapshot-jobs</id>
<name>hatigen-snapshot-jobs</name>
<url>http://3.81.160.68:8082/artifactory/hatigen-snapshot-jobs/</url>
</snapshotRepository>
</distributionManagement>

</distributionManagement>
-->
<scm>
<connection>scm:git:[email protected]:keshavkummari/devops.git</connection>
<developerConnection>scm:git:[email protected]:keshavkummari/devops.git</developerConnection>
Expand Down