I am trying to migrate my Jenkins freestlye job to pipeline. In the post build action i am using
publish coverage to GitHub
where
Jacoco coverage counter type as Instruction
Publish result as comment.
Now i am trying to do same from Jenkins pipeline.
post {
success {
jacoco(
execPattern: '**/**.exec',
classPattern: '**/classes',
sourcePattern: '**/src/main/java',
exclusionPattern: '',
inclusionPattern: '**/*.java,**/*.groovy,**/*.kt,**/*.kts'
)
script {
step([$class: 'MasterCoverageAction',
jacocoCounterType: 'INSTRUCTION',
publishResultAs: 'COMMENT'
])
}
}
}
But seeing errot as this.
WARNING: Unknown parameter(s) found for class type 'com.github.terma.jenkins.githubprcoveragestatus.MasterCoverageAction': publishResultAs
[Pipeline] }
[Pipeline] // script
Error when executing success post condition:
java.lang.UnsupportedOperationException: Can't find GIT_URL or CHANGE_URL in envs
I can see GIT_URL was set as gloabal variable in freestyle job but in pipeline even though i am passing from Jenkins it is not recognising GIT_URL.
environment {
SKIP_SONAR = false // Default to false
GIT_URL = "https://github.com/test/test.git"
}
stages {
stage('Debug') {
steps {
script {
'sh printenv'
def gitUrl = env.GIT_URL
echo "Automatically set GIT_URL: ${gitUrl}"
}
}
}