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

SonarQube adjustment #25

Open
wants to merge 151 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
7d05b40
Update pom.xml
Ohubabs Sep 19, 2022
39897e5
Update pom.xml
Ohubabs Sep 19, 2022
7656c00
Update pom.xml
Ohubabs Sep 19, 2022
0cd0ab4
Update pom.xml
Ohubabs Sep 24, 2022
e5fbefe
Merge branch 'master' into master
Ohubabs Sep 30, 2022
b2e18bc
Merge pull request #1 from Ohubabs/master
Ohubabs Sep 30, 2022
736f600
Merge pull request #1 from LandmarkTech9/master
Ohubabs Oct 22, 2022
d8ded02
Create Jenkinsfile
Ohubabs Oct 24, 2022
27ba23b
Delete Jenkinsfile
Ohubabs Oct 24, 2022
99b0a4d
Update pom.xml
Ohubabs Oct 24, 2022
20ebcbf
Update pom.xml
Ohubabs Oct 24, 2022
ab17a55
Update pom.xml
Ohubabs Oct 24, 2022
8c30f15
Update pom.xml
Ohubabs Oct 24, 2022
dd0c67f
Update pom.xml
Ohubabs Oct 24, 2022
7565ca8
Update pom.xml
Ohubabs Oct 24, 2022
b21f5df
Update pom.xml
Ohubabs Oct 25, 2022
07b3d14
Update pom.xml
Ohubabs Oct 25, 2022
17d87f3
Update pom.xml
Ohubabs Oct 25, 2022
c44d2c9
Update pom.xml
Ohubabs Oct 28, 2022
a997b71
Update pom.xml
Ohubabs Oct 28, 2022
0793358
Update pom.xml
Ohubabs Oct 29, 2022
6fa93d4
Update pom.xml
Ohubabs Oct 29, 2022
a992d56
Update pom.xml
Ohubabs Oct 29, 2022
43055a5
Update pom.xml
Ohubabs Oct 30, 2022
eae0a58
Update pom.xml
Ohubabs Oct 30, 2022
d9b4890
Update pom.xml
Ohubabs Oct 30, 2022
f422b36
Update pom.xml
Ohubabs Oct 31, 2022
7bcbdb3
Update pom.xml
Ohubabs Nov 2, 2022
ea025e2
Update pom.xml
Ohubabs Nov 2, 2022
8781b51
Update pom.xml
Ohubabs Nov 2, 2022
a503e37
Update pom.xml
Ohubabs Nov 5, 2022
a1d13fa
Update pom.xml
Ohubabs Nov 5, 2022
0c1af0f
Update pom.xml
Ohubabs Nov 11, 2022
0cb5a78
Create princebabs.yml
Ohubabs Nov 11, 2022
a1e3e64
Update pom.xml
Ohubabs Mar 8, 2023
cb350ad
Update pom.xml
Ohubabs Mar 14, 2023
09097a2
Update pom.xml
Ohubabs Mar 14, 2023
50c418d
Update pom.xml
Ohubabs Mar 14, 2023
fed5b84
Update pom.xml
Ohubabs Mar 14, 2023
6e82e21
Update deploy-app.yml
Ohubabs Mar 23, 2023
dd02374
Create tesla-build
Ohubabs Mar 23, 2023
57a6068
Update tesla-build
Ohubabs Mar 23, 2023
4b451c6
Update princebabs.yml
Ohubabs Mar 23, 2023
cff65c5
Create princebabs-deploy
Ohubabs Mar 23, 2023
b3fe519
Rename tesla-build to princebabs-build
Ohubabs Mar 23, 2023
e04f8bd
Update princebabs-build
Ohubabs Mar 23, 2023
4a4e200
Rename princebabs-deploy to princebabs-deploy.yml
Ohubabs Mar 23, 2023
14d9478
Rename princebabs-build to princebabs-build.yml
Ohubabs Mar 23, 2023
38ae88f
Update princebabs-build.yml
Ohubabs Mar 23, 2023
6794acb
Update princebabs-build.yml
Ohubabs Mar 23, 2023
468d4fe
Update and rename princebabs-build.yml to princebabs-copy.yml
Ohubabs Mar 23, 2023
21d6129
Create princebabs-build.yml
Ohubabs Mar 23, 2023
9057ded
Update princebabs-copy.yml
Ohubabs Mar 23, 2023
1a3cbba
Update princebabs-copy.yml
Ohubabs Mar 23, 2023
41e2984
Update princebabs-build.yml
Ohubabs Mar 23, 2023
be5ec31
Update princebabs-build.yml
Ohubabs Mar 23, 2023
1a8149d
Update Dockerfile
Ohubabs Mar 23, 2023
14665f5
Update princebabs-build.yml
Ohubabs Mar 23, 2023
5767845
Update princebabs-build.yml
Ohubabs Mar 23, 2023
c6a34d6
Update princebabs-build.yml
Ohubabs Mar 23, 2023
0a46477
Update Dockerfile
Ohubabs Mar 23, 2023
251634b
Update princebabs-build.yml
Ohubabs Mar 23, 2023
264278b
Update princebabs-build.yml
Ohubabs Mar 23, 2023
94b7767
Update Dockerfile
Ohubabs Mar 23, 2023
c973f14
Update Dockerfile
Ohubabs Mar 23, 2023
6523321
Update princebabs-build.yml
Ohubabs Mar 23, 2023
b5a6550
Update Dockerfile
Ohubabs Mar 23, 2023
5212100
Update princebabs.yml
Ohubabs Mar 30, 2023
f337fed
Update pom.xml
Ohubabs Mar 30, 2023
bced7f4
Create tesla-host
Ohubabs Mar 31, 2023
b212965
Update princebabs.yml
Ohubabs Mar 31, 2023
484f8fa
Update pom.xml
Ohubabs Apr 4, 2023
f56a115
Update tesla-host
Ohubabs Apr 4, 2023
508e68b
Update princebabs-build.yml
Ohubabs Apr 5, 2023
403e3f0
Update princebabs-build.yml
Ohubabs Apr 5, 2023
035bdb0
Update princebabs-build.yml
Ohubabs Apr 5, 2023
648a1de
Update tesla-host
Ohubabs Apr 5, 2023
8ef70a7
Update princebabs-build.yml
Ohubabs Apr 5, 2023
7630511
Update princebabs-build.yml
Ohubabs Apr 5, 2023
5e2bfe1
Update princebabs-build.yml
Ohubabs Apr 5, 2023
68ebcd9
Update princebabs-build.yml
Ohubabs Apr 5, 2023
507007d
Create Jenkinsfile
Ohubabs Apr 5, 2023
b9f98d1
Update Jenkinsfile
Ohubabs Apr 5, 2023
01f3817
Update Jenkinsfile
Ohubabs Apr 5, 2023
eea4851
Create princebabs-destroy
Ohubabs Apr 5, 2023
12947f5
Rename princebabs-destroy to princebabs-destroy.yml
Ohubabs Apr 5, 2023
8a6f254
Update princebabs-destroy.yml
Ohubabs Apr 5, 2023
24a75db
Update princebabs-destroy.yml
Ohubabs Apr 5, 2023
21fab6f
Deleted "become: true"
Ohubabs Apr 5, 2023
c361a1f
Update pom.xml
Ohubabs Apr 5, 2023
b62dfa1
Update pom.xml
Ohubabs Apr 5, 2023
34d213e
Update princebabs-build.yml
Ohubabs Apr 5, 2023
733dbda
Update princebabs-build.yml
Ohubabs Apr 5, 2023
ac60921
Update princebabs-build.yml
Ohubabs Apr 5, 2023
8d3f4f5
Update princebabs-build.yml
Ohubabs Apr 5, 2023
fe93983
Update tesla-host
Ohubabs Apr 5, 2023
da42f50
Create sonarstart.yml
Ohubabs Apr 5, 2023
ccb13fe
Update sonarstart.yml
Ohubabs Apr 5, 2023
283d1d9
Update tesla-host
Ohubabs Apr 6, 2023
9a0ce62
Update pom.xml
Ohubabs Apr 6, 2023
475e67f
Create Jenkinsfile2
Ohubabs Apr 6, 2023
77ee3ef
Update tesla-host
Ohubabs Apr 6, 2023
f514a02
Update pom.xml
Ohubabs Apr 11, 2023
0da4e66
Update tesla-host
Ohubabs Apr 11, 2023
05f3949
Update pom.xml
Ohubabs Jun 7, 2023
f255fa8
Update pom.xml
Ohubabs Jun 7, 2023
6580254
Update Dockerfile
Ohubabs Jun 7, 2023
2bbfc35
Update princebabs-build.yml
Ohubabs Jun 7, 2023
e5b5f50
Update Jenkinsfile2
Ohubabs Jun 7, 2023
6217682
Update tesla-host
Ohubabs Jun 8, 2023
d7315e9
Create princebabs-push.yml
Ohubabs Jun 8, 2023
6bd5e13
Update princebabs.yml
Ohubabs Jun 8, 2023
ffdf4c3
Update princebabs-deploy.yml
Ohubabs Jun 8, 2023
46a7464
Update princebabs-deploy.yml
Ohubabs Jun 8, 2023
d153f43
Update princebabs-deploy.yml
Ohubabs Jun 8, 2023
60fdf13
Update princebabs-deploy.yml
Ohubabs Jun 9, 2023
f74b28c
Update princebabs-copy.yml
Ohubabs Jun 9, 2023
37983c5
Create JenkinsFile3
Ohubabs Jun 9, 2023
5dcb01a
Changed sonarqube credentials
Ohubabs Oct 17, 2023
fc443da
Update pom.xml
Ohubabs Oct 19, 2023
d4c8fc7
Update Dockerfile
Ohubabs Oct 19, 2023
4ef1056
Update pom.xml
Ohubabs Dec 14, 2023
b91a599
Create Jenkinsfile_konoha
Ohubabs Dec 14, 2023
85ff865
Update Jenkinsfile_konoha
Ohubabs Dec 14, 2023
7d7b3f9
Update Jenkinsfile_konoha
Ohubabs Dec 14, 2023
f1f0709
Update home.jsp
Ohubabs Dec 14, 2023
c32b742
Update Jenkinsfile_konoha
Ohubabs Dec 14, 2023
726d645
Update Jenkinsfile_konoha
Ohubabs Dec 14, 2023
13d2811
Update Jenkinsfile_konoha
Ohubabs Dec 14, 2023
7ea8b5c
Update Jenkinsfile_konoha
Ohubabs Dec 14, 2023
b3efdbb
Update Jenkinsfile_konoha
Ohubabs Dec 14, 2023
932c9ef
Update pom.xml
Ohubabs Dec 14, 2023
56aee9f
Create Jenkinsfile_konoha_1
Ohubabs Dec 14, 2023
fab33d2
Update Jenkinsfile_konoha_1
Ohubabs Dec 14, 2023
94bdd82
Update Jenkinsfile_konoha_1
Ohubabs Dec 14, 2023
df4f03b
Create Jenkinsfile_konoha_2
Ohubabs Dec 14, 2023
97505e6
Create konoha-app.tf
Ohubabs Dec 14, 2023
f4d5806
Create konoha_svc
Ohubabs Dec 14, 2023
ab70060
Create konoha_ingress.tf
Ohubabs Dec 14, 2023
eff8ef4
Create provider.tf
Ohubabs Dec 14, 2023
fa54250
Update konoha_ingress.tf
Ohubabs Dec 14, 2023
946da0a
Update konoha_svc
Ohubabs Dec 14, 2023
2aadbbf
Update and rename konoha_svc to konoha_svc.tf
Ohubabs Dec 14, 2023
23879e1
Update konoha_svc.tf
Ohubabs Dec 14, 2023
7b3fd8f
Update konoha_ingress.tf
Ohubabs Dec 14, 2023
5767b9c
Update tesla-host
Ohubabs Mar 21, 2024
1855fc0
Update Dockerfile
Ohubabs Mar 21, 2024
fc2ee98
Update princebabs-build.yml
Ohubabs Mar 21, 2024
3ef9d78
Update Dockerfile
Ohubabs Mar 21, 2024
dee6874
Update Dockerfile
Ohubabs Mar 21, 2024
18aac1e
removed dockerhub password
Ohubabs May 6, 2024
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
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM tomcat:8.0.20-jre8
### Good stuff
COPY target/*.war /usr/local/tomcat/webapps/wfapp.war
COPY target/*.war /usr/local/tomcat/webapps/tesla.war
#if prefix isn't taken out use target/*.war
53 changes: 53 additions & 0 deletions JenkinsFile3
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
pipeline{
agent{
label 'Ansible'
}
tools{
maven 'Maven'
}

stages{

stage ('Clone Git Repo'){
steps{
sh "echo 'Cloning Git Repo'"
git 'https://github.com/Ohubabs/tesla-app.git'
}
}

stage ('Build Webapp'){
steps{
sh "echo 'Clean Source Code and Build Webapp'"
sh "mvn clean package"
}
}

stage ('Transfer to Docker and Build Image'){
steps{
sh "echo 'Transfer to Docker and Build Image'"
sh "ansible-playbook princebabs-build.yml"
}
}

stage ('login to DockerHub and Push Image'){
steps{
sh "echo 'login to DockerHub and Push Image'"
sh "ansible-playbook princebabs-push.yml"
}
}

stage ('Copy Deployment file to EKS server'){
steps{
sh "echo 'Deploy to Cluster'"
sh "ansible-playbook princebabs-copy.yml"
}
}

stage ('Deploy App'){
steps{
sh "echo 'Deploy to Cluster'"
sh 'ansible eks -a "kubectl apply -f princebabs.yml"'
}
}
}
}
74 changes: 74 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#For Master-Slave Architecture, you need SSH Agent and SSH Publisher Plugins. Then configure their ssh server settings in Configure Systems.

#To configure Ansible and Docker Nodes, you need to go to Manage Clouds and Nodes to input the details of your servers.


#Use SSH Publisher syntax to transfer war files and Dockerfile to your Docker server. Then in exec command, input " docker build -t <imagename:version>" and docker push
but used the "variable"/withcredentials beforehand to setup docker credentials and then refer to the variable when inputting the exec command for better security.
Fill out ssh publisher with the following credentials:

SSH Server
Name: Docker
Advanced > Transfers > Transfer Set

Source files= target/*war
Remove prefix
#Do not remove prefix unless you change Dockerfile to just copy /*war instead of target/*war
Remote directory: //home//ubuntu// # "//" is crucial or the file won't be copied into the right location/be found when executing your commands.
Exec command
?
All of the transfer fields (except for Exec timeout) support substitution of Jenkins environment variables
Advanced

Transfer Set
Source files: Dockerfile
Remove prefix
?
Remote directory: //home//ubuntu
Exec command: docker build -t princebabs/tesla .


pipeline{
agent{
label 'Ansible'
}
tools{
maven 'maven3.9.0'
}

stages{

stage ('Clone Git Repo'){
steps{
sh "echo 'Cloning Git Repo'"
git 'https://github.com/Ohubabs/tesla-app.git'
}
}

stage ('Build Webapp'){
steps{
sh "echo 'Clean Source Code and Build Webapp'"
sh "mvn clean package"
}
}

stage ('Quality Testing'){
steps{
sh "echo 'Clean Source Code and Build Webapp'"
sh "mvn sonar:sonar"
}
}

stage ('Transfer to Docker and Build Image'){
steps{
sshPublisher(publishers: [sshPublisherDesc(configName: 'Docker', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '//home//ubuntu//', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'target/*war'), sshTransfer(cleanRemote: false, excludes: '', execCommand: 'docker build -t princebabs/tesla .', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '//home//ubuntu', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'Dockerfile')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)])
}
}

stage ('Deploy wfapp'){
steps{
sh "ansible-playbook princebabs-deploy.yml -i tesla-host"
}
}
}
}
82 changes: 82 additions & 0 deletions Jenkinsfile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
pipeline{
agent{
label 'Ansible'
}
tools{
maven 'maven3.9.0'
}

stages{

stage ('Clone Git Repo'){
steps{
sh "echo 'Cloning Git Repo'"
git 'https://github.com/Ohubabs/tesla-app.git'
}
}

stage ('Build Webapp'){
steps{
sh "echo 'Clean Source Code and Build Webapp'"
sh "mvn clean package"
}
}

stage ('Start SonarQube'){
steps{
sh "ansible-playbook sonarstart.yml -i tesla-host"
}
}

stage ('Quality Testing'){
steps{
sh "echo 'Clean Source Code and Build Webapp'"
sh "mvn sonar:sonar"
}
}

stage ('Backup Artifact'){
steps{
sh "echo 'Backup to Nexus'"
sh "mvn deploy"
}
}

stage ('Transfer to Docker and Build Image'){
steps{
sh "echo 'Transfer to Docker and Build Image"
sshPublisher(publishers: [sshPublisherDesc(configName: 'Ansible', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '//home//ansible//auto', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'target/*war'), sshTransfer(cleanRemote: false, excludes: '', execCommand: 'ansible-playbook princebabs-build.yml -i tesla-host', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '//home//ansible//auto', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'Dockerfile')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)])
}
}

stage ('Log into DockerHub and Push Image'){
steps{
sh "echo 'Log into DockerHub and Push Image'"
withCredentials([usernamePassword(credentialsId: 'DockerHub-Credentials', passwordVariable: 'DOCKERHUB_PASSWORD', usernameVariable: 'DOCKERHUB_USERNAME')]) {
sshPublisher(publishers: [sshPublisherDesc(configName: 'Docker', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '''docker login -u DOCKERHUB_USERNAME -p DOCKERHUB_PASSWORD
docker push princebabs/tesla''', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)])
}
}
}


stage ('Deploy App to EKS Cluster'){
steps{
sh "echo 'Deploy App to EKS Cluster'"
sh "ansible-playbook princebabs-deploy.yml -i tesla-host"
}
}
}
}

#Side note
$node(POD_LABEL) {
# stage('Get a Maven project') {
# git 'https://github.com/jenkinsci/kubernetes-plugin.git'
# container('maven') {
# stage('Build a Maven project') {
# sh 'mvn -B -ntp clean install'
# }
# }
#}
#ref: https://plugins.jenkins.io/kubernetes/
37 changes: 37 additions & 0 deletions Jenkinsfile_konoha
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
pipeline{
agent {
label 'docker'
}
tools{
maven 'maven'
}
stages{
//stage('Clone Code'){
// steps{
// sh "echo cloning code"
// sh "echo clone code complete"
// git 'https://github.com/Ohubabs/tesla-app.git'
// }
//}
stage ('Build Webapp'){
steps{
sh "echo 'Clean Source Code and Build Webapp'"
sh "mvn clean package"
sh "mvn sonar:sonar"
}
}
stage('Build Image'){
steps{
sh "echo build image"
sh 'docker build -t princebabs/konoha:v1 .'
}
}
stage('Push to DockerHub'){
steps{
sh "echo 'Push Image'"
sh 'docker push princebabs/konoha:v1'

}
}
}
}
28 changes: 28 additions & 0 deletions Jenkinsfile_konoha_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pipeline{
agent {
label 'terra'
}
stages{
//stage('Clone Code'){
// steps{
// sh "echo cloning code"
// sh "echo clone code complete"
// git 'https://github.com/Ohubabs/tesla-app.git'
// }
//}
stage('Initialize Terraform'){
steps{
sh "echo 'Deploy Tesla To Cluster'"
sh "terraform init"
}
}
stage('Deploy Tesla To EKS'){
steps{
sh "echo 'Deploy Tesla To Cluster'"
sh "terraform validate"
sh "terraform plan"
sh "terraform apply --auto-approve" //Swap "apply" with "destroy" when deleting resources
}
}
}
}
14 changes: 14 additions & 0 deletions Jenkinsfile_konoha_2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pipeline{
agent {
label 'terra'
}
stages{
stage('Destroy Konoha Web Server Today'){
steps{
sh "echo 'Deploy Tesla To Cluster'"
sh "terraform init"
sh "terraform destroy --auto-approve"
}
}
}
}
6 changes: 3 additions & 3 deletions deploy-app.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

- hosts: k8s
- hosts: eks
tasks:
- name: copy deployment manifest files
copy: src=app.yml dest=/home/ubuntu/myapp.yml
copy: src=app.yml dest=/home/eks/myapp.yml
- name: deploy the web application
shell: kubectl apply -f /home/ubuntu/myapp.yml
shell: kubectl apply -f /home/eks/myapp.yml
52 changes: 52 additions & 0 deletions konoha-app.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
resource "kubernetes_deployment_v1" "konoha-deploy" {
metadata {
name = "konoha"
}

spec {
replicas = 2
strategy {
type = "RollingUpdate"
rolling_update {
max_surge = 1
max_unavailable = 1
}
}
min_ready_seconds = 30
selector {
match_labels = {
app = "konoha"
}
}

template {
metadata {
labels = {
app = "konoha"
}
}

spec {
container {
image = "princebabs/konoha:v1"
name = "konoha-pod"

port {
container_port = 80
}

resources {
limits = {
cpu = ".5"
memory = "512Mi"
}
requests = {
cpu = "250m"
memory = "50Mi"
}
}
}
}
}
}
}
Loading