Add FindHTTPCalls stage to Jenkinsfile

This commit is contained in:
Monica Del Rio 2021-11-30 17:32:47 -04:00
parent dc398cde58
commit 74c5582916
2 changed files with 25 additions and 1 deletions

24
Jenkinsfile vendored
View file

@ -1,6 +1,30 @@
pipeline { pipeline {
agent none agent none
stages { stages {
stage('FindHTTPCalls') {
agent {
docker {
image 'maven:3.8.1-adoptopenjdk-11'
}
}
environment {
HTTPCALLS = """${sh(
returnStdout: true,
script: 'find ./sources -path "*.py" -exec grep -H -e "http://" {} \\;'
)}"""
}
steps {
script {
if (env.HTTPCALLS?.trim()) {
currentBuild.result = 'ABORTED'
error("Aborting the build for http calls.")
}
}
}
}
stage('Build') { stage('Build') {
agent { agent {
docker { docker {

View file

@ -11,7 +11,7 @@ argnumbers = len(sys.argv) - 1
r =requests.get('https://xkcd.com/1906/') r =requests.get('https://xkcd.com/1906/')
if argnumbers == 2 : if argnumbers == 2 :
print("") # print("")
print("The result is " + str(calc.add2(str(sys.argv[1]), str(sys.argv[2])))) print("The result is " + str(calc.add2(str(sys.argv[1]), str(sys.argv[2]))))
print("") print("")
sys.exit(0) sys.exit(0)