Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
166 commits
Select commit Hold shift + click to select a range
ad210ff
Update build.gradle
sdgcpsb Jan 18, 2021
13f3ae9
Update build.gradle
sdgcpsb Jan 18, 2021
77b8748
Update build.gradle
sdgcpsb Jan 18, 2021
71de485
Update build.gradle
sdgcpsb Jan 18, 2021
ee3b909
Update build.gradle
sdgcpsb Jan 18, 2021
0989556
Update build.gradle
sdgcpsb Jan 18, 2021
ac621bd
Create gradle.yml
sdgcpsb Jan 18, 2021
29ee204
Create gradle.yaml
sdgcpsb Jan 18, 2021
accabca
Rename gradle.yaml to gradle.yml
sdgcpsb Jan 18, 2021
7c8f279
Update build.gradle
sdgcpsb Jan 18, 2021
7c9803f
Update build.gradle
sdgcpsb Jan 18, 2021
b4e0eed
Update build.gradle
sdgcpsb Jan 18, 2021
fbe2ea8
Update build.gradle
sdgcpsb Jan 18, 2021
373bc11
Update build.gradle
sdgcpsb Jan 18, 2021
23f028b
Update build.gradle
sdgcpsb Jan 18, 2021
8c1cb4c
Update build.gradle
sdgcpsb Jan 18, 2021
e667263
Update build.gradle
sdgcpsb Jan 18, 2021
828f2fc
Create Jenkinsfile
sdgcpsb Jan 18, 2021
1075e0e
Update Jenkinsfile
sdgcpsb Jan 18, 2021
1810385
Update Jenkinsfile
sdgcpsb Jan 18, 2021
8f6396c
Update Jenkinsfile
sdgcpsb Jan 18, 2021
e3df617
Update Jenkinsfile
sdgcpsb Jan 18, 2021
cfc5a33
Update Jenkinsfile
sdgcpsb Jan 18, 2021
e9e7df0
Update Jenkinsfile
sdgcpsb Jan 18, 2021
3031986
Update build.gradle
sdgcpsb Jan 18, 2021
c814b5b
Update Jenkinsfile
sdgcpsb Jan 18, 2021
72961ad
Update build.gradle
sdgcpsb Jan 18, 2021
a0282d8
Update build.gradle
sdgcpsb Jan 18, 2021
197622c
Update Jenkinsfile
sdgcpsb Jan 18, 2021
10972c0
Update Jenkinsfile
sdgcpsb Jan 18, 2021
c16167f
Update build.gradle
sdgcpsb Jan 18, 2021
1dd4b15
Update Jenkinsfile
sdgcpsb Jan 18, 2021
bd5d551
Update Jenkinsfile
sdgcpsb Jan 18, 2021
b616e67
Update Jenkinsfile
sdgcpsb Jan 18, 2021
e8e8256
Update build.gradle
sdgcpsb Jan 18, 2021
f1fa023
Update Jenkinsfile
sdgcpsb Jan 18, 2021
eee16a0
Update build.gradle
sdgcpsb Jan 18, 2021
10e3cf9
Update Jenkinsfile
sdgcpsb Jan 18, 2021
536e119
Update Jenkinsfile
sdgcpsb Jan 18, 2021
483ab09
Update Jenkinsfile
sdgcpsb Jan 18, 2021
73e726a
Update Jenkinsfile
sdgcpsb Jan 18, 2021
a334a6b
Update Jenkinsfile
sdgcpsb Jan 18, 2021
c4eaae9
Update Jenkinsfile
sdgcpsb Jan 18, 2021
4e160e2
Update Jenkinsfile
sdgcpsb Jan 18, 2021
0847c2c
Create pom.xml
sdgcpsb Jan 18, 2021
d16c0f6
Update Jenkinsfile
sdgcpsb Jan 18, 2021
3ae8822
Update Jenkinsfile
sdgcpsb Jan 18, 2021
da78127
Update Jenkinsfile
sdgcpsb Jan 18, 2021
024d357
Update pom.xml
sdgcpsb Jan 18, 2021
76bba57
Update Jenkinsfile
sdgcpsb Jan 18, 2021
a5de934
Create sample-java-app
sdgcpsb Jan 18, 2021
0d53798
Add files via upload
sdgcpsb Jan 18, 2021
0c4018a
Update Jenkinsfile
sdgcpsb Jan 18, 2021
63611a9
Update Jenkinsfile
sdgcpsb Jan 18, 2021
113a87f
Update Jenkinsfile
sdgcpsb Jan 18, 2021
d9c38bc
Update Jenkinsfile
sdgcpsb Jan 18, 2021
f347527
Update Jenkinsfile
sdgcpsb Jan 18, 2021
9d48bb9
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
d22ac6d
Update Jenkinsfile
sdgcpsb Jan 18, 2021
9c3b15e
Update Jenkinsfile
sdgcpsb Jan 18, 2021
813e2af
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
2702490
Update build.gradle
sdgcpsb Jan 18, 2021
019faca
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
450c286
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
9dd8713
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
9e2c3c8
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
9e01c26
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
7d38084
hi
rakshita-singh Jan 18, 2021
4060131
Update Jenkinsfile
sdgcpsb Jan 18, 2021
1b89cba
Update Jenkinsfile
sdgcpsb Jan 18, 2021
6290323
Update Jenkinsfile
sdgcpsb Jan 18, 2021
0e72e3e
Update build.gradle
sdgcpsb Jan 18, 2021
d3254db
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
9eacd55
Update Jenkinsfile
sdgcpsb Jan 18, 2021
1bcc668
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
bc6e706
Update pom.xml
sdgcpsb Jan 18, 2021
cf0182a
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
dd554ee
Update pom.xml
sdgcpsb Jan 18, 2021
cb63d62
Update Jenkinsfile
sdgcpsb Jan 18, 2021
89e5491
Update SpringBootRestAppApplicationTests.java
sdgcpsb Jan 18, 2021
fcde3aa
Update Jenkinsfile
sdgcpsb Jan 18, 2021
12bbc57
Update Jenkinsfile
sdgcpsb Jan 18, 2021
a668ef8
Update Jenkinsfile
sdgcpsb Jan 18, 2021
b1280cc
Update Jenkinsfile
sdgcpsb Jan 18, 2021
f303ccf
Update Jenkinsfile
sdgcpsb Jan 18, 2021
7074735
Update Jenkinsfile
sdgcpsb Jan 18, 2021
0d8a9c2
Update Jenkinsfile
sdgcpsb Jan 18, 2021
d6e1e90
Create Jenkinsfile_AIP
sdgcpsb Jan 19, 2021
652aa5d
Update Jenkinsfile
sdgcpsb Jan 20, 2021
cbbafee
Update Jenkinsfile
sdgcpsb Jan 20, 2021
bc158b3
Update Jenkinsfile
sdgcpsb Jan 20, 2021
bbfc9ad
Update Jenkinsfile
sdgcpsb Jan 20, 2021
bf71af7
Update Jenkinsfile
sdgcpsb Jan 20, 2021
8b60550
Update Jenkinsfile
sdgcpsb Jan 20, 2021
7c03357
Create hello
sdgcpsb Jan 20, 2021
ea63823
Update hello
sdgcpsb Jan 20, 2021
3db6aeb
Update hello
sdgcpsb Jan 20, 2021
89a1ef4
Update Jenkinsfile
sdgcpsb Jan 20, 2021
40b81ea
Update Jenkinsfile
sdgcpsb Jan 20, 2021
d752e3a
Update Jenkinsfile
sdgcpsb Jan 20, 2021
550a99c
Update Jenkinsfile
sdgcpsb Jan 20, 2021
0db947e
Update Jenkinsfile
sdgcpsb Jan 21, 2021
ab61dc7
Update Jenkinsfile
sdgcpsb Jan 21, 2021
64419ac
Update Jenkinsfile_AIP
sdgcpsb Jan 21, 2021
df5d517
Create hihello
sdgcpsb Jan 22, 2021
5c4fc85
Create project.properties
sdgcpsb Jan 22, 2021
4b3490e
Update project.properties
sdgcpsb Jan 22, 2021
cfcd424
Update project.properties
sdgcpsb Jan 22, 2021
6dd2e14
Update project.properties
sdgcpsb Jan 22, 2021
a359ecb
Update project.properties
sdgcpsb Jan 22, 2021
95c2264
Update project.properties
sdgcpsb Jan 22, 2021
b9200de
Update project.properties
sdgcpsb Jan 22, 2021
f8bcbb3
Update project.properties
sdgcpsb Jan 22, 2021
5ec8470
Update project.properties
sdgcpsb Jan 22, 2021
d383c04
Update project.properties
sdgcpsb Jan 25, 2021
d120a76
Update project.properties
sdgcpsb Jan 25, 2021
6ed37bf
Update project.properties
sdgcpsb Jan 25, 2021
5d1af84
Update project.properties
sdgcpsb Jan 25, 2021
7ef2d11
Update project.properties
sdgcpsb Jan 25, 2021
da88914
Update project.properties
sdgcpsb Jan 25, 2021
e3948b9
Update project.properties
sdgcpsb Jan 25, 2021
9190bd6
Update project.properties
sdgcpsb Jan 25, 2021
31dc454
Update project.properties
sdgcpsb Jan 25, 2021
b1398d2
Update project.properties
sdgcpsb Jan 27, 2021
45169a7
Create Jenkins_Tweak
sdgcpsb Jan 27, 2021
f441eed
Update Jenkins_Tweak
sdgcpsb Jan 27, 2021
de09e25
Update Jenkins_Tweak
sdgcpsb Jan 27, 2021
b8765c1
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
b093913
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
65245de
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
dae77e3
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
858cd95
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
b6b8627
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
9a0fa25
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
df79073
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
49236ac
Update Jenkinsfile_AIP
sdgcpsb Jan 27, 2021
8860286
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
7cc3d3e
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
4856b00
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
9fd423b
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
ebd0d0a
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
76b8891
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
29dfb2f
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
0bda1da
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
934cb4d
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
e1b3201
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
1d8a0db
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
203a795
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
fca78da
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
8d9da17
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
f64b5dd
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
664d9b8
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
7f3dd7f
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
45e6a1a
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
aa0b7ba
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
7ca6a1c
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
24035b9
Update project.properties
sdgcpsb Jan 28, 2021
2b2ffb8
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
cf5ffc5
Update Jenkinsfile_AIP
sdgcpsb Jan 28, 2021
2807c48
Update Jenkinsfile_AIP
sdgcpsb Feb 2, 2021
55d7cf6
Update Jenkinsfile_AIP
sdgcpae Feb 2, 2021
1a7cec7
Update Jenkinsfile_AIP
sdgcpsb Feb 2, 2021
efde158
Update Jenkinsfile_AIP
sdgcpsb Feb 2, 2021
3ecacb1
Update Jenkinsfile_AIP
sdgcpsb Feb 3, 2021
84426ce
Update Jenkinsfile_AIP
sdgcpsb Feb 3, 2021
71942b7
Update Jenkinsfile_AIP
sdgcpsb Feb 3, 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
26 changes: 26 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
93 changes: 93 additions & 0 deletions Jenkins_Tweak
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
pipeline {

//agent any 2
agent {
kubernetes {
label 'SpringBootRestApp'
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
component: ci
spec:
containers:
- name: gradle
image: gradle:3.5-jdk8-alpine
command:
- cat
tty: true
"""
}
}

stages {

stage('SCM Checkout') {
steps {



/* //git branch: 'feature', credentialsId: 'git_creds', url: 'https://github.com/sdgcpsb/SpringBootRestApp.git'

script {
propfile = readProperties(file: './project.properties')
println ("reading properties ...")
println ("branch_name:"+ propfile['deploy'])

} */

}



}



stage ("Deploy") {
steps {
container ('gradle') {
sh '''

deploy=`cat project.properties | grep "feature_deploy" | cut -d'=' -f2 | awk '{print $1}' `


if test "$deploy" = true
then
echo " im deploying"
else
echo "no need"
fi

server_list=`cat project.properties | grep "servers" | cut -d'=' -f2 `
echo $server_list
for server in $server_list

do

echo $server
done



'''



}
}
}
stage ("use env vars") {
steps {
sh "printenv | sort"
echo "BUILD_NUMBER = ${env.BUILD_NUMBER}"
echo "BRANCH_NAME = ${env.BRANCH_NAME}"
}
}


}
}

76 changes: 76 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
pipeline {
environment {
PROJECT_ID = "sd-devops"
APP_NAME = "sample-java-app"
CLUSTER_NAME = "cluster-1"
CLUSTER_ZONE = "us-central1-a"
CREDENTIALS_ID = "sd-devops"
}
//agent any 2
agent {
kubernetes {
label 'SpringBootRestApp'
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
component: ci
spec:
containers:
-name: gradle
image: gradle: 3.5 - jdk8 - alpine
command:
-cat
tty: true
"""
}
}
stages {
stage('test') {
parallel {
stage('check_gradle_version') {
steps {
container('gradle') {
sh 'gradle -v'
sh 'echo workspace is $WORKSPACE'
sh "ls -la ${pwd()}"
sh 'chmod 777 * '
sh './gradlew compileJava'
}
}
}
stage('Unit Test') {
steps {
container('gradle') {
withMaven(maven: 'MAVEN-3.6.3') {
withSonarQubeEnv(installationName: 'Sonarqube') {
echo 'I am executing unit test'
sh "ls -la ${pwd()}"
sh 'mvn -f sample-java-app/pom.xml clean package'
}
}
}
}
}
}
}
stage('Code Quality') {
steps {
container('gradle') {
withMaven(maven: 'MAVEN-3.6.3') {
withSonarQubeEnv(installationName: 'Sonarqube') {
echo 'I am executing code quality using sonarqube'
sh 'mvn -f sample-java-app/pom.xml sonar:sonar'
}
sleep(60)
timeout(time: 1, unit: 'MINUTES') {
waitForQualityGate abortPipeline: true
}
}
}
}
}
}
}
178 changes: 178 additions & 0 deletions Jenkinsfile_AIP
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
pipeline {

agent {
kubernetes {
label 'SpringBootRestApp'
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
labels:
component: ci
spec:
containers:
- name: gradle
image: gradle:3.5-jdk8-alpine
command:
- cat
tty: true
"""
}
}

stages {
stage('Build & Unit Test') {
steps {
container('gradle') {
withMaven(maven: 'MAVEN-3.6.3') {
withSonarQubeEnv(installationName: 'Sonarqube') {
echo 'I am executing unit test'
// sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done'
sh 'mvn -f sample-java-app/pom.xml clean package'
}
}
}
}
}
stage('Code Quality') {
steps {
container('gradle') {
withMaven(maven: 'MAVEN-3.6.3') {
withSonarQubeEnv(installationName: 'Sonarqube') {
echo 'I am executing code quality using sonarqube'
sh 'mvn -f sample-java-app/pom.xml sonar:sonar'
}
sleep(60)
timeout(time: 1, unit: 'MINUTES') {
waitForQualityGate abortPipeline: true
}
}
}
}
}
stage("Publish Package") {
steps {
container('gradle') {
script {
propfile = readProperties(file: './project.properties')
println("deploy:" + propfile['feature_deploy'])
println("reading properties ...")
if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') {
withMaven(maven: 'MAVEN-3.6.3') {
echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva'
/* echo 'copying the jar and war files from the individual target directorrys and copying it to artifacts directory '
sh "mkdir -p $WORKSPACE/artifacts"
sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do cp -rp ${i}/dist/libs/* $WORKSPACE/artifacts/ ;done' */
/* echo 'create a tar file on the Jenkins server'
sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true */
sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar'
sh 'ls -lrt sample-java-app/target/'
sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/'
echo "noooooooooooooooooo"
}
}
}
}
}
}
stage("Deploy") {
steps {
container('gradle') {
script {
propfile = readProperties(file: './project.properties')
println("deploy:" + propfile['feature_deploy'])
println("reading properties ...")
if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') {
withMaven(maven: 'MAVEN-3.6.3') {
echo 'I am deploying the artifact into the target environment'
echo 'shutting down the tomcat ESB server'
/* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"'
echo 'force stop any remaining mule process'
sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' */
echo 'tomcat server stopped'
echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files'
/* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/'
sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"'
sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"'
sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' */
echo 'Deployment has been completed'
echo 'starting the tomcat ESB server'
/* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"'
sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' */
echo 'tomcat server started'
}
} else {
echo "no need"
}
}
}
}
}
stage('Post Deploy Tests') {
parallel {
stage('Smoke Test') {
steps {
echo "I am executing Smoke Test on target dev environment post deployment"
}
/*RESP=`curl -X GET "${bamboo.uri}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"`
echo "The response for current execution status is: $RESP"
if [ "$RESP" != "[]" ];
then
echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases."
exit 1
else
echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution"
fi
# To abort the request before attempting to re-run, uncomment and run below line.
# abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/Request/${bamboo.RequestID}/abort/)
guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${bamboo.stage_name}}" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/ExecuteRequest/ | tr -d \")
echo "The GUID is: $guid"
status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \})
echo "The status is: $status"
while [[ $status != *"Completed"* ]]
do
status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \})
echo "The status is: $status"
sleep 15
done
status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/)
echo "The status is: $status"
execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \})
echo "The exec status is: $execstatus"
if [[ $execstatus != *Passed* ]];
then
echo "Failed"
exit 1
else
echo "Passed"
exit
fi
exit */
}
stage('Security Test') {
steps {
echo 'I am running Security Test here'
}
}
}
}
}
post {
failure {
/*mail bcc: '',
body: "<b>Example</b><br>\n<br>Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> URL de build: ${env.BUILD_URL}",
cc: '',
charset: 'UTF-8',
from: '',
mimeType: 'text/html',
replyTo: '',
subject: "ERROR CI: Project name -> ${env.JOB_NAME}",
to: "foo@foomail.com";*/
echo 'I am sending a notification with failure'
}
success {
echo 'I am sending a notification with success'
}
}
}
Loading