Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!groovy
package com.devopsnext.devops.email

def gitSendmail(String to, String from, String subject, String body)
def gitSendEmail(String to, String from, String subject, String body)
{
try {
String currentResult = 'SUCCESS'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!groovy
package com.devopsnext.devops.email

def sendmail(String to)
def sendEmail(String to)
{
try {
String currentResult = 'SUCCESS'
Expand Down
69 changes: 0 additions & 69 deletions src/com/devopsnext/devops/maven/build.groovy

This file was deleted.

141 changes: 141 additions & 0 deletions src/com/devopsnext/devops/maven/mavenOperations.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!groovy
package com.devopsnext.devops.maven

String MAVEN_GOALS,MAVEN_ROOT_POM

/*************************************
** Function to set the variables.
**************************************/
void setValues(String maven_goals,String root_pom)
{
this.MAVEN_GOALS = maven_goals
this.MAVEN_ROOT_POM = root_pom
}

/*************************************
** Function to set the pom variable.
**************************************/
void setValue(String root_pom)
{
this.MAVEN_ROOT_POM = root_pom
}
/*************************************
** Function to compile the code.
**************************************/
def compile()
{
try {
if ( "${MAVEN_ROOT_POM}" == "null" ) {
MAVEN_ROOT_POM = "pom.xml"
}
if ( "${MAVEN_GOALS}" == "null" ) {
MAVEN_GOALS = "clean install"
}
if (fileExists("${MAVEN_ROOT_POM}"))
{
wrap([$class: 'AnsiColorBuildWrapper']) {
println "\u001B[32m[INFO] compiling code from pom ${MAVEN_ROOT_POM}, please wait..."
println "\u001B[32mPOM VERSION => " + getVersion()
sh "mvn -f ${MAVEN_ROOT_POM} -B ${MAVEN_GOALS} -Dmaven.test.skip=true"
currentBuild.result = 'SUCCESS'
step([$class: 'StashNotifier'])
}
}
else
{
wrap([$class: 'AnsiColorBuildWrapper']) {
error "\u001B[41m[ERROR] ${MAVEN_ROOT_POM} file does not exist..."
}
}
}
catch (Exception excp) {
wrap([$class: 'AnsiColorBuildWrapper']) {
println "\u001B[41m[ERROR] failed to compile code using ${MAVEN_ROOT_POM}..."
currentBuild.result = 'FAILED'
step([$class: 'StashNotifier'])
throw excp
}
}
}
/********************************************
** Function to get the version from POM
*********************************************/
def getVersion()
{
try {
def matcher = readFile("${MAVEN_ROOT_POM}") =~ '<version>(.+)-.*</version>'
matcher ? matcher[0][1] : null
}
catch (Exception error) {
wrap([$class: 'AnsiColorBuildWrapper']) {
println "\u001B[41m[ERROR] failed to get version from ${MAVEN_ROOT_POM}..."
throw error
}
}
}

/*************************************
** Function to unit testing the code.
**************************************/
def unitTest()
{
try {
if ( "${MAVEN_ROOT_POM}" == "null" ) {
MAVEN_ROOT_POM = "pom.xml"
}
if (fileExists("${MAVEN_ROOT_POM}"))
{
wrap([$class: 'AnsiColorBuildWrapper']) {
println "\u001B[32m[INFO] testing code from pom ${MAVEN_ROOT_POM}, please wait..."
println "\u001B[32mPOM VERSION => " + getVersion()

sh "mvn -f ${MAVEN_ROOT_POM} -B test"
currentBuild.result = 'SUCCESS'
step([$class: 'StashNotifier'])
}
}
else
{
wrap([$class: 'AnsiColorBuildWrapper']) {
error "\u001B[41m[ERROR] ${MAVEN_ROOT_POM} file does not exist..."
}
}
}
catch (Exception excp) {
wrap([$class: 'AnsiColorBuildWrapper']) {
println "\u001B[41m[ERROR] failed to compile code using ${MAVEN_ROOT_POM}..."
currentBuild.result = 'FAILED'
step([$class: 'StashNotifier'])
throw excp
}
}
}

/***************************************
***** Function to upload artifacts
****************************************/
def uploadArtifacts()
{
try
{
if ( "${MAVEN_ROOT_POM}" == "null" ) {
MAVEN_ROOT_POM = "pom.xml"
}

wrap([$class: 'AnsiColorBuildWrapper']) {
println "\u001B[32m[INFO] uploading artifact to artifact management tool, please wait..."
sh "mvn -f ${MAVEN_ROOT_POM} -e -B clean deploy"
currentBuild.result = 'SUCCESS'
step([$class: 'StashNotifier'])
}
}
catch (error) {
wrap([$class: 'AnsiColorBuildWrapper']) {
println "\u001B[41m[ERROR] failed to upload artifact on artifact management tool, please check logs..."
currentBuild.result = 'FAILED'
step([$class: 'StashNotifier'])
throw error
}
}
}

40 changes: 0 additions & 40 deletions src/com/devopsnext/devops/maven/publish.groovy

This file was deleted.

65 changes: 0 additions & 65 deletions src/com/devopsnext/devops/maven/test.groovy

This file was deleted.

41 changes: 0 additions & 41 deletions src/com/devopsnext/devops/npm/build.groovy

This file was deleted.

Loading