Coder Social home page Coder Social logo

Comments (5)

agaudreault avatar agaudreault commented on July 19, 2024 2

Take a look at https://ci.jenkins.io/pipeline-syntax/ and select publishChecks in the list to see the available aprameters and their documentation.

You can use the status and conclusion parameters.

publishChecks name: 'Jenkins/SBXDEPLOY Deploy', status: 'IN_PROGRESS', title: 'Cleanup', conclusion: 'NONE'
and
publishChecks name: 'Jenkins/SBXDEPLOY Deploy', status: 'COMPLETED', title: 'Cleanup', conclusion: 'FAILED'

from checks-api-plugin.

KalleOlaviNiemitalo avatar KalleOlaviNiemitalo commented on July 19, 2024 2

PublishChecksStep seems to use ChecksConclusion.SUCCESS by default. Does it work better if you explicitly specify conclusion: 'NONE', which would be the default in ChecksDetails.ChecksDetailsBuilder? If it does, then perhaps the default should be changed in PublishChecksStep, or perhaps GitHubChecksPublisher should be changed to ignore the conclusion if the status is IN_PROGRESS.

private ChecksStatus status = ChecksStatus.COMPLETED;
private ChecksConclusion conclusion = ChecksConclusion.SUCCESS;

public ChecksDetailsBuilder() {
this.conclusion = ChecksConclusion.NONE;
this.actions = new ArrayList<>();
}

https://github.com/jenkinsci/github-checks-plugin/blob/6ad6d9260e7f3b262965466971ea3e69a4c06e23/src/main/java/io/jenkins/plugins/checks/github/GitHubChecksPublisher.java#L119-L122

https://github.com/hub4j/github-api/blob/cb381dfa06542d9954de1f58915d70fc6e23e1f7/src/main/java/org/kohsuke/github/GHCheckRunBuilder.java#L100-L105

https://docs.github.com/en/rest/reference/checks#create-a-check-run--parameters

from checks-api-plugin.

rmathewsbeyond avatar rmathewsbeyond commented on July 19, 2024

Thanks for the guidance, I'm fairly new to jenkins and its plugins. Thanks for sharing the pipeline-syntax, a valuable tool indeed.

I've updated the code to include status and summary. This is my observation, not sure if its an issue.

  • publishChecks(name: 'Jenkins/Scratch Build and Deploy', title: 'Authorize - PASS', summary: '', text: '', detailsURL: "${JENKINS_URL}", status:'IN_PROGRESS')
    on GitHub UI, it still shows green tick, even though status = IN_PROGRESS

  • publishChecks(name: 'Jenkins/Scratch Build and Deploy', title: 'Authorize - FAIL', summary: '', text: '', detailsURL: "${JENKINS_URL}", status:'COMPLETED', conclusion: 'FAILURE')
    on GitHub UI, shows the red cross

Thanks for answering my question, I will close this issue as its giving me what I was mainly looking for ie. red cross on fail. yellow dot for in_progress is a good to have.

from checks-api-plugin.

rmathewsbeyond avatar rmathewsbeyond commented on July 19, 2024

Thanks, explicitly specifying conclusion: 'NONE' did resolve the issue. Thanks again.

from checks-api-plugin.

XiongKezhi avatar XiongKezhi commented on July 19, 2024

@KalleOlaviNiemitalo thanks very much, the GitHub will automatically set the status to be completed if the conclusion is provided, so maybe I should change the conclusion to NONE when the status is queued or in_progress.

from checks-api-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.