Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
c25c963
jenkins userdata
devopshydclub Jul 1, 2023
e1341d9
Commit
devops4sure Oct 17, 2023
dd9c8f9
cleanup
devops4sure Oct 17, 2023
9cc6c03
updates
devops4sure Oct 17, 2023
6ed17e1
jdk17 update
Aug 14, 2024
c090e1f
UI update
Aug 14, 2024
0239713
Update ssh_config_file
hkhcoder Aug 14, 2024
25af678
Update win_buildspec.yml
hkhcoder Aug 14, 2024
82b9089
removed target
Aug 14, 2024
d64751b
wintest file update
Aug 14, 2024
e0af0e8
wintest file update
hkhcoder Aug 14, 2024
d8caae0
db update
Aug 20, 2024
3dd17be
Update win_buildspec.yml
hkhcoder Aug 20, 2024
137cbbe
Update UserControllerTest.java
hkhcoder Jul 16, 2025
fcb1574
Upload maven dep from AWS CodeArtifact
sadamaltoubasi Nov 12, 2025
672506d
Update repository URL in pom.xml
sadamaltoubasi Nov 12, 2025
4a1bee5
new repo update
May 10, 2026
0c8e3d9
new commit
May 10, 2026
b7336d7
new
May 12, 2026
9af3440
test
May 12, 2026
ad128aa
test
Jun 18, 2026
feb93dd
test
Jun 20, 2026
eb4f8b0
sadam-cd 1
Jun 20, 2026
be32ce7
sadam-code-2
Jun 20, 2026
c5a0f69
sadam-code-2
Jun 20, 2026
379d3f5
sadam-code-4
Jun 20, 2026
6b7e43d
test code 5
Jun 20, 2026
0029553
sadam-code-6
Jun 21, 2026
03fa493
test
Jun 23, 2026
8853e96
test
Jun 23, 2026
02d159c
test
Jun 23, 2026
5315679
test
Jun 23, 2026
8d0b77a
Update application.properties
sadamaltoubasi Jun 27, 2026
751bb53
stage test 1
Jun 27, 2026
0c18060
stage test 2
Jun 27, 2026
a4e354b
stage test 3
Jun 27, 2026
0667966
test
Jun 28, 2026
51bf50e
test
Jun 28, 2026
e5c76d1
test
Jun 28, 2026
506aa56
test
Jun 28, 2026
bad26b0
test
Jun 28, 2026
5d136c5
test
Jun 28, 2026
0f38dcb
test
Jun 28, 2026
839749e
test
Jun 28, 2026
0fdd524
test sonar
Jun 29, 2026
a1e86ae
test sonar
Jun 29, 2026
7e3206b
sonar test
Jun 29, 2026
58b8fa9
sonar cloud test
Jun 29, 2026
1162a5f
sonar cloud test 2
Jun 29, 2026
e006a11
test
Jun 29, 2026
c7b0fcd
test sonar quality
Jun 29, 2026
e0d4c8c
sonar cloud test
Jun 29, 2026
c7ea1d1
README.md
Jul 2, 2026
385e8f0
README.md
Jul 2, 2026
9bd14df
test
Jul 5, 2026
4857d82
test
Jul 5, 2026
fd00d9a
test 2
Jul 5, 2026
8ff7f12
update
Jul 6, 2026
dc74dd1
terra test
Jul 7, 2026
8b50fd7
terra test 2
Jul 7, 2026
80f2472
test terra
Jul 7, 2026
8f8ee56
test
Jul 7, 2026
7e30363
test
Jul 7, 2026
1bd5b34
test
Jul 7, 2026
606c610
test
Jul 7, 2026
c52f880
test
Jul 7, 2026
5bfeb9e
test
Jul 7, 2026
02d90f2
test
Jul 7, 2026
8a79027
test
Jul 7, 2026
f9f6a96
test
Jul 7, 2026
f9ae18f
stage
Jul 7, 2026
25b1d2f
stage
Jul 7, 2026
b3a7cc2
last
Jul 8, 2026
348dfa5
final
Jul 8, 2026
dccc324
SG added
Jul 8, 2026
fd9cec0
final
Jul 8, 2026
b60e530
test
Jul 8, 2026
824d114
test
Jul 8, 2026
fd36c48
last
Jul 8, 2026
4fcd55a
final test 1
Jul 8, 2026
292e325
final test 2
Jul 8, 2026
5ebd35d
final test 3
Jul 8, 2026
f91f0f3
route test
Jul 11, 2026
e757a34
test
Jul 11, 2026
ec4f043
test
Jul 11, 2026
9a37ca0
route test 2
Jul 11, 2026
3b18d80
route test 4
Jul 11, 2026
3ffa0e2
final test 1
Jul 11, 2026
c4af884
test
Jul 11, 2026
e4e14db
test
Jul 11, 2026
bc4f308
test
Jul 11, 2026
47d3900
test
Jul 11, 2026
1148013
test
Jul 11, 2026
9043a78
test
Jul 11, 2026
2ccf1f4
test
Jul 11, 2026
493b555
TEST
Jul 11, 2026
a7d8dbe
test
Jul 11, 2026
2d05050
test
Jul 11, 2026
cb77401
test
Jul 11, 2026
0d47400
test
Jul 12, 2026
be01fc9
test
Jul 12, 2026
2ec4377
test
Jul 12, 2026
0070c93
test 2
Jul 12, 2026
6f6858d
test 3
Jul 12, 2026
b60f535
test
Jul 12, 2026
2759b48
test
Jul 12, 2026
6ac59b2
test
Jul 12, 2026
fe98808
vprotest
Jul 13, 2026
21514c4
jenkans 1
Jul 13, 2026
2b48554
test
Jul 13, 2026
ac561bf
test
Jul 13, 2026
c39798f
test
Jul 13, 2026
b8e4abd
test
Jul 13, 2026
3253a3f
test
Jul 13, 2026
1665bbc
test
Jul 14, 2026
579bdc4
final test
Jul 14, 2026
f595b61
test
Jul 15, 2026
f5abd58
last
Jul 15, 2026
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target/
**/.terraform/*
*.tfstate.*
.terraformrc
terraform.rc
terraform/.terraform.lock.hcl
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM tomcat:10.1-jdk17-temurin

RUN rm -rf /usr/local/tomcat/webapps/*

COPY target/vprofile-v2.war /usr/local/tomcat/webapps/ROOT.war

EXPOSE 8080
CMD ["catalina.sh", "run"]
245 changes: 163 additions & 82 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,121 +1,202 @@
def COLOR_MAP = [
'SUCCESS': 'good',
'FAILURE': 'danger',
]

pipeline {
// جعل الـ Agent الافتراضي none لأننا سنحدد لكل Stage الحاوية الخاصة بها
agent none

agent any
/*
tools {
maven "maven3"
}
*/
environment {
NEXUS_VERSION = "nexus3"
NEXUS_PROTOCOL = "http"
NEXUS_URL = "172.31.40.209:8081"
NEXUS_REPOSITORY = "vprofile-release"
NEXUS_REPO_ID = "vprofile-release"
NEXUS_CREDENTIAL_ID = "nexuslogin"
ARTVERSION = "${env.BUILD_ID}"
SNAP_REPO = 'vprofile-snapshot'
NEXUS_USER = 'admin'
NEXUS_PASS = 'admin123'
RELEASE_REPO = 'vprofile-release'
CENTRAL_REPO = 'vpro-maven-central'
NEXUSIP = '172.31.40.75'
NEXUSPORT = '8081'
NEXUS_GRP_REPO = 'vpro-maven-group'
NEXUS_LOGIN = 'nexuslogin'
SONARSERVER = 'sonarserver'
SONARSCANNER = 'sonarscanner'
NEXUSPASS = credentials('nexuspass')

BASTION_PUBLIC_IP = '54.227.230.251'
}
stages{

stages {

stage('BUILD'){
// مرحلة الـ Build: تستخدم حاوية مافن الرسمية مع جافا 17
stage('Build'){
agent {
docker { image 'maven:3.9.6-eclipse-temurin-17' }
}
steps {
sh 'mvn clean install -DskipTests'
}
post {
success {
echo 'Now Archiving...'
archiveArtifacts artifacts: '**/target/*.war'
echo "Now Archiving."
archiveArtifacts artifacts: '**/*.war'
}
}
}

stage('UNIT TEST'){


stage('Test'){
agent {
docker { image 'maven:3.9.6-eclipse-temurin-17' }
}
steps {
sh 'mvn test'
}
}

stage('INTEGRATION TEST'){
steps {
sh 'mvn verify -DskipUnitTests'
stage('Checkstyle Analysis'){
agent {
docker { image 'maven:3.9.6-eclipse-temurin-17' }
}
}

stage ('CODE ANALYSIS WITH CHECKSTYLE'){
steps {
sh 'mvn checkstyle:checkstyle'
}
post {
success {
echo 'Generated Analysis Result'
}




stage('SonarCloud Analysis') {
agent {
docker {
image 'sonarsource/sonar-scanner-cli:latest'
args '-u root --entrypoint='
}
}
}
steps {
withCredentials([string(credentialsId: 'sonarcloud', variable: 'SONAR_TOKEN')]) {
sh '''
sonar-scanner \
-Dsonar.organization=jenkans \
-Dsonar.projectKey=jenkans_vprofile-project \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.token=$SONAR_TOKEN \
-Dsonar.java.binaries=target/classes \
-Dsonar.junit.reportsPath=target/surefire-reports/ \
-Dsonar.jacoco.reportsPath=target/jacoco.exec \
-Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml \
-Dsonar.exclusions=**/*.js,**/*.ts,**/*.css,**/*.html \
-Dsonar.qualitygate.wait=false

'''
}
}
}



stage('CODE ANALYSIS with SONARQUBE') {

environment {
scannerHome = tool 'sonarscanner4'
}

steps {
withSonarQubeEnv('sonar-pro') {
sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \
-Dsonar.projectName=vprofile-repo \
-Dsonar.projectVersion=1.0 \
-Dsonar.sources=src/ \
-Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \
-Dsonar.junit.reportsPath=target/surefire-reports/ \
-Dsonar.jacoco.reportsPath=target/jacoco.exec \
-Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml'''

stage('Build & Push to ECR') {
agent {
docker {
image 'docker:stable'
// تمرير الـ Docker Socket الخاص بالـ Host لكي نتمكن من تشغيل أوامر docker داخل حاوية الـ aws-cli
args '-v /var/run/docker.sock:/var/run/docker.sock -u root'
}
}
environment {
AWS_REGION = 'us-east-1'
AWS_ACCOUNT_ID = '579275327561'
ECR_REPO_NAME = 'app01'
IMAGE_TAG = "${env.BUILD_ID}"
}
steps {
withCredentials([[
$class: 'AmazonWebServicesCredentialsBinding',
credentialsId: 'awsbeancreds',
accessKeyVariable: 'AWS_ACCESS_KEY_ID',
secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
]]) {
sh """

apk add --no-cache aws-cli

aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com

docker build -t ${ECR_REPO_NAME}:${IMAGE_TAG} .

docker tag ${ECR_REPO_NAME}:${IMAGE_TAG} ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ECR_REPO_NAME}:${IMAGE_TAG}
docker tag ${ECR_REPO_NAME}:${IMAGE_TAG} ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ECR_REPO_NAME}:latest

docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ECR_REPO_NAME}:${IMAGE_TAG}
docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ECR_REPO_NAME}:latest

docker rmi ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ECR_REPO_NAME}:${IMAGE_TAG}
docker rmi ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/${ECR_REPO_NAME}:latest

timeout(time: 10, unit: 'MINUTES') {
waitForQualityGate abortPipeline: true
docker rmi ${ECR_REPO_NAME}:${IMAGE_TAG}
"""
}
}
}
}



stage("Publish to Nexus Repository Manager") {
stage('Ansible Deploy to staging'){
agent {
docker {
image 'alpine/ansible:latest'
args '-u root -v /etc/hosts:/etc/hosts'
}
}
environment {
NEXUS_SEC_PASS = credentials('nexuspass')
}
steps {
script {
pom = readMavenPom file: "pom.xml";
filesByGlob = findFiles(glob: "target/*.${pom.packaging}");
echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}"
artifactPath = filesByGlob[0].path;
artifactExists = fileExists artifactPath;
if(artifactExists) {
echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version} ARTVERSION";
nexusArtifactUploader(
nexusVersion: NEXUS_VERSION,
protocol: NEXUS_PROTOCOL,
nexusUrl: NEXUS_URL,
groupId: pom.groupId,
version: ARTVERSION,
repository: NEXUS_REPOSITORY,
credentialsId: NEXUS_CREDENTIAL_ID,
artifacts: [
[artifactId: pom.artifactId,
classifier: '',
file: artifactPath,
type: pom.packaging],
[artifactId: pom.artifactId,
classifier: '',
file: "pom.xml",
type: "pom"]
]
);
}
else {
error "*** File: ${artifactPath}, could not be found";
}
withCredentials([sshUserPrivateKey(credentialsId: 'bastion_login', keyFileVariable: 'SSH_KEY', usernameVariable: 'SSH_USER')]) {
sh """
export HOME=${WORKSPACE}
export ANSIBLE_LOCAL_TEMP=${WORKSPACE}/.ansible/tmp
export ANSIBLE_REMOTE_TEMP=/tmp/.ansible/tmp
export ANSIBLE_HOST_KEY_CHECKING=False

chmod 400 \${SSH_KEY}

apk add --no-cache python3 py3-pip py3-boto3 py3-botocore

ansible-galaxy collection install -r ansible/requirements.yml --collections-path \${WORKSPACE}/.ansible/collections --force

echo "[defaults]" > ansible.cfg
echo "collections_paths = \${WORKSPACE}/.ansible/collections" >> ansible.cfg

cat ansible.cfg

echo "===== Available SSM Lookup Plugins ====="
ansible-doc -t lookup -l | grep ssm

echo "===== Available AWS Plugins ====="
ansible-doc -t lookup -l | grep amazon

ansible-playbook -i ansible/stage.inventory ansible/site.yml \
--user=\${SSH_USER} \
--private-key=\${SSH_KEY} \
--extra-vars "image_tag_env=${env.BUILD_ID} ssh_key_path=\${SSH_KEY}"
"""
}
}
}
}


post {
always {
echo 'Slack Notifications.'
slackSend channel: '#jenkins-cicd',
color: COLOR_MAP[currentBuild.currentResult],
message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}"
}
}
}


}
// --extra-vars "USER=admin PASS=\${NEXUS_SEC_PASS} nexusip=172.31.40.75 reponame=vprofile-release groupid=QA time=${env.BUILD_TIMESTAMP} build=${env.BUILD_ID} artifactid=vproapp vprofile_version=vproapp-${env.BUILD_ID}-${env.BUILD_TIMESTAMP}.war"
// -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/
Loading