-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
projectKey=Test-project | ||
serverUrl=http://localhost:9000 | ||
serverVersion=10.5.1.90531 | ||
dashboardUrl=http://localhost:9000/dashboard?id=Test-project | ||
ceTaskId=6f4e4d31-6df9-46c6-8095-df8e3dfd5321 | ||
ceTaskUrl=http://localhost:9000/api/ce/task?id=6f4e4d31-6df9-46c6-8095-df8e3dfd5321 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
pipeline { | ||
agent any | ||
|
||
stages { | ||
stage('Configure') { | ||
steps { | ||
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/Aahil13/Word-counter']]) | ||
} | ||
} | ||
stage('Building image') { | ||
steps { | ||
sh 'docker build -t word-counter .' | ||
} | ||
} | ||
|
||
stage('Pushing to ECR') { | ||
steps { | ||
withAWS(credentials: 'AWS-CREDS', region: 'us-east-1') { | ||
sh 'aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 313382416572.dkr.ecr.us-east-1.amazonaws.com' | ||
sh 'docker tag word-counter:latest 313382416572.dkr.ecr.us-east-1.amazonaws.com/jenkins:latest' | ||
sh 'docker push 313382416572.dkr.ecr.us-east-1.amazonaws.com/jenkins:latest' | ||
} | ||
} | ||
} | ||
|
||
stage('K8S Deploy') { | ||
steps { | ||
script { | ||
withAWS(credentials: 'AWS-CREDS', region: 'us-east-1') { | ||
sh 'aws eks update-kubeconfig --name test-cluster --region us-east-1' | ||
sh 'kubectl apply -f EKS-Deployment.yaml' | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Get Service URL') { | ||
steps { | ||
script { | ||
def serviceUrl = "" | ||
// Wait for the LoadBalancer IP to be assigned | ||
timeout(time: 5, unit: 'MINUTES') { | ||
while(serviceUrl == "") { | ||
serviceUrl = sh(script: "kubectl get svc word-counter-service -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'", returnStdout: true).trim() | ||
if(serviceUrl == "") { | ||
echo "Waiting for the LoadBalancer IP..." | ||
sleep 10 | ||
} | ||
} | ||
} | ||
echo "Service URL: http://${serviceUrl}" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# must be unique in a given SonarQube instance | ||
sonar.projectKey=Test-project | ||
|
||
# --- optional properties --- | ||
|
||
# defaults to project key | ||
#sonar.projectName=My project | ||
# defaults to 'not provided' | ||
#sonar.projectVersion=1.0 | ||
|
||
# Path is relative to the sonar-project.properties file. Defaults to . | ||
#sonar.sources=. | ||
|
||
# Encoding of the source code. Default is default system encoding | ||
sonar.sourceEncoding=UTF-8 |