diff --git a/.gitignore b/.gitignore index 20de19c7a..b0e79edf6 100644 --- a/.gitignore +++ b/.gitignore @@ -86,11 +86,6 @@ buildprod.sh runit.sh runprod.sh -# Sonar Runner -# ============ -/sonar-runner/.gradle -/sonar-runner/build - # Automated Functional Tests # ============ **/.gradle diff --git a/Jenkinsfile.dev b/Jenkinsfile.dev index 3e47a5839..e2735ead9 100644 --- a/Jenkinsfile.dev +++ b/Jenkinsfile.dev @@ -110,40 +110,6 @@ node('master') { } } -podTemplate(label: 'sonarqube-maven', name: 'sonarqube-maven', serviceAccount: 'jenkins', cloud: 'openshift', containers: [ - containerTemplate( - name: 'jnlp', - image: 'registry.access.redhat.com/openshift3/jenkins-slave-maven-rhel7', - resourceRequestCpu: '500m', - resourceLimitCpu: '1000m', - resourceRequestMemory: '1Gi', - resourceLimitMemory: '4Gi', - workingDir: '/tmp', - command: '', - args: '${computer.jnlpmac} ${computer.name}' - ) -]) -{ - stage('Code Quality Check') { - node('sonarqube-maven'){ - //the checkout is mandatory, otherwise code quality check would fail - echo "checking out source" - echo "Build: ${BUILD_ID}" - checkout scm - SONARQUBE_URL = sh ( - script: 'oc get routes -o wide --no-headers | awk \'/sonarqube/{ print match($0,/edge/) ? "https://"$2 : "http://"$2 }\'', - returnStdout: true - ).trim() - echo "SONARQUBE_URL: ${SONARQUBE_URL}" - dir('sonar-runner') { - try { - sh returnStdout: true, script: "./gradlew sonarqube -Dsonar.host.url=${SONARQUBE_URL} -Dsonar.verbose=true --stacktrace --info" - } finally { } - } - } - } -} - node('master'){ /* * Extract secrets and create relevant environment variables. diff --git a/sonar-runner/README.md b/sonar-runner/README.md deleted file mode 100644 index 77b5e3b88..000000000 --- a/sonar-runner/README.md +++ /dev/null @@ -1,22 +0,0 @@ -This example demonstrates how to analyze a simple Java project with Gradle. - -Prerequisites -============= -* [SonarQube](http://www.sonarqube.org/downloads/) 6.7+ -* [Gradle](http://www.gradle.org/) 2.1 or higher - -Usage -===== -* Analyze the project with SonarQube using Gradle: - - ./gradlew sonarqube [-Dsonar.host.url=... -Dsonar.jdbc.url=... -Dsonar.jdbc.username=... -Dsonar.jdbc.password=...] - -Local Install -============= -To install SonarQube locally do the following: -* Download the version for your OS from [SonarQube](http://www.sonarqube.org/downloads/) -* Install locally following the directions -* Run server: http://localhost:9000 -* Review your build.gradle, you need to add the following property: ```property "sonar.host.url", "http://localhost:9000"``` -* run ./gradlew sonarqube from this directory -* Go to web browser and review result diff --git a/sonar-runner/build.gradle b/sonar-runner/build.gradle deleted file mode 100644 index e3c6af189..000000000 --- a/sonar-runner/build.gradle +++ /dev/null @@ -1,93 +0,0 @@ -// Uses DSL plugins resolution introduced in Gradle 2.1 -plugins { - id "java" - id "jacoco" - id "org.sonarqube" version "2.6.1" -} - - -def env = System.env - -//consume environment variables and cli arguments -//cli usage -// ./gradlew -Pproject_name_extension=foo -//env variable usage -// in .bashrc or equivalent -// export SONAR_PROJECT_NAME_EXTENSION -// ensure that the file is sourced to populate your environment -// verify with -// printenv | grep SONAR -//then ./gradlew sonarQube - -def pne = "" - -if ( project.hasProperty('project_name_extension') ) { - pne = "-" + project_name_extension -} else if ( env.SONAR_PROJECT_NAME_EXTENSION != null ) { - pne = "-" + env.SONAR_PROJECT_NAME_EXTENSION -} - -//consume environment variables and cli arguments -//cli usage -// ./gradlew -Pproject_key_extension=foo sonarqube -//env variable usage -// in .bashrc or equivalent -// export SONAR_PROJECT_KEY_EXTENSION -// ensure that the file is sourced to populate your environment -// verify with -// printenv | grep SONAR -//then ./gradlew sonarqube - -def pke = "" - -if ( project.hasProperty('project_key_extension') ) { - pke = "-" + project_key_extension -} else if ( env.SONAR_PROJECT_KEY_EXTENSION != null ) { - pke = "-" + env.SONAR_PROJECT_KEY_EXTENSION -} - -sonarqube { - properties { - property "sonar.host.url", "https://sonarqube-mem-mmt-tools.pathfinder.gov.bc.ca" - property "sonar.projectName", "MEM-ADMIN$pne" - property "sonar.projectKey", "org.sonarqube:bcgov-mem-admin$pke" - property "sonar.projectBaseDir", "../" - property "sonar.sources", "./modules" - //property "sonar.tests", "test" - property "sourceEncoding", "UTF-8" - } -} - -allprojects { - TimeZone.getTimeZone('UTC') - Date date = new Date() - String newdate = date.format("yyyyMMdd-HH:mm:ss") - String hostName = InetAddress.getLocalHost().getHostName() - String buildNum = System.getenv("BUILD_NUMBER") - String buildIdentifier = buildNum != null ? buildNum : hostName - - ext.baseVersion = newdate + "_" + buildIdentifier - ext.snapshotVersion = false - - group = "org.sonarqube" - version = "$baseVersion" + (snapshotVersion ? "-SNAPSHOT" : "") -} - -test { - ignoreFailures = true -} - -dependencies { - testCompile 'junit:junit:4.12' -} - -repositories { - repositories { - maven { - url "http://repo1.maven.org/maven2/" - } - maven { - url "https://plugins.gradle.org/m2/" - } - } -} diff --git a/sonar-runner/gradle/ci.gradle b/sonar-runner/gradle/ci.gradle deleted file mode 100644 index 1491d969d..000000000 --- a/sonar-runner/gradle/ci.gradle +++ /dev/null @@ -1,11 +0,0 @@ -if (System.getenv('SNAP_CI')) { - chromeTest { - systemProperty "webdriver.chrome.driver", "/usr/local/bin/chromedriver" - } - - tasks.withType(Test) { - testLogging { - exceptionFormat = 'full' - } - } -} diff --git a/sonar-runner/gradle/idea.gradle b/sonar-runner/gradle/idea.gradle deleted file mode 100644 index 7dc11be2b..000000000 --- a/sonar-runner/gradle/idea.gradle +++ /dev/null @@ -1,12 +0,0 @@ -apply plugin: "idea" - -idea { - project { - ipr { - withXml { provider -> - def node = provider.asNode() - node.component.find { it.'@name' == 'VcsDirectoryMappings' }?.mapping[0].'@vcs' = 'Git' - } - } - } -} \ No newline at end of file diff --git a/sonar-runner/gradle/osSpecificDownloads.gradle b/sonar-runner/gradle/osSpecificDownloads.gradle deleted file mode 100644 index 74284c988..000000000 --- a/sonar-runner/gradle/osSpecificDownloads.gradle +++ /dev/null @@ -1,72 +0,0 @@ -import org.apache.tools.ant.taskdefs.condition.Os -import org.apache.commons.io.FileUtils - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath "commons-io:commons-io:2.5" - } -} - -task downloadChromeDriver { - def outputFile = file("$buildDir/webdriver/chromedriver.zip") - inputs.property("chromeDriverVersion", chromeDriverVersion) - outputs.file(outputFile) - - doLast { - def driverOsFilenamePart - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - driverOsFilenamePart = "win32" - } else if (Os.isFamily(Os.FAMILY_MAC)) { - driverOsFilenamePart = "mac64" - } else if (Os.isFamily(Os.FAMILY_UNIX)) { - driverOsFilenamePart = Os.isArch("amd64") ? "linux64" : "linux32" - } - FileUtils.copyURLToFile(new URL("http://chromedriver.storage.googleapis.com/${chromeDriverVersion}/chromedriver_${driverOsFilenamePart}.zip"), outputFile) - } -} - -task unzipChromeDriver(type: Copy) { - def outputDir = file("$buildDir/webdriver/chromedriver") - dependsOn downloadChromeDriver - outputs.dir(outputDir) - - from(zipTree(downloadChromeDriver.outputs.files.singleFile)) - into(outputDir) -} - -task downloadPhantomJs { - def osFilenamePart - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - osFilenamePart = "windows.zip" - } else if (Os.isFamily(Os.FAMILY_MAC)) { - osFilenamePart = "macosx.zip" - } else if (Os.isFamily(Os.FAMILY_UNIX)) { - osFilenamePart = Os.isArch("amd64") ? "linux-x86_64.tar.bz2" : "linux-i686.tar.bz2" - } - - def filename = "phantomjs-$phantomJsVersion-$osFilenamePart" - def outputFile = file("$buildDir/webdriver/$filename") - inputs.property("phantomJsVersion", phantomJsVersion) - outputs.file(outputFile) - - doLast { - FileUtils.copyURLToFile(new URL("https://bitbucket.org/ariya/phantomjs/downloads/$filename"), outputFile) - } -} - -task unzipPhantomJs(type: Copy) { - def outputDir = file("$buildDir/webdriver/phantomjs") - dependsOn downloadPhantomJs - outputs.dir(outputDir) - - def archive = downloadPhantomJs.outputs.files.singleFile - - from(Os.isFamily(Os.FAMILY_MAC) || Os.isFamily(Os.FAMILY_WINDOWS) ? zipTree(archive) : tarTree(archive)) - into(outputDir) - eachFile { FileCopyDetails fcp -> - fcp.relativePath = new RelativePath(!fcp.directory, *fcp.relativePath.segments[1..-1]) - } -} \ No newline at end of file diff --git a/sonar-runner/gradle/wrapper/gradle-wrapper.jar b/sonar-runner/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 6ffa23784..000000000 Binary files a/sonar-runner/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/sonar-runner/gradle/wrapper/gradle-wrapper.properties b/sonar-runner/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index a2e5c9137..000000000 --- a/sonar-runner/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Tue Sep 20 22:02:53 BST 2016 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip diff --git a/sonar-runner/gradlew b/sonar-runner/gradlew deleted file mode 100755 index 9aa616c27..000000000 --- a/sonar-runner/gradlew +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/sonar-runner/gradlew.bat b/sonar-runner/gradlew.bat deleted file mode 100644 index f9553162f..000000000 --- a/sonar-runner/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega