diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 83f80749..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,44 +0,0 @@ -pipeline { - agent { label 'linux' } - options { - buildDiscarder(logRotator(numToKeepStr: '5')) - } - environment { - HEROKU_API_KEY = credentials('darinpope-heroku-api-key') - } - parameters { - string(name: 'APP_NAME', defaultValue: '', description: 'What is the Heroku app name?') - } - stages { - stage('Build') { - steps { - sh 'docker build -t darinpope/java-web-app:latest .' - } - } - stage('Login') { - steps { - sh 'echo $HEROKU_API_KEY | docker login --username=_ --password-stdin registry.heroku.com' - } - } - stage('Push to Heroku registry') { - steps { - sh ''' - docker tag darinpope/java-web-app:latest registry.heroku.com/$APP_NAME/web - docker push registry.heroku.com/$APP_NAME/web - ''' - } - } - stage('Release the image') { - steps { - sh ''' - heroku container:release web --app=$APP_NAME - ''' - } - } - } - post { - always { - sh 'docker logout' - } - } -} \ No newline at end of file diff --git a/Jenkinsfile-1 b/Jenkinsfile-1 new file mode 100644 index 00000000..b73a94a5 --- /dev/null +++ b/Jenkinsfile-1 @@ -0,0 +1,12 @@ +pipeline { + agent { label 'linux' } + options { + buildDiscarder(logRotator(numToKeepStr: '5')) + } + stage('SonarQube Analysis') { + def mvn = tool 'Default Maven'; + withSonarQubeEnv() { + sh "${mvn}/bin/mvn clean verify sonar:sonar -Dsonar.projectKey=ajith" + } + } +} diff --git a/Jenkinsfile-2 b/Jenkinsfile-2 new file mode 100644 index 00000000..cf293943 --- /dev/null +++ b/Jenkinsfile-2 @@ -0,0 +1,22 @@ +pipeline { + agent { label 'linux' } + options { + buildDiscarder(logRotator(numToKeepStr: '5')) + } + stages { + stage('Scan') { + steps { + withSonarQubeEnv(installationName: 'sq1') { + sh './mvnw clean org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar' + } + } + } + stage("Quality Gate") { + steps { + timeout(time: 2, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } + } + } + } +} \ No newline at end of file