-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
not able to retrieve getCommentBody or getCommentURL from currentBuild.buildCauses #33
Comments
Try this |
@devops-arena - Getting below error message - Scripts not permitted to use method com.adobe.jenkins.github_pr_comment_build.GitHubPullRequestCommentCause getCommentBody. Administrators can decide whether to approve or reject this signature. |
@om3171991 You need to go to Manage Jenkins --> In-process Script Approval --> Approve the signature |
@devops-arena - any other way around, don't have access to enable this. Our Jenkins is managed by the central team and it's a little tough to get this enabled. |
I have pushed a fix for this, at least it has worked in other plugins. As soon as it builds correctly and gets merged, I'll do a new release. |
@bluesliverx - Thanks. Much appreciated. Do we need to reconfigure the plugin to get this change under our Jenkins server? |
You would just need to upgrade the plugin on the Jenkins instance once it is released. No configuration changes would be necessary as it is a change to the classes themselves. This may take a few hours (up to a day) to the newest version in the repositories. Unfortunately, they have changed the release process since the last time I did this, and now I need to wait for jenkins-infra/repository-permissions-updater#2090 to be merged before I can release. |
I changed the versioning scheme for incremental releases, and 58.v945be9f1661f has been released with the fix for this. |
Looking at |
#33 Add exported attributes to generate better JSON
I won't be able to upgrade our server until later tonight, so if anyone gets a chance to try out the latest release ( |
Success! This build works great. Here is what I included in my Jenkinsfile:
Here is the output:
|
Hey Team,
We are trying to get github comment body to trigger different stages of pipeline using "when" expression and hence need commentbody to check which comment triggered this build ..like "testpr" to run tests, "deploypr" to do deployment, etc.
We have set up a multibranch pipeline and trigger build based on comments by developer.
Pipeline script:
pipeline {
agent { label 'any' }
stages {
stage('Pre-build') {
steps {
script {
dir("${WORKSPACE}") {
script {
echo "${glance_tag}"
echo "${currentBuild.buildCauses}" // [[_class:com.adobe.jenkins.github_pr_comment_build.GitHubPullRequestCommentCause, shortDescription:GitHub pull request comment]]
def buildCauses = currentBuild.buildCauses
echo "$buildCauses.getCommentBody()" // gives null
echo "$buildCauses.getCommentUrl()" // gives null
echo "$buildCauses.shortDescription" // gives GitHub pull request comment
}
}
}
}
}
}
}
Can you please tell me - what I am doing wrong to fetch required information.
The text was updated successfully, but these errors were encountered: