Need help with Groovy Pipeline script.

Seven Stars

Need help with Groovy Pipeline script.

What part of the script does git checkout and where on server will it checkout the code? I am getting missing pom.xml error from below script

 

[ERROR]   [ERROR]   The project  (/var/lib/jenkins/workspace/test_pipeline/cicd_poc_project/poms/pom.xml) has 1 error[ERROR]     Non-readable POM /var/lib/jenkins/workspace/test_pipeline/cicd_poc_project/poms/pom.xml: /var/lib/jenkins/workspace/test_pipeline/cicd_poc_project/poms/pom.xml (No such file or directory)

 

env.PROJECT_GIT_NAME = 'cicd_poc_project'
env.PROJECT_NAME = env.PROJECT_GIT_NAME.toLowerCase()
env.ARTIFACT = 'test_job'
env.VERSION = '0.1'
env.GIT_URL = 'https://github.com/XXXXX/XXXXXXXX.git'
env.CLOUD_URL = 'https://tmc.us.cloud.talend.com/inventory/'
env.TYPE = "" // if big data = _mr
env.IMAGE_NAME = 'XXX'   
// Credentials IDs (Manage Jenkins => Credentials)
env.GIT_CREDENTIALS_ID = 'XXXX'
env.TMC_CREDENTIALS_ID = 'XXXXX'

node {
 	// Clean workspace before doing anything
    try {
        def userInput
        def deployprod
        stage('Initialize') {
            sh '''
                echo "PATH = ${PATH}"
                echo "M2_HOME = ${M2_HOME}"
            ''' 
        }
        stage ('Git Checkout') {
            git(
                url: "${GIT_URL}",
                credentialsId: "${GIT_CREDENTIALS_ID}",
                branch: 'master'
            )       
            mvnHome = tool 'M3'
        }
        stage ('Build, Test and Publish artifacts to Cloud') {
            withCredentials([usernamePassword(credentialsId: "${TMC_CREDENTIALS_ID}", usernameVariable: 'Dusername', passwordVariable: 'Dpassword')]) {
					withMaven(
                            // Maven installation declared in the Jenkins "Global Tool Configuration"
                            maven: 'M3',
                            // Maven settings.xml file defined with the Jenkins Config File Provider Plugin
                            // Maven settings and global settings can also be defined in Jenkins Global Tools Configuration
                            mavenSettingsConfig: 'maven-settings-file',
                            mavenOpts: '-Dlicense.path=~/Documents/files/license -Dproduct.path=~/Documents/cmdline -Dgeneration.type=local -Dservice.url=${CLOUD_URL} -Dcloud.publisher.screenshot=true -Dcloud.publisher.skip=false -Dservice.accelerate=true -Dcloud.publisher.updateFlow=true -Dservice.username=$Dusername -Dservice.password=$Dpassword -Dcloud.publisher.environment=Development -Dcloud.publisher.workspace=XXXX -Xms1024m -Xmx3096m') 
                            {
                    
                        // Run the maven build
                        sh "mvn -X -f $PROJECT_GIT_NAME/poms/pom.xml -Pcloud-publisher clean deploy -fn -e -pl jobs/process${TYPE}/${ARTIFACT}_${VERSION} -am"
                    
                        }    
		        }
        }
        
    } catch (err) {
        currentBuild.result = 'FAILED'
        throw err
    }
}

 

 

 

Seven Stars

Re: Need help with Groovy Pipeline script.

Issue has been resolved. 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog