Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
sarora1
Creator
Creator

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
    }
}

 

 

 

Labels (4)
1 Reply
sarora1
Creator
Creator
Author

Issue has been resolved.