Code Monkey home page Code Monkey logo

Comments (11)

devops-arena avatar devops-arena commented on July 20, 2024

Try this
def triggerCause = currentBuild.rawBuild.getCause(com.adobe.jenkins.github_pr_comment_build.GitHubPullRequestCommentCause)
echo("Build was started by ${triggerCause.commentBody}")

from github-pr-comment-build-plugin.

om3171991 avatar om3171991 commented on July 20, 2024

@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.

from github-pr-comment-build-plugin.

devops-arena avatar devops-arena commented on July 20, 2024

@om3171991 You need to go to Manage Jenkins --> In-process Script Approval --> Approve the signature

from github-pr-comment-build-plugin.

om3171991 avatar om3171991 commented on July 20, 2024

@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.

from github-pr-comment-build-plugin.

bluesliverx avatar bluesliverx commented on July 20, 2024

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.

from github-pr-comment-build-plugin.

om3171991 avatar om3171991 commented on July 20, 2024

@bluesliverx - Thanks. Much appreciated. Do we need to reconfigure the plugin to get this change under our Jenkins server?

from github-pr-comment-build-plugin.

bluesliverx avatar bluesliverx commented on July 20, 2024

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.

from github-pr-comment-build-plugin.

bluesliverx avatar bluesliverx commented on July 20, 2024

I changed the versioning scheme for incremental releases, and 58.v945be9f1661f has been released with the fix for this.

from github-pr-comment-build-plugin.

bluesliverx avatar bluesliverx commented on July 20, 2024

Looking at currentBuild.getBuildCauses() (or its override), I do not see the body/author/URL attributes included in the generated JSON. This is likely because of #37. I'll release this and check it later to see if that fixes the issue.

from github-pr-comment-build-plugin.

bluesliverx avatar bluesliverx commented on July 20, 2024

I won't be able to upgrade our server until later tonight, so if anyone gets a chance to try out the latest release (61.v...) and see if it works, let me know.

from github-pr-comment-build-plugin.

bluesliverx avatar bluesliverx commented on July 20, 2024

Success! This build works great. Here is what I included in my Jenkinsfile:

echo("build causes: ${currentBuild.getBuildCauses()}")

Here is the output:

build causes: [[_class:com.adobe.jenkins.github_pr_comment_build.GitHubPullRequestCommentCause, shortDescription:GitHub pull request comment, commentAuthor:saville, commentBody:this is comment, commentUrl:https://github.com/jenkinsci/github-pr-comment-build/pull/1#issuecomment-1234]]

from github-pr-comment-build-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.